Merge "Add a @hide ctr to disable background layer in ActivityView & SurfaceView" into rvc-dev
This commit is contained in:
@@ -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());
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user