diff options
| author | 2019-12-19 19:15:07 +0800 | |
|---|---|---|
| committer | 2020-01-03 17:33:08 +0000 | |
| commit | 24b0bf62189011abe2f67bde7c0e9411145a4f3e (patch) | |
| tree | b74848d9b04109bb15ffdde9d6bafa76bde817f9 | |
| parent | b41bab2aced124639157df064b06ed8b1743316d (diff) | |
Update the ensure activities visible condition for activity home stack.
There is a policy to say there is no other task in the home stack should
be visible behind the home activity. After 076c3b1b, Activity stack check
each activity visibility state by EnsureActivitiesVisibleHelper. Only
the topmost activity in home stack was being visible, the rest activities
within the same task were always evaluated as invisible
(no matter the topmost activity is fullscreen or not).
This CL update the determined rule and add test case.
Rule: 1. activity type is home
2. Check if activity is the root of the task.
Bug: 145636535
Test: 1. atest WmTests:ActivityStackTests
2. Connect to WIFI in OOBE. Check the background activity if visible.
Change-Id: I8a635f4f162ce627ee56306726f87ddcf2790073
| -rw-r--r-- | services/core/java/com/android/server/wm/EnsureActivitiesVisibleHelper.java | 3 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/ActivityStackTests.java | 21 |
2 files changed, 23 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/wm/EnsureActivitiesVisibleHelper.java b/services/core/java/com/android/server/wm/EnsureActivitiesVisibleHelper.java index 949ff195d731..e205f17fa2af 100644 --- a/services/core/java/com/android/server/wm/EnsureActivitiesVisibleHelper.java +++ b/services/core/java/com/android/server/wm/EnsureActivitiesVisibleHelper.java @@ -156,7 +156,8 @@ class EnsureActivitiesVisibleHelper { // determined individually unlike other stacks where the visibility or fullscreen // status of an activity in a previous task affects other. mBehindFullscreenActivity = !mContainerShouldBeVisible; - } else if (mContiner.isActivityTypeHome()) { + } else if (!mBehindFullscreenActivity && mContiner.isActivityTypeHome() + && r.isRootOfTask()) { if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY, "Home task: at " + mContiner + " stackShouldBeVisible=" + mContainerShouldBeVisible + " behindFullscreenActivity=" + mBehindFullscreenActivity); diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityStackTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityStackTests.java index 4f7f513c4f02..538853910659 100644 --- a/services/tests/wmtests/src/com/android/server/wm/ActivityStackTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/ActivityStackTests.java @@ -574,6 +574,27 @@ public class ActivityStackTests extends ActivityTestsBase { } @Test + public void testShouldBeVisible_FullscreenBehindTranslucentInHomeStack() { + final ActivityStack homeStack = createStackForShouldBeVisibleTest(mDefaultDisplay, + WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_HOME, true /* onTop */); + + final ActivityRecord firstActivity = new ActivityBuilder(mService) + .setStack(homeStack) + .setCreateTask(true) + .build(); + final Task task = firstActivity.getTask(); + final ActivityRecord secondActivity = new ActivityBuilder(mService) + .setTask(task) + .build(); + + doReturn(false).when(secondActivity).occludesParent(); + homeStack.ensureActivitiesVisible(null /* starting */, 0 /* configChanges */, + false /* preserveWindows */); + + assertTrue(firstActivity.shouldBeVisible()); + } + + @Test public void testMoveHomeStackBehindBottomMostVisibleStack_NoMoveHomeBehindFullscreen() { mDefaultDisplay.removeStack(mStack); |