diff --git a/core/java/android/app/ActivityView.java b/core/java/android/app/ActivityView.java index 415ec64dc1260..e8918285777bb 100644 --- a/core/java/android/app/ActivityView.java +++ b/core/java/android/app/ActivityView.java @@ -120,8 +120,10 @@ public class ActivityView extends ViewGroup { mActivityTaskManager = ActivityTaskManager.getService(); mSurfaceView = new SurfaceView(context); + // 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()); mSurfaceView.setUseAlpha(); - mSurfaceView.setAlpha(0f); mSurfaceCallback = new SurfaceCallback(); mSurfaceView.getHolder().addCallback(mSurfaceCallback); addView(mSurfaceView); @@ -348,9 +350,20 @@ public class ActivityView extends ViewGroup { mSurfaceView.layout(0 /* left */, 0 /* top */, r - l /* right */, b - t /* bottom */); } + /** + * Sets the alpha value when the content of {@link SurfaceView} needs to show or hide. + *
Note: The surface view may ignore the alpha value in some cases. Refer to + * {@link SurfaceView#setAlpha} for more details. + * + * @param alpha The opacity of the view. + */ @Override public void setAlpha(float alpha) { - mSurfaceView.setAlpha(alpha); + super.setAlpha(alpha); + + if (mSurfaceView != null) { + mSurfaceView.setAlpha(alpha); + } } @Override diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java index 923ca20b39251..de08a8c9c1b33 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java @@ -182,7 +182,7 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList mActivityView = new ActivityView(mContext, null /* attrs */, 0 /* defStyle */, true /* singleTaskInstance */); - + // Set ActivityView's alpha value as zero, since there is no view content to be shown. setContentVisibility(false); addView(mActivityView);