Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c2a10611 authored by Shawn Lin's avatar Shawn Lin Committed by Automerger Merge Worker
Browse files

Merge "Add a @hide ctr to disable background layer in ActivityView &...

Merge "Add a @hide ctr to disable background layer in ActivityView & SurfaceView" into rvc-dev am: c54d84a8

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11700783

Change-Id: Iad0b62418889e48c72e1ef621d5f3b27d092aaad
parents 8380d232 c54d84a8
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -102,6 +102,14 @@ public class ActivityView extends ViewGroup implements android.window.TaskEmbedd
    public ActivityView(
            @NonNull Context context, @NonNull AttributeSet attrs, int defStyle,
            boolean singleTaskInstance, boolean usePublicVirtualDisplay) {
        this(context, attrs, defStyle, singleTaskInstance, usePublicVirtualDisplay, false);
    }

    /** @hide */
    public ActivityView(
            @NonNull Context context, @NonNull AttributeSet attrs, int defStyle,
            boolean singleTaskInstance, boolean usePublicVirtualDisplay,
            boolean disableSurfaceViewBackgroundLayer) {
        super(context, attrs, defStyle);
        if (useTaskOrganizer()) {
            mTaskEmbedder = new TaskOrganizerTaskEmbedder(context, this);
@@ -109,7 +117,7 @@ public class ActivityView extends ViewGroup implements android.window.TaskEmbedd
            mTaskEmbedder = new VirtualDisplayTaskEmbedder(context, this, singleTaskInstance,
                    usePublicVirtualDisplay);
        }
        mSurfaceView = new SurfaceView(context);
        mSurfaceView = new SurfaceView(context, null, 0, 0, disableSurfaceViewBackgroundLayer);
        // Since ActivityView#getAlpha has been overridden, we should use parent class's alpha
        // as master to synchronize surface view's alpha value.
        mSurfaceView.setAlpha(super.getAlpha());
+10 −1
Original line number Diff line number Diff line
@@ -134,6 +134,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
    // we need to preserve the old one until the new one has drawn.
    SurfaceControl mDeferredDestroySurfaceControl;
    SurfaceControl mBackgroundControl;
    private boolean mDisableBackgroundLayer = false;

    /**
     * We use this lock in SOME cases when reading or writing SurfaceControl,
@@ -245,10 +246,17 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
    }

    public SurfaceView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        this(context, attrs, defStyleAttr, defStyleRes, false);
    }

    /** @hide */
    public SurfaceView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr,
            int defStyleRes, boolean disableBackgroundLayer) {
        super(context, attrs, defStyleAttr, defStyleRes);
        mRenderNode.addPositionUpdateListener(mPositionListener);

        setWillNotDraw(true);
        mDisableBackgroundLayer = disableBackgroundLayer;
    }

    /**
@@ -839,7 +847,8 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
        if (mBackgroundControl == null) {
            return;
        }
        if ((mSubLayer < 0) && ((mSurfaceFlags & SurfaceControl.OPAQUE) != 0)) {
        if ((mSubLayer < 0) && ((mSurfaceFlags & SurfaceControl.OPAQUE) != 0)
                && !mDisableBackgroundLayer) {
            t.show(mBackgroundControl);
        } else {
            t.hide(mBackgroundControl);
+2 −1
Original line number Diff line number Diff line
@@ -264,7 +264,8 @@ public class BubbleExpandedView extends LinearLayout {
        mSettingsIcon = findViewById(R.id.settings_button);

        mActivityView = new ActivityView(mContext, null /* attrs */, 0 /* defStyle */,
                true /* singleTaskInstance */);
                true /* singleTaskInstance */, false /* usePublicVirtualDisplay*/,
                true /* disableSurfaceViewBackgroundLayer */);

        // Set ActivityView's alpha value as zero, since there is no view content to be shown.
        setContentVisibility(false);