diff options
6 files changed, 29 insertions, 54 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java index e9c565377530..2c0b52638d2f 100644 --- a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java +++ b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java @@ -496,6 +496,9 @@ public class ScreenDecorations extends SystemUI implements Tunable { lp.privateFlags |= WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS | WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION; + // FLAG_SLIPPERY can only be set by trusted overlays + lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_TRUSTED_OVERLAY; + if (!DEBUG_SCREENSHOT_ROUNDED_CORNERS) { lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/LightRevealScrim.kt b/packages/SystemUI/src/com/android/systemui/statusbar/LightRevealScrim.kt index bbee1942cfc4..21ed9da896a5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/LightRevealScrim.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/LightRevealScrim.kt @@ -155,11 +155,6 @@ class LightRevealScrim(context: Context?, attrs: AttributeSet?) : View(context, lateinit var isScrimOpaqueChangedListener: Consumer<Boolean> /** - * A runnable to call when the scrim has been fully revealed. This is only invoked once - */ - var fullyRevealedRunnable: Runnable? = null - - /** * How much of the underlying views are revealed, in percent. 0 means they will be completely * obscured and 1 means they'll be fully visible. */ @@ -170,20 +165,10 @@ class LightRevealScrim(context: Context?, attrs: AttributeSet?) : View(context, revealEffect.setRevealAmountOnScrim(value, this) updateScrimOpaque() - maybeTriggerFullyRevealedRunnable() invalidate() } } - private fun maybeTriggerFullyRevealedRunnable() { - if (revealAmount == 1.0f) { - fullyRevealedRunnable?.let { - it.run() - fullyRevealedRunnable = null - } - } - } - /** * The [LightRevealEffect] used to manipulate the radial gradient whenever [revealAmount] * changes. diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt index 98e6879d208f..2a8771e96e7b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt @@ -37,6 +37,7 @@ import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dump.DumpManager import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.statusbar.phone.BiometricUnlockController +import com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK import com.android.systemui.statusbar.phone.DozeParameters import com.android.systemui.statusbar.phone.PanelExpansionListener import com.android.systemui.statusbar.phone.ScrimController @@ -72,10 +73,6 @@ class NotificationShadeDepthController @Inject constructor( private const val TAG = "DepthController" } - /** - * Is did we already unblur while dozing? - */ - private var alreadyUnblurredWhileDozing = false lateinit var root: View private var blurRoot: View? = null private var keyguardAnimator: Animator? = null @@ -240,11 +237,9 @@ class NotificationShadeDepthController @Inject constructor( private val keyguardStateCallback = object : KeyguardStateController.Callback { override fun onKeyguardFadingAwayChanged() { if (!keyguardStateController.isKeyguardFadingAway || - !biometricUnlockController.isWakeAndUnlock) { + biometricUnlockController.mode != MODE_WAKE_AND_UNLOCK) { return } - // When wakeAndUnlocking the screen remains dozing, so we have to manually trigger - // the unblur earlier keyguardAnimator?.cancel() keyguardAnimator = ValueAnimator.ofFloat(1f, 0f).apply { @@ -266,7 +261,6 @@ class NotificationShadeDepthController @Inject constructor( }) start() } - alreadyUnblurredWhileDozing = statusBarStateController.dozeAmount != 0.0f } override fun onKeyguardShowingChanged() { @@ -288,24 +282,10 @@ class NotificationShadeDepthController @Inject constructor( if (isDozing) { shadeAnimation.finishIfRunning() brightnessMirrorSpring.finishIfRunning() - - // unset this for safety, to be ready for the next wakeup - alreadyUnblurredWhileDozing = false } } override fun onDozeAmountChanged(linear: Float, eased: Float) { - if (alreadyUnblurredWhileDozing) { - if (linear == 0.0f) { - // We finished waking up, let's reset - alreadyUnblurredWhileDozing = false - } else { - // We've already handled the unbluring from the keyguardAnimator above. - // if we would continue, we'd play another unzoom / blur animation from the - // dozing changing. - return - } - } wakeAndUnlockBlurRadius = blurUtils.blurRadiusOfRatio(eased) scheduleUpdate() } @@ -463,7 +443,6 @@ class NotificationShadeDepthController @Inject constructor( it.println("blursDisabledForAppLaunch: $blursDisabledForAppLaunch") it.println("qsPanelExpansion: $qsPanelExpansion") it.println("transitionToFullShadeProgress: $transitionToFullShadeProgress") - it.println("alreadyUnblurredWhileDozing: $alreadyUnblurredWhileDozing") it.println("lastAppliedBlur: $lastAppliedBlur") } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index 6cf1d82149ce..88434cc214be 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -360,7 +360,6 @@ public class StatusBar extends SystemUI implements DemoMode, } private LockscreenShadeTransitionController mLockscreenShadeTransitionController; - private boolean mCallingFadingAwayAfterReveal; public interface ExpansionChangedListener { void onExpansionChanged(float expansion, boolean expanded); @@ -640,7 +639,7 @@ public class StatusBar extends SystemUI implements DemoMode, + "mStatusBarKeyguardViewManager was null"); return; } - if (mKeyguardStateController.isKeyguardFadingAway() && !mCallingFadingAwayAfterReveal) { + if (mKeyguardStateController.isKeyguardFadingAway()) { mStatusBarKeyguardViewManager.onKeyguardFadedAway(); } } @@ -3584,19 +3583,8 @@ public class StatusBar extends SystemUI implements DemoMode, public void fadeKeyguardWhilePulsing() { mNotificationPanelViewController.fadeOut(0, FADE_KEYGUARD_DURATION_PULSING, ()-> { - Runnable finishFading = () -> { - mCallingFadingAwayAfterReveal = false; - hideKeyguard(); - mStatusBarKeyguardViewManager.onKeyguardFadedAway(); - }; - if (mLightRevealScrim.getRevealAmount() != 1.0f) { - mCallingFadingAwayAfterReveal = true; - // we're still revealing the Light reveal, let's only go to keyguard once - // Going there introduces lots of jank - mLightRevealScrim.setFullyRevealedRunnable(finishFading); - } else { - finishFading.run(); - } + hideKeyguard(); + mStatusBarKeyguardViewManager.onKeyguardFadedAway(); }).start(); } diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java index d0457b08aa34..b87d6f4fdf57 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -56,6 +56,7 @@ import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR; import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN; import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS; import static android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE; +import static android.view.WindowManager.LayoutParams.FLAG_SLIPPERY; import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT; import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; @@ -848,6 +849,20 @@ public class DisplayPolicy { } /** + * Only trusted overlays are allowed to use FLAG_SLIPPERY. + */ + static int sanitizeFlagSlippery(int flags, int privateFlags, String name) { + if ((flags & FLAG_SLIPPERY) == 0) { + return flags; + } + if ((privateFlags & PRIVATE_FLAG_TRUSTED_OVERLAY) != 0) { + return flags; + } + Slog.w(TAG, "Removing FLAG_SLIPPERY for non-trusted overlay " + name); + return flags & ~FLAG_SLIPPERY; + } + + /** * Sanitize the layout parameters coming from a client. Allows the policy * to do things like ensure that windows of a specific type can't take * input focus. @@ -927,6 +942,8 @@ public class DisplayPolicy { if (mExtraNavBarAlt == win) { mExtraNavBarAltPosition = getAltBarPosition(attrs); } + + attrs.flags = sanitizeFlagSlippery(attrs.flags, attrs.privateFlags, win.getName()); } /** diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index e3ff9e75dbd8..dd515db6337a 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -56,6 +56,7 @@ import static android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; import static android.view.WindowManager.LayoutParams.FLAG_SECURE; import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER; import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED; +import static android.view.WindowManager.LayoutParams.FLAG_SLIPPERY; import static android.view.WindowManager.LayoutParams.INPUT_FEATURE_NO_INPUT_CHANNEL; import static android.view.WindowManager.LayoutParams.INVALID_WINDOW_TYPE; import static android.view.WindowManager.LayoutParams.LAST_APPLICATION_WINDOW; @@ -8223,8 +8224,10 @@ public class WindowManagerService extends IWindowManager.Stub h.token = channelToken; h.name = name; + flags = DisplayPolicy.sanitizeFlagSlippery(flags, privateFlags, name); + final int sanitizedFlags = flags & (LayoutParams.FLAG_NOT_TOUCHABLE - | LayoutParams.FLAG_SLIPPERY | LayoutParams.FLAG_NOT_FOCUSABLE); + | FLAG_SLIPPERY | LayoutParams.FLAG_NOT_FOCUSABLE); h.layoutParamsFlags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | sanitizedFlags; h.layoutParamsType = type; h.dispatchingTimeoutMillis = DEFAULT_DISPATCHING_TIMEOUT_MILLIS; |