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

Commit 24b0bf62 authored by Jeff Chang's avatar Jeff Chang
Browse files

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
parent b41bab2a
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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);
+21 −0
Original line number Diff line number Diff line
@@ -573,6 +573,27 @@ public class ActivityStackTests extends ActivityTestsBase {
        assertFalse(translucentStack.shouldBeVisible(null /* starting */));
    }

    @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);