diff options
| author | 2019-01-02 16:33:12 -0800 | |
|---|---|---|
| committer | 2019-01-04 10:36:40 -0800 | |
| commit | d44449df803d86233a74bb895a99c1f2cd2650b5 (patch) | |
| tree | ff56a5fdd3575878a70aef1a2d84a50f51457ddd | |
| parent | 76e986a2f25e71924937b63bbf1cd793d72094d3 (diff) | |
Forward setVisibility call to SurfaceView for ActivityView.
SurfaceView setVisibility handles removing the surface already. By
forwarding the visiblity call from AV to the SV, SV will destroy the
surface. It will callback into AV through SurfaceCallback.surfaceDestroyed.
In the callback, AV removes the surface for the display, causing the
virtual display to turn off. When the virtual display is turned off, the
activities on that display will get stopped.
Test: ActivityViewVisibilityActivity
Change-Id: Iea8b57d7871b8c87457f2ae19485a610d0d74c38
| -rw-r--r-- | core/java/android/app/ActivityView.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/core/java/android/app/ActivityView.java b/core/java/android/app/ActivityView.java index 680fed80d029..b86ba58d8c69 100644 --- a/core/java/android/app/ActivityView.java +++ b/core/java/android/app/ActivityView.java @@ -37,6 +37,7 @@ import android.view.SurfaceControl; import android.view.SurfaceHolder; import android.view.SurfaceSession; import android.view.SurfaceView; +import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; import android.view.WindowManagerGlobal; @@ -345,6 +346,12 @@ public class ActivityView extends ViewGroup { } } + @Override + protected void onVisibilityChanged(View changedView, int visibility) { + super.onVisibilityChanged(changedView, visibility); + mSurfaceView.setVisibility(visibility); + } + private void initVirtualDisplay(SurfaceSession surfaceSession) { if (mVirtualDisplay != null) { throw new IllegalStateException("Trying to initialize for the second time."); |