From 385d15555c414a1d497e1ab2791d7c92e26d6a50 Mon Sep 17 00:00:00 2001 From: Michel Comin Escude Date: Wed, 1 Apr 2020 11:57:08 -0700 Subject: [PATCH] Added blur added in the restart dialog Wait until the Dialog is shown to blur it Bug: 152353066 Test: Visual Change-Id: I8e4b8d7004714a2d1f29b5f59efa7432d17cbbaa --- .../globalactions/GlobalActionsImpl.java | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java index ce29859f12caa..15cf1a060f4c3 100644 --- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java +++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java @@ -98,8 +98,21 @@ public class GlobalActionsImpl implements GlobalActions, CommandQueue.Callbacks public void showShutdownUi(boolean isReboot, String reason) { ScrimDrawable background = new ScrimDrawable(); - Dialog d = new Dialog(mContext, + final Dialog d = new Dialog(mContext, com.android.systemui.R.style.Theme_SystemUI_Dialog_GlobalActions); + + d.setOnShowListener(dialog -> { + if (mBlurUtils.supportsBlursOnWindows()) { + background.setAlpha((int) (ScrimController.BLUR_SCRIM_ALPHA * 255)); + mBlurUtils.applyBlur(d.getWindow().getDecorView().getViewRootImpl(), + mBlurUtils.blurRadiusOfRatio(1)); + } else { + float backgroundAlpha = mContext.getResources().getFloat( + com.android.systemui.R.dimen.shutdown_scrim_behind_alpha); + background.setAlpha((int) (backgroundAlpha * 255)); + } + }); + // Window initialization Window window = d.getWindow(); window.requestFeature(Window.FEATURE_NO_TITLE); @@ -146,16 +159,6 @@ public class GlobalActionsImpl implements GlobalActions, CommandQueue.Callbacks reasonView.setText(rebootReasonMessage); } - if (mBlurUtils.supportsBlursOnWindows()) { - background.setAlpha((int) (ScrimController.BLUR_SCRIM_ALPHA * 255)); - mBlurUtils.applyBlur(d.getWindow().getDecorView().getViewRootImpl(), - mBlurUtils.blurRadiusOfRatio(1)); - } else { - float backgroundAlpha = mContext.getResources().getFloat( - com.android.systemui.R.dimen.shutdown_scrim_behind_alpha); - background.setAlpha((int) (backgroundAlpha * 255)); - } - d.show(); }