From 32066032715f5d162bfc66dcd40d8978f20d8825 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Fri, 4 Nov 2016 11:55:21 -0700 Subject: [PATCH] Ensure that focusable stack is focused when starting a new activity. - When starting a new activity, if the old top activity was not focusable the focused stack was not updated, leaving the activity in a non-resumed state. Now, ensure that we focus the stack if starting an activity allows the stack to be focused. Test: Enable tap-through in the SystemUI tuner, tap on the activity and ensure the menu shows. Bug: 32636739 Change-Id: I8dd964baacd1e7352880ddd2b2324b947cbec556 --- .../core/java/com/android/server/am/ActivityStarter.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/services/core/java/com/android/server/am/ActivityStarter.java b/services/core/java/com/android/server/am/ActivityStarter.java index e4ec169945079..670271c320d7f 100644 --- a/services/core/java/com/android/server/am/ActivityStarter.java +++ b/services/core/java/com/android/server/am/ActivityStarter.java @@ -1199,6 +1199,14 @@ class ActivityStarter { // since the app transition will not be triggered through the resume channel. mWindowManager.executeAppTransition(); } else { + // If the target stack was not previously focusable (previous top running activity + // on that stack was not visible) then any prior calls to move the stack to the + // will not update the focused stack. If starting the new activity now allows the + // task stack to be focusable, then ensure that we now update the focused stack + // accordingly. + if (mTargetStack.isFocusable() && !mSupervisor.isFocusedStack(mTargetStack)) { + mTargetStack.moveToFront("startActivityUnchecked"); + } mSupervisor.resumeFocusedStackTopActivityLocked(mTargetStack, mStartActivity, mOptions); }