Loading services/core/java/com/android/server/wm/TransitionController.java +21 −0 Original line number Diff line number Diff line Loading @@ -493,6 +493,27 @@ class TransitionController { return false; } /** Returns {@code true} if the display contains a transient-launch transition. */ boolean hasTransientLaunch(@NonNull DisplayContent dc) { if (mCollectingTransition != null && mCollectingTransition.hasTransientLaunch() && mCollectingTransition.isOnDisplay(dc)) { return true; } for (int i = mWaitingTransitions.size() - 1; i >= 0; --i) { final Transition transition = mWaitingTransitions.get(i); if (transition.hasTransientLaunch() && transition.isOnDisplay(dc)) { return true; } } for (int i = mPlayingTransitions.size() - 1; i >= 0; --i) { final Transition transition = mPlayingTransitions.get(i); if (transition.hasTransientLaunch() && transition.isOnDisplay(dc)) { return true; } } return false; } boolean isTransientHide(@NonNull Task task) { if (mCollectingTransition != null && mCollectingTransition.isInTransientHide(task)) { return true; Loading services/core/java/com/android/server/wm/WallpaperController.java +1 −1 Original line number Diff line number Diff line Loading @@ -166,7 +166,7 @@ class WallpaperController { || (w.mActivityRecord != null && !w.mActivityRecord.fillsParent()); } } else if (w.hasWallpaper() && mService.mPolicy.isKeyguardHostWindow(w.mAttrs) && w.mTransitionController.isTransitionOnDisplay(mDisplayContent)) { && w.mTransitionController.hasTransientLaunch(mDisplayContent)) { // If we have no candidates at all, notification shade is allowed to be the target // of last resort even if it has not been made visible yet. if (DEBUG_WALLPAPER) Slog.v(TAG, "Found keyguard as wallpaper target: " + w); Loading services/tests/wmtests/src/com/android/server/wm/WallpaperControllerTests.java +12 −0 Original line number Diff line number Diff line Loading @@ -314,6 +314,18 @@ public class WallpaperControllerTests extends WindowTestsBase { // Wallpaper is invisible because the lowest show-when-locked activity is opaque. assertNull(wallpaperController.getWallpaperTarget()); // Only transient-launch transition will make notification shade as last resort target. // This verifies that regular transition won't choose invisible keyguard as the target. final WindowState keyguard = createWindow(null /* parent */, WindowManager.LayoutParams.TYPE_NOTIFICATION_SHADE, "keyguard"); keyguard.mAttrs.flags |= FLAG_SHOW_WALLPAPER; registerTestTransitionPlayer(); final Transition transition = wallpaperWindow.mTransitionController.createTransition( WindowManager.TRANSIT_CHANGE); transition.collect(keyguard); wallpaperController.adjustWallpaperWindows(); assertNull(wallpaperController.getWallpaperTarget()); // A show-when-locked wallpaper is used for lockscreen. So the top wallpaper should // be the one that is not show-when-locked. final WindowState wallpaperWindow2 = createWallpaperWindow(mDisplayContent); Loading Loading
services/core/java/com/android/server/wm/TransitionController.java +21 −0 Original line number Diff line number Diff line Loading @@ -493,6 +493,27 @@ class TransitionController { return false; } /** Returns {@code true} if the display contains a transient-launch transition. */ boolean hasTransientLaunch(@NonNull DisplayContent dc) { if (mCollectingTransition != null && mCollectingTransition.hasTransientLaunch() && mCollectingTransition.isOnDisplay(dc)) { return true; } for (int i = mWaitingTransitions.size() - 1; i >= 0; --i) { final Transition transition = mWaitingTransitions.get(i); if (transition.hasTransientLaunch() && transition.isOnDisplay(dc)) { return true; } } for (int i = mPlayingTransitions.size() - 1; i >= 0; --i) { final Transition transition = mPlayingTransitions.get(i); if (transition.hasTransientLaunch() && transition.isOnDisplay(dc)) { return true; } } return false; } boolean isTransientHide(@NonNull Task task) { if (mCollectingTransition != null && mCollectingTransition.isInTransientHide(task)) { return true; Loading
services/core/java/com/android/server/wm/WallpaperController.java +1 −1 Original line number Diff line number Diff line Loading @@ -166,7 +166,7 @@ class WallpaperController { || (w.mActivityRecord != null && !w.mActivityRecord.fillsParent()); } } else if (w.hasWallpaper() && mService.mPolicy.isKeyguardHostWindow(w.mAttrs) && w.mTransitionController.isTransitionOnDisplay(mDisplayContent)) { && w.mTransitionController.hasTransientLaunch(mDisplayContent)) { // If we have no candidates at all, notification shade is allowed to be the target // of last resort even if it has not been made visible yet. if (DEBUG_WALLPAPER) Slog.v(TAG, "Found keyguard as wallpaper target: " + w); Loading
services/tests/wmtests/src/com/android/server/wm/WallpaperControllerTests.java +12 −0 Original line number Diff line number Diff line Loading @@ -314,6 +314,18 @@ public class WallpaperControllerTests extends WindowTestsBase { // Wallpaper is invisible because the lowest show-when-locked activity is opaque. assertNull(wallpaperController.getWallpaperTarget()); // Only transient-launch transition will make notification shade as last resort target. // This verifies that regular transition won't choose invisible keyguard as the target. final WindowState keyguard = createWindow(null /* parent */, WindowManager.LayoutParams.TYPE_NOTIFICATION_SHADE, "keyguard"); keyguard.mAttrs.flags |= FLAG_SHOW_WALLPAPER; registerTestTransitionPlayer(); final Transition transition = wallpaperWindow.mTransitionController.createTransition( WindowManager.TRANSIT_CHANGE); transition.collect(keyguard); wallpaperController.adjustWallpaperWindows(); assertNull(wallpaperController.getWallpaperTarget()); // A show-when-locked wallpaper is used for lockscreen. So the top wallpaper should // be the one that is not show-when-locked. final WindowState wallpaperWindow2 = createWallpaperWindow(mDisplayContent); Loading