Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e4fc8aa7 authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Narrow down the condition of wallpaper target for occluded keyguard" into main

parents bb15ca0c 275e2758
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -492,6 +492,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;
+1 −1
Original line number Diff line number Diff line
@@ -165,7 +165,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);
+12 −0
Original line number Diff line number Diff line
@@ -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);