diff options
7 files changed, 35 insertions, 75 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index cde5273b38dd..6c17bf193e5b 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -4121,8 +4121,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A final boolean containsShowWhenLocked = containsShowWhenLockedWindow(); if (containsDismissKeyguard != mLastContainsDismissKeyguardWindow || containsShowWhenLocked != mLastContainsShowWhenLockedWindow) { - mWmService.notifyKeyguardFlagsChanged(null /* callback */, - getDisplayContent().getDisplayId()); + mDisplayContent.notifyKeyguardFlagsChanged(); } mLastContainsDismissKeyguardWindow = containsDismissKeyguard; mLastContainsShowWhenLockedWindow = containsShowWhenLocked; diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java b/services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java index 7fa98618ecb9..a9142ef85608 100644 --- a/services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java +++ b/services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java @@ -243,21 +243,6 @@ public abstract class ActivityTaskManagerInternal { int startFlags, @Nullable Bundle options, int userId); /** - * Called when Keyguard flags might have changed. - * - * @param callback Callback to run after activity visibilities have been reevaluated. This can - * be used from window manager so that when the callback is called, it's - * guaranteed that all apps have their visibility updated accordingly. - * @param displayId The id of the display where the keyguard flags changed. - */ - public abstract void notifyKeyguardFlagsChanged(@Nullable Runnable callback, int displayId); - - /** - * Called when the trusted state of Keyguard has changed. - */ - public abstract void notifyKeyguardTrustedChanged(); - - /** * Called after virtual display Id is updated by * {@link com.android.server.vr.Vr2dDisplay} with a specific * {@param vr2dDisplayId}. diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java index 173545c30291..15ebe2846513 100644 --- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java +++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java @@ -63,7 +63,6 @@ import static android.provider.Settings.System.FONT_SCALE; import static android.text.format.DateUtils.MINUTE_IN_MILLIS; import static android.view.Display.DEFAULT_DISPLAY; import static android.view.Display.INVALID_DISPLAY; -import static android.view.WindowManager.TRANSIT_NONE; import static android.view.WindowManager.TRANSIT_WAKE; import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_CONFIGURATION; @@ -5415,42 +5414,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { false /*validateIncomingUser*/); } - @Override - public void notifyKeyguardFlagsChanged(@Nullable Runnable callback, int displayId) { - synchronized (mGlobalLock) { - - // We might change the visibilities here, so prepare an empty app transition which - // might be overridden later if we actually change visibilities. - final DisplayContent dc = mRootWindowContainer.getDisplayContent(displayId); - if (dc == null) { - return; - } - final boolean wasTransitionSet = dc.mAppTransition.isTransitionSet(); - if (!wasTransitionSet) { - dc.prepareAppTransition(TRANSIT_NONE); - } - mRootWindowContainer.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS); - - // If there was a transition set already we don't want to interfere with it as we - // might be starting it too early. - if (!wasTransitionSet) { - dc.executeAppTransition(); - } - } - if (callback != null) { - callback.run(); - } - } - - @Override - public void notifyKeyguardTrustedChanged() { - synchronized (mGlobalLock) { - if (mKeyguardController.isKeyguardShowing(DEFAULT_DISPLAY)) { - mRootWindowContainer.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS); - } - } - } - /** * Called after virtual display Id is updated by * {@link com.android.server.vr.Vr2dDisplay} with a specific diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index e80a9b9f2a8e..8ede0160cdce 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -80,6 +80,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ERROR; import static android.view.WindowManager.LayoutParams.TYPE_TOAST; import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER; import static android.view.WindowManager.TRANSIT_CHANGE; +import static android.view.WindowManager.TRANSIT_NONE; import static android.view.WindowManager.TRANSIT_OPEN; import static android.view.WindowManager.TRANSIT_TO_FRONT; import static android.window.DisplayAreaOrganizer.FEATURE_IME; @@ -5914,6 +5915,30 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } /** + * Notifies that some Keyguard flags have changed and the visibilities of the activities may + * need to be reevaluated. + */ + void notifyKeyguardFlagsChanged() { + if (!isKeyguardLocked()) { + // If keyguard is not locked, the change of flags won't affect activity visibility. + return; + } + // We might change the visibilities here, so prepare an empty app transition which might be + // overridden later if we actually change visibilities. + final boolean wasTransitionSet = mAppTransition.isTransitionSet(); + if (!wasTransitionSet) { + prepareAppTransition(TRANSIT_NONE); + } + mRootWindowContainer.ensureActivitiesVisible(null, 0, false /* preserveWindows */); + + // If there was a transition set already we don't want to interfere with it as we might be + // starting it too early. + if (!wasTransitionSet) { + executeAppTransition(); + } + } + + /** * Check if the display has {@link Display#FLAG_CAN_SHOW_WITH_INSECURE_KEYGUARD} applied. */ boolean canShowWithInsecureKeyguard() { diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java index 4768b27a4f9e..ee7ba44a7c2f 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -1710,7 +1710,8 @@ public class DisplayPolicy { if (mShowingDream != mLastShowingDream) { mLastShowingDream = mShowingDream; - mService.notifyShowingDreamChanged(); + // Notify that isShowingDreamLw (which is checked in KeyguardController) has changed. + mDisplayContent.notifyKeyguardFlagsChanged(); } mService.mPolicy.setAllowLockscreenWhenOn(getDisplayId(), mAllowLockscreenWhenOn); diff --git a/services/core/java/com/android/server/wm/UnknownAppVisibilityController.java b/services/core/java/com/android/server/wm/UnknownAppVisibilityController.java index 4007661cf1a0..5e963cc5ae8e 100644 --- a/services/core/java/com/android/server/wm/UnknownAppVisibilityController.java +++ b/services/core/java/com/android/server/wm/UnknownAppVisibilityController.java @@ -135,8 +135,8 @@ class UnknownAppVisibilityController { int state = mUnknownApps.get(activity); if (state == UNKNOWN_STATE_WAITING_RELAYOUT || activity.mStartingWindow != null) { mUnknownApps.put(activity, UNKNOWN_STATE_WAITING_VISIBILITY_UPDATE); - mService.notifyKeyguardFlagsChanged(this::notifyVisibilitiesUpdated, - activity.getDisplayContent().getDisplayId()); + mDisplayContent.notifyKeyguardFlagsChanged(); + notifyVisibilitiesUpdated(); } } diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 86775f629df0..ded0dd7eb693 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -3026,17 +3026,13 @@ public class WindowManagerService extends IWindowManager.Stub aspectRatio); } - /** - * Notifies window manager that {@link DisplayPolicy#isShowingDreamLw} has changed. - */ - public void notifyShowingDreamChanged() { - // TODO(multi-display): support show dream in multi-display. - notifyKeyguardFlagsChanged(null /* callback */, DEFAULT_DISPLAY); - } - @Override public void notifyKeyguardTrustedChanged() { - mAtmInternal.notifyKeyguardTrustedChanged(); + synchronized (mGlobalLock) { + if (mAtmService.mKeyguardController.isKeyguardShowing(DEFAULT_DISPLAY)) { + mRoot.ensureActivitiesVisible(null, 0, false /* preserveWindows */); + } + } } @Override @@ -3088,15 +3084,6 @@ public class WindowManagerService extends IWindowManager.Stub return getDefaultDisplayContentLocked().mAppTransition.isIdle(); } - /** - * Notifies activity manager that some Keyguard flags have changed and that it needs to - * reevaluate the visibilities of the activities. - * @param callback Runnable to be called when activity manager is done reevaluating visibilities - */ - void notifyKeyguardFlagsChanged(@Nullable Runnable callback, int displayId) { - mAtmInternal.notifyKeyguardFlagsChanged(callback, displayId); - } - // ------------------------------------------------------------- // Misc IWindowSession methods |