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

Commit f5ec5ef1 authored by Marzia Favaro's avatar Marzia Favaro
Browse files

Add transition on keyguard showing

This transition helps with ensuring the correct wallpapers when
keyguard is showing.
We are experiencing issues with the wallpapers changing visibility
during a transition, thus having an incorrect finish state: a wallpaper
can not become immediately invisible while in a transition (because it
is expected to commit invisibility only at the end), which
implies that if the wallpaper is collected while becoming visible, the
requests to become invisible during the transition period get ignored (because at the end of the transition we are expected to not make it invisible, since it just became visible at the start).
This implies that locking keyguard while there is an ongoing transition
leads to the wrong wallpaper showing on lockscreen, because we can not
hide the home wp simply by requesting to adjustWallpapers. Therefore, we
create a new transition to avoid handling unexpected visibility changes
on ungoing transitions.

Bug: 327970608
Bug: 323226308

Test: manual - delay execution of
KeyguardViewMediator#updateActivityLockscreenState, wait for keyguard to
unlock and observe lockscreen
Test: manual - unlock keyguard, open app, lock keyguard, unlock
keyguard, close app, lock keyguard, observe lockscreen - all in rapid
succession

Change-Id: I80313281219fd6b42fe3dffffde2ef90086b0e59
parent 3f3ff6bd
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -124,3 +124,14 @@ flag {
  bug: "151861875"
  is_fixed_read_only: true
}

flag {
  name: "keyguard_appear_transition"
  namespace: "windowing_frontend"
  description: "Add transition when keyguard appears"
  bug: "327970608"
  is_fixed_read_only: true
  metadata {
      purpose: PURPOSE_BUGFIX
  }
}
 No newline at end of file
+82 B (52.9 KiB)

File changed.

No diff preview for this file type.

+6 −12
Original line number Diff line number Diff line
@@ -709,18 +709,6 @@
      "group": "WM_DEBUG_CONFIGURATION",
      "at": "com\/android\/server\/wm\/ActivityTaskManagerService.java"
    },
    "2959074735946674755": {
      "message": "Trying to update display configuration for system\/invalid process.",
      "level": "WARN",
      "group": "WM_DEBUG_CONFIGURATION",
      "at": "com\/android\/server\/wm\/ActivityTaskManagerService.java"
    },
    "5668810920995272206": {
      "message": "Trying to update display configuration for invalid process, pid=%d",
      "level": "WARN",
      "group": "WM_DEBUG_CONFIGURATION",
      "at": "com\/android\/server\/wm\/ActivityTaskManagerService.java"
    },
    "-1123414663662718691": {
      "message": "setVr2dDisplayId called for: %d",
      "level": "DEBUG",
@@ -3469,6 +3457,12 @@
      "group": "WM_DEBUG_WALLPAPER",
      "at": "com\/android\/server\/wm\/WallpaperController.java"
    },
    "257349083882992098": {
      "message": "updateWallpaperTokens requestedVisibility=%b on keyguardLocked=%b",
      "level": "VERBOSE",
      "group": "WM_DEBUG_WALLPAPER",
      "at": "com\/android\/server\/wm\/WallpaperController.java"
    },
    "7408402065665963407": {
      "message": "Wallpaper at display %d - visibility: %b, keyguardLocked: %b",
      "level": "VERBOSE",
+8 −4
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ import android.view.WindowManager;
import com.android.internal.policy.IKeyguardDismissCallback;
import com.android.server.inputmethod.InputMethodManagerInternal;
import com.android.server.policy.WindowManagerPolicy;
import com.android.window.flags.Flags;

import java.io.PrintWriter;

@@ -225,13 +226,16 @@ class KeyguardController {
            if (keyguardShowing) {
                state.mDismissalRequested = false;
            }
            if (goingAwayRemoved) {
                // Keyguard dismiss is canceled. Send a transition to undo the changes and clean up
                // before holding the sleep token again.
            if (goingAwayRemoved || (keyguardShowing && Flags.keyguardAppearTransition())) {
                // Keyguard decided to show or stopped going away. Send a transition to animate back
                // to the locked state before holding the sleep token again
                final DisplayContent dc = mRootWindowContainer.getDefaultDisplay();
                dc.requestTransitionAndLegacyPrepare(
                        TRANSIT_TO_FRONT, TRANSIT_FLAG_KEYGUARD_APPEARING);
                mWindowManager.executeAppTransition();
                if (Flags.keyguardAppearTransition()) {
                    dc.mWallpaperController.adjustWallpaperWindows();
                }
                dc.executeAppTransition();
            }
        }

+2 −5
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import static android.app.WallpaperManager.COMMAND_UNFREEZE;
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER;

import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_WALLPAPER;
@@ -858,10 +857,6 @@ class WallpaperController {
    }

    public void updateWallpaperTokens(boolean keyguardLocked) {
        if (DEBUG_WALLPAPER) {
            Slog.v(TAG, "Wallpaper vis: target " + mWallpaperTarget + " prev="
                    + mPrevWallpaperTarget);
        }
        updateWallpaperTokens(mWallpaperTarget != null || mPrevWallpaperTarget != null,
                keyguardLocked);
    }
@@ -870,6 +865,8 @@ class WallpaperController {
     * Change the visibility of the top wallpaper to {@param visibility} and hide all the others.
     */
    private void updateWallpaperTokens(boolean visibility, boolean keyguardLocked) {
        ProtoLog.v(WM_DEBUG_WALLPAPER, "updateWallpaperTokens requestedVisibility=%b on"
                + " keyguardLocked=%b", visibility, keyguardLocked);
        WindowState topWallpaper = mFindResults.getTopWallpaper(keyguardLocked);
        WallpaperWindowToken topWallpaperToken =
                topWallpaper == null ? null : topWallpaper.mToken.asWallpaperToken();