android.view.SurfaceControl#Builder ( )源码实例Demo

下面列出了android.view.SurfaceControl#Builder ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

public WindowSurfaceController(SurfaceSession s, String name, int w, int h, int format,
        int flags, WindowStateAnimator animator, int windowType, int ownerUid) {
    mAnimator = animator;

    mSurfaceW = w;
    mSurfaceH = h;

    title = name;

    mService = animator.mService;
    final WindowState win = animator.mWin;
    mWindowType = windowType;
    mWindowSession = win.mSession;

    Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "new SurfaceControl");
    final SurfaceControl.Builder b = win.makeSurface()
            .setParent(win.getSurfaceControl())
            .setName(name)
            .setSize(w, h)
            .setFormat(format)
            .setFlags(flags)
            .setMetadata(windowType, ownerUid);
    mSurfaceControl = b.build();
    Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
}
 
源代码2 项目: android_9.0.0_r45   文件: SurfaceAnimator.java
private SurfaceControl createAnimationLeash(SurfaceControl surface, Transaction t, int width,
        int height, boolean hidden) {
    if (DEBUG_ANIM) Slog.i(TAG, "Reparenting to leash");
    final SurfaceControl.Builder builder = mAnimatable.makeAnimationLeash()
            .setParent(mAnimatable.getAnimationLeashParent())
            .setName(surface + " - animation-leash")
            .setSize(width, height);
    final SurfaceControl leash = builder.build();
    if (!hidden) {
        t.show(leash);
    }
    t.reparent(surface, leash.getHandle());
    return leash;
}
 
源代码3 项目: android_9.0.0_r45   文件: DisplayContent.java
@Override
SurfaceControl.Builder makeChildSurface(WindowContainer child) {
    final SurfaceControl.Builder builder = super.makeChildSurface(child);
    if (child instanceof WindowToken && ((WindowToken) child).mRoundedCornerOverlay) {
        // To draw above the ColorFade layer during the screen off transition, the
        // rounded corner overlays need to be at the root of the surface hierarchy.
        // TODO: move the ColorLayer into the display overlay layer such that this is not
        // necessary anymore.
        builder.setParent(null);
    }
    return builder;
}
 
源代码4 项目: android_9.0.0_r45   文件: DisplayContent.java
@Override
SurfaceControl.Builder makeChildSurface(WindowContainer child) {
    SurfaceSession s = child != null ? child.getSession() : getSession();
    final SurfaceControl.Builder b = mService.makeSurfaceBuilder(s);
    b.setSize(mSurfaceSize, mSurfaceSize);

    if (child == null) {
        return b;
    }

    return b.setName(child.getName())
            .setParent(mWindowingLayer);
}
 
源代码5 项目: android_9.0.0_r45   文件: WindowContainer.java
/**
 * @param child The WindowContainer this child surface is for, or null if the Surface
 *              is not assosciated with a WindowContainer (e.g. a surface used for Dimming).
 */
SurfaceControl.Builder makeChildSurface(WindowContainer child) {
    final WindowContainer p = getParent();
    // Give the parent a chance to set properties. In hierarchy v1 we rely
    // on this to set full-screen dimensions on all our Surface-less Layers.
    return p.makeChildSurface(child)
            .setParent(mSurfaceControl);
}
 
源代码6 项目: android_9.0.0_r45   文件: DisplayContent.java
/**
 * Create new {@link DisplayContent} instance, add itself to the root window container and
 * initialize direct children.
 * @param display May not be null.
 * @param service You know.
 * @param wallpaperController wallpaper windows controller used to adjust the positioning of the
 *                            wallpaper windows in the window list.
 */
DisplayContent(Display display, WindowManagerService service,
        WallpaperController wallpaperController, DisplayWindowController controller) {
    super(service);
    setController(controller);
    if (service.mRoot.getDisplayContent(display.getDisplayId()) != null) {
        throw new IllegalArgumentException("Display with ID=" + display.getDisplayId()
                + " already exists=" + service.mRoot.getDisplayContent(display.getDisplayId())
                + " new=" + display);
    }

    mDisplay = display;
    mDisplayId = display.getDisplayId();
    mWallpaperController = wallpaperController;
    display.getDisplayInfo(mDisplayInfo);
    display.getMetrics(mDisplayMetrics);
    isDefaultDisplay = mDisplayId == DEFAULT_DISPLAY;
    mDisplayFrames = new DisplayFrames(mDisplayId, mDisplayInfo,
            calculateDisplayCutoutForRotation(mDisplayInfo.rotation));
    initializeDisplayBaseInfo();
    mDividerControllerLocked = new DockedStackDividerController(service, this);
    mPinnedStackControllerLocked = new PinnedStackController(service, this);

    // We use this as our arbitrary surface size for buffer-less parents
    // that don't impose cropping on their children. It may need to be larger
    // than the display size because fullscreen windows can be shifted offscreen
    // due to surfaceInsets. 2 times the largest display dimension feels like an
    // appropriately arbitrary number. Eventually we would like to give SurfaceFlinger
    // layers the ability to match their parent sizes and be able to skip
    // such arbitrary size settings.
    mSurfaceSize = Math.max(mBaseDisplayHeight, mBaseDisplayWidth) * 2;

    final SurfaceControl.Builder b = mService.makeSurfaceBuilder(mSession)
            .setSize(mSurfaceSize, mSurfaceSize)
            .setOpaque(true);
    mWindowingLayer = b.setName("Display Root").build();
    mOverlayLayer = b.setName("Display Overlays").build();

    getPendingTransaction().setLayer(mWindowingLayer, 0)
            .setLayerStack(mWindowingLayer, mDisplayId)
            .show(mWindowingLayer)
            .setLayer(mOverlayLayer, 1)
            .setLayerStack(mOverlayLayer, mDisplayId)
            .show(mOverlayLayer);
    getPendingTransaction().apply();

    // These are the only direct children we should ever have and they are permanent.
    super.addChild(mBelowAppWindowsContainers, null);
    super.addChild(mTaskStackContainers, null);
    super.addChild(mAboveAppWindowsContainers, null);
    super.addChild(mImeWindowsContainers, null);

    // Add itself as a child to the root container.
    mService.mRoot.addChild(this, null);

    // TODO(b/62541591): evaluate whether this is the best spot to declare the
    // {@link DisplayContent} ready for use.
    mDisplayReady = true;
}
 
源代码7 项目: android_9.0.0_r45   文件: DisplayContent.java
SurfaceControl.Builder makeSurface(SurfaceSession s) {
    return mService.makeSurfaceBuilder(s)
            .setParent(mWindowingLayer);
}
 
源代码8 项目: android_9.0.0_r45   文件: Dimmer.java
@Override
public SurfaceControl.Builder makeAnimationLeash() {
    return mHost.makeAnimationLeash();
}
 
源代码9 项目: android_9.0.0_r45   文件: WindowContainer.java
SurfaceControl.Builder makeSurface() {
    final WindowContainer p = getParent();
    return p.makeChildSurface(this);
}
 
源代码10 项目: android_9.0.0_r45   文件: SurfaceAnimator.java
/**
 * @return A new surface to be used for the animation leash, inserted at the correct
 *         position in the hierarchy.
 */
SurfaceControl.Builder makeAnimationLeash();
 
源代码11 项目: android_9.0.0_r45   文件: DisplayContent.java
/**
 * The makeSurface variants are for use by the window-container
 * hierarchy. makeOverlay here is a function for various non windowing
 * overlays like the ScreenRotation screenshot, the Strict Mode Flash
 * and other potpourii.
 */
SurfaceControl.Builder makeOverlay() {
    return mService.makeSurfaceBuilder(mSession)
        .setParent(mOverlayLayer);
}
 
源代码12 项目: android_9.0.0_r45   文件: Letterbox.java
/**
 * Constructs a Letterbox.
 *
 * @param surfaceControlFactory a factory for creating the managed {@link SurfaceControl}s
 */
public Letterbox(Supplier<SurfaceControl.Builder> surfaceControlFactory) {
    mFactory = surfaceControlFactory;
}
 
源代码13 项目: android_9.0.0_r45   文件: SurfaceBuilderFactory.java
SurfaceControl.Builder make(SurfaceSession s);