Merge "Close assistant activities on closeSystemDialogs" into rvc-dev am: 9e639bb382

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11837612

Change-Id: I939f50a91c721cb83357d0a396440c0bda7d1573
This commit is contained in:
Galia Peycheva
2020-06-22 10:13:19 +00:00
committed by Automerger Merge Worker
4 changed files with 23 additions and 12 deletions

View File

@@ -6826,7 +6826,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
} }
mWindowManager.closeSystemDialogs(reason); mWindowManager.closeSystemDialogs(reason);
mRootWindowContainer.closeSystemDialogs(); mRootWindowContainer.closeSystemDialogActivities(reason);
} }
// Call into AM outside the synchronized block. // Call into AM outside the synchronized block.
mAmInternal.broadcastCloseSystemDialogs(reason); mAmInternal.broadcastCloseSystemDialogs(reason);

View File

@@ -40,6 +40,7 @@ import static android.view.WindowManager.TRANSIT_CRASHING_ACTIVITY_CLOSE;
import static android.view.WindowManager.TRANSIT_NONE; import static android.view.WindowManager.TRANSIT_NONE;
import static android.view.WindowManager.TRANSIT_SHOW_SINGLE_TASK_DISPLAY; import static android.view.WindowManager.TRANSIT_SHOW_SINGLE_TASK_DISPLAY;
import static com.android.server.policy.PhoneWindowManager.SYSTEM_DIALOG_REASON_ASSIST;
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT; import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT;
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER; import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
import static com.android.server.wm.ActivityStack.ActivityState.FINISHING; import static com.android.server.wm.ActivityStack.ActivityState.FINISHING;
@@ -3121,14 +3122,25 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
return hasVisibleActivities; return hasVisibleActivities;
} }
void closeSystemDialogs() { void closeSystemDialogActivities(String reason) {
forAllActivities((r) -> { forAllActivities((r) -> {
if ((r.info.flags & ActivityInfo.FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS) != 0) { if ((r.info.flags & ActivityInfo.FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS) != 0
r.finishIfPossible("close-sys", true /* oomAdj */); || shouldCloseAssistant(r, reason)) {
r.finishIfPossible(reason, true /* oomAdj */);
} }
}); });
} }
private boolean shouldCloseAssistant(ActivityRecord r, String reason) {
if (!r.isActivityTypeAssistant()) return false;
if (reason == SYSTEM_DIALOG_REASON_ASSIST) return false;
// When the assistant is configured to be on top of the dream, it will have higher z-order
// than other activities. If it is also opaque, it will prevent other activities from
// starting. We want to close the assistant on closeSystemDialogs to allow other activities
// to start, e.g. on home button press.
return mWmService.mAssistantOnTopOfDream;
}
FinishDisabledPackageActivitiesHelper mFinishDisabledPackageActivitiesHelper = FinishDisabledPackageActivitiesHelper mFinishDisabledPackageActivitiesHelper =
new FinishDisabledPackageActivitiesHelper(); new FinishDisabledPackageActivitiesHelper();
class FinishDisabledPackageActivitiesHelper { class FinishDisabledPackageActivitiesHelper {

View File

@@ -126,10 +126,6 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> {
private final RootWindowContainer.FindTaskResult private final RootWindowContainer.FindTaskResult
mTmpFindTaskResult = new RootWindowContainer.FindTaskResult(); mTmpFindTaskResult = new RootWindowContainer.FindTaskResult();
// Indicates whether the Assistant should show on top of the Dream (respectively, above
// everything else on screen). Otherwise, it will be put under always-on-top stacks.
private final boolean mAssistantOnTopOfDream;
/** /**
* If this is the same as {@link #getFocusedStack} then the activity on the top of the focused * If this is the same as {@link #getFocusedStack} then the activity on the top of the focused
* stack has been resumed. If stacks are changing position this will hold the old stack until * stack has been resumed. If stacks are changing position this will hold the old stack until
@@ -155,9 +151,6 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> {
mDisplayContent = displayContent; mDisplayContent = displayContent;
mRootWindowContainer = service.mRoot; mRootWindowContainer = service.mRoot;
mAtmService = service.mAtmService; mAtmService = service.mAtmService;
mAssistantOnTopOfDream = mWmService.mContext.getResources().getBoolean(
com.android.internal.R.bool.config_assistantOnTopOfDream);
} }
/** /**
@@ -392,7 +385,7 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> {
* @return the priority of the stack * @return the priority of the stack
*/ */
private int getPriority(ActivityStack stack) { private int getPriority(ActivityStack stack) {
if (mAssistantOnTopOfDream && stack.isActivityTypeAssistant()) return 4; if (mWmService.mAssistantOnTopOfDream && stack.isActivityTypeAssistant()) return 4;
if (stack.isActivityTypeDream()) return 3; if (stack.isActivityTypeDream()) return 3;
if (stack.inPinnedWindowingMode()) return 2; if (stack.inPinnedWindowingMode()) return 2;
if (stack.isAlwaysOnTop()) return 1; if (stack.isAlwaysOnTop()) return 1;

View File

@@ -528,6 +528,10 @@ public class WindowManagerService extends IWindowManager.Stub
final boolean mAllowBootMessages; final boolean mAllowBootMessages;
// Indicates whether the Assistant should show on top of the Dream (respectively, above
// everything else on screen). Otherwise, it will be put under always-on-top stacks.
final boolean mAssistantOnTopOfDream;
final boolean mLimitedAlphaCompositing; final boolean mLimitedAlphaCompositing;
final int mMaxUiWidth; final int mMaxUiWidth;
@@ -1181,6 +1185,8 @@ public class WindowManagerService extends IWindowManager.Stub
com.android.internal.R.bool.config_disableTransitionAnimation); com.android.internal.R.bool.config_disableTransitionAnimation);
mPerDisplayFocusEnabled = context.getResources().getBoolean( mPerDisplayFocusEnabled = context.getResources().getBoolean(
com.android.internal.R.bool.config_perDisplayFocusEnabled); com.android.internal.R.bool.config_perDisplayFocusEnabled);
mAssistantOnTopOfDream = context.getResources().getBoolean(
com.android.internal.R.bool.config_assistantOnTopOfDream);
mInputManager = inputManager; // Must be before createDisplayContentLocked. mInputManager = inputManager; // Must be before createDisplayContentLocked.
mDisplayManagerInternal = LocalServices.getService(DisplayManagerInternal.class); mDisplayManagerInternal = LocalServices.getService(DisplayManagerInternal.class);