OSDN Git Service

Bring home to front behind assistant stack when needed.
authorBryce Lee <brycelee@google.com>
Mon, 7 Aug 2017 23:10:43 +0000 (16:10 -0700)
committerBryce Lee <brycelee@google.com>
Tue, 8 Aug 2017 00:56:05 +0000 (17:56 -0700)
It is possible to return to an assistant stack over stack other
than the home stack despite starting over it. This can happen when
the assistant activity launches an activity in another stack, such as
the fullscreen stack. We were previously assuming that the stack
underneath would stay static and therefore did not account for the
another stack coming on top.

This CL addresses the issue by recognizing when home was below the
assistant stack and ensures that it is brought forward before
bringing the assistant stack forward

Change-Id: Ia279785f57bd62d0083274b20deea252b43a341f
Fixes: 64231497
Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test CtsServicesHostTestCases android.server.cts.ActivityManagerAssistantStackTests#testTranslucentAssistantActivityStackVisibility
Test: go/wm-smoke

services/core/java/com/android/server/am/ActivityStack.java

index d75e6a9..3620ddb 100644 (file)
@@ -3424,6 +3424,15 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
             return mStackSupervisor.moveHomeStackTaskToTop(reason);
         }
 
+        if (stack.isAssistantStack() && top != null
+                && top.getTask().getTaskToReturnTo() == HOME_ACTIVITY_TYPE) {
+            // It is possible for the home stack to not be directly underneath the assistant stack.
+            // For example, the assistant may start an activity in the fullscreen stack. Upon
+            // returning to the assistant stack, we must ensure that the home stack is underneath
+            // when appropriate.
+            mStackSupervisor.moveHomeStackTaskToTop("adjustAssistantReturnToHome");
+        }
+
         stack.moveToFront(myReason);
         return true;
     }