DO NOT MERGE Let external activities run when the primary display is off
- Make activity sleep state independent of power manager wakefulness
state. The state is now entirely dependent on sleep tokens (and the
voice interactor).
- Make sleep tokens operate on a per-display basis (and convert the
keyguard to a sleep token).
- Make ActivityStackSupervisor acquire/release sleep tokens for
non-default displays when the displays are turned on/off.
- Make WindowManagerService.okToDisplay operate on a per-display basis.
Bug: 34280365
Test: android.server.cts.ActivityManagerDisplayTests
Test: #testExternalDisplayActivityTurnPrimaryOff
Test: #testLaunchExternalDisplayActivityWhilePrimaryOff
Test: #testExternalDisplayToggleState
Change-Id: I92086d7006a67b4b4f320c9bb3aa606954f85012
(cherry picked from commit 9440dc87a60dbe8b1065a3f21d85b48555859b1f)
diff --git a/services/core/java/com/android/server/wm/AppWindowContainerController.java b/services/core/java/com/android/server/wm/AppWindowContainerController.java
index e9696d2..1ca98ac 100644
--- a/services/core/java/com/android/server/wm/AppWindowContainerController.java
+++ b/services/core/java/com/android/server/wm/AppWindowContainerController.java
@@ -17,6 +17,7 @@
package com.android.server.wm;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
+import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
import static com.android.server.wm.AppTransition.TRANSIT_DOCK_TASK_FROM_RECENTS;
@@ -401,7 +402,7 @@
// If we are preparing an app transition, then delay changing
// the visibility of this token until we execute that transition.
- if (mService.okToAnimate() && mService.mAppTransition.isTransitionSet()) {
+ if (wtoken.okToAnimate() && mService.mAppTransition.isTransitionSet()) {
// A dummy animation is a placeholder animation which informs others that an
// animation is going on (in this case an application transition). If the animation
// was transferred from another application/animator, no dummy animator should be
@@ -478,7 +479,7 @@
// If the display is frozen, we won't do anything until the actual window is
// displayed so there is no reason to put in the starting window.
- if (!mService.okToDisplay()) {
+ if (!mContainer.okToDisplay()) {
return false;
}
@@ -699,16 +700,17 @@
public void startFreezingScreen(int configChanges) {
synchronized(mWindowMap) {
- if (configChanges == 0 && mService.okToDisplay()) {
- if (DEBUG_ORIENTATION) Slog.v(TAG_WM, "Skipping set freeze of " + mToken);
- return;
- }
-
if (mContainer == null) {
Slog.w(TAG_WM,
"Attempted to freeze screen with non-existing app token: " + mContainer);
return;
}
+
+ if (configChanges == 0 && mContainer.okToDisplay()) {
+ if (DEBUG_ORIENTATION) Slog.v(TAG_WM, "Skipping set freeze of " + mToken);
+ return;
+ }
+
mContainer.startFreezingScreen();
}
}