Loading packages/SystemUI/src/com/android/systemui/ImageWallpaper.java +2 −2 Original line number Diff line number Diff line Loading @@ -120,7 +120,7 @@ public class ImageWallpaper extends WallpaperService { private void init(DozeParameters dozeParameters) { mIsHighEndGfx = ActivityManager.isHighEndGfx(); mDisplayNeedsBlanking = dozeParameters.getDisplayNeedsBlanking(); mNeedTransition = mIsHighEndGfx && !mDisplayNeedsBlanking; mNeedTransition = false; // We will preserve EGL context when we are in lock screen or aod // to avoid janking in following transition, we need to release when back to home. Loading @@ -137,7 +137,7 @@ public class ImageWallpaper extends WallpaperService { mRenderer = getRendererInstance(); getDisplayContext().getDisplay().getDisplayInfo(mDisplayInfo); setFixedSizeAllowed(true); setOffsetNotificationsEnabled(true); setOffsetNotificationsEnabled(mNeedTransition); updateSurfaceSize(); } Loading packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt +28 −2 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import com.android.systemui.statusbar.phone.BiometricUnlockController import com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK import com.android.systemui.statusbar.phone.NotificationShadeWindowController import com.android.systemui.statusbar.phone.PanelExpansionListener import com.android.systemui.statusbar.phone.ScrimController import com.android.systemui.statusbar.policy.KeyguardStateController import java.io.FileDescriptor import java.io.PrintWriter Loading Loading @@ -106,6 +107,16 @@ class NotificationShadeDepthController @Inject constructor( shadeSpring.finishIfRunning() } /** * Force stop blur effect when necessary. */ private var scrimsVisible: Boolean = false set(value) { if (field == value) return field = value scheduleUpdate() } /** * Blur radius of the wake-up animation on this frame. */ Loading Loading @@ -142,7 +153,13 @@ class NotificationShadeDepthController @Inject constructor( if (showingHomeControls) { globalActionsRadius = 0 } val blur = max(shadeRadius.toInt(), globalActionsRadius) var blur = max(shadeRadius.toInt(), globalActionsRadius) // Make blur be 0 if it is necessary to stop blur effect. if (scrimsVisible) { blur = 0 } blurUtils.applyBlur(blurRoot?.viewRootImpl ?: root.viewRootImpl, blur) try { wallpaperManager.setWallpaperZoomOut(root.windowToken, Loading Loading @@ -202,6 +219,10 @@ class NotificationShadeDepthController @Inject constructor( brightnessMirrorSpring.finishIfRunning() } } override fun onDozeAmountChanged(linear: Float, eased: Float) { wakeAndUnlockBlurRadius = blurUtils.blurRadiusOfRatio(eased) } } init { Loading @@ -210,6 +231,10 @@ class NotificationShadeDepthController @Inject constructor( keyguardStateController.addCallback(keyguardStateCallback) } statusBarStateController.addCallback(statusBarStateCallback) notificationShadeWindowController.setScrimsVisibilityListener { // Stop blur effect when scrims is opaque to avoid unnecessary GPU composition. visibility -> scrimsVisible = visibility == ScrimController.OPAQUE } } /** Loading @@ -225,7 +250,8 @@ class NotificationShadeDepthController @Inject constructor( private fun updateShadeBlur() { var newBlur = 0 if (statusBarStateController.state == StatusBarState.SHADE) { val state = statusBarStateController.state if (state == StatusBarState.SHADE || state == StatusBarState.SHADE_LOCKED) { val animatedBlur = Interpolators.SHADE_ANIMATION.getInterpolation( MathUtils.constrain(shadeExpansion / 0.15f, 0f, 1f)) Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowController.java +13 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ import java.lang.ref.WeakReference; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; import java.util.function.Consumer; import javax.inject.Inject; import javax.inject.Singleton; Loading Loading @@ -92,6 +93,7 @@ public class NotificationShadeWindowController implements Callback, Dumpable, private final State mCurrentState = new State(); private OtherwisedCollapsedListener mListener; private ForcePluginOpenListener mForcePluginOpenListener; private Consumer<Integer> mScrimsVisibilityListener; private final ArrayList<WeakReference<StatusBarWindowCallback>> mCallbacks = Lists.newArrayList(); Loading Loading @@ -150,6 +152,16 @@ public class NotificationShadeWindowController implements Callback, Dumpable, mCallbacks.add(new WeakReference<StatusBarWindowCallback>(callback)); } /** * Register a listener to monitor scrims visibility * @param listener A listener to monitor scrims visibility */ public void setScrimsVisibilityListener(Consumer<Integer> listener) { if (listener != null && mScrimsVisibilityListener != listener) { mScrimsVisibilityListener = listener; } } private boolean shouldEnableKeyguardScreenRotation() { Resources res = mContext.getResources(); return SystemProperties.getBoolean("lockscreen.rot_override", false) Loading Loading @@ -477,6 +489,7 @@ public class NotificationShadeWindowController implements Callback, Dumpable, public void setScrimsVisibility(int scrimsVisibility) { mCurrentState.mScrimsVisibility = scrimsVisibility; apply(mCurrentState); mScrimsVisibilityListener.accept(scrimsVisibility); } /** Loading packages/SystemUI/tests/src/com/android/systemui/ImageWallpaperTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -160,7 +160,7 @@ public class ImageWallpaperTest extends SysuiTestCase { LOW_BMP_HEIGHT /* bmpHeight */, LOW_BMP_WIDTH /* surfaceWidth */, LOW_BMP_HEIGHT /* surfaceHeight */, true /* assertion */); false /* assertion */); } @Test Loading @@ -172,7 +172,7 @@ public class ImageWallpaperTest extends SysuiTestCase { INVALID_BMP_HEIGHT /* bmpHeight */, ImageWallpaper.GLEngine.MIN_SURFACE_WIDTH /* surfaceWidth */, ImageWallpaper.GLEngine.MIN_SURFACE_HEIGHT /* surfaceHeight */, true /* assertion */); false /* assertion */); } private void verifySurfaceSizeAndAssertTransition(int bmpWidth, int bmpHeight, Loading Loading
packages/SystemUI/src/com/android/systemui/ImageWallpaper.java +2 −2 Original line number Diff line number Diff line Loading @@ -120,7 +120,7 @@ public class ImageWallpaper extends WallpaperService { private void init(DozeParameters dozeParameters) { mIsHighEndGfx = ActivityManager.isHighEndGfx(); mDisplayNeedsBlanking = dozeParameters.getDisplayNeedsBlanking(); mNeedTransition = mIsHighEndGfx && !mDisplayNeedsBlanking; mNeedTransition = false; // We will preserve EGL context when we are in lock screen or aod // to avoid janking in following transition, we need to release when back to home. Loading @@ -137,7 +137,7 @@ public class ImageWallpaper extends WallpaperService { mRenderer = getRendererInstance(); getDisplayContext().getDisplay().getDisplayInfo(mDisplayInfo); setFixedSizeAllowed(true); setOffsetNotificationsEnabled(true); setOffsetNotificationsEnabled(mNeedTransition); updateSurfaceSize(); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt +28 −2 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import com.android.systemui.statusbar.phone.BiometricUnlockController import com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK import com.android.systemui.statusbar.phone.NotificationShadeWindowController import com.android.systemui.statusbar.phone.PanelExpansionListener import com.android.systemui.statusbar.phone.ScrimController import com.android.systemui.statusbar.policy.KeyguardStateController import java.io.FileDescriptor import java.io.PrintWriter Loading Loading @@ -106,6 +107,16 @@ class NotificationShadeDepthController @Inject constructor( shadeSpring.finishIfRunning() } /** * Force stop blur effect when necessary. */ private var scrimsVisible: Boolean = false set(value) { if (field == value) return field = value scheduleUpdate() } /** * Blur radius of the wake-up animation on this frame. */ Loading Loading @@ -142,7 +153,13 @@ class NotificationShadeDepthController @Inject constructor( if (showingHomeControls) { globalActionsRadius = 0 } val blur = max(shadeRadius.toInt(), globalActionsRadius) var blur = max(shadeRadius.toInt(), globalActionsRadius) // Make blur be 0 if it is necessary to stop blur effect. if (scrimsVisible) { blur = 0 } blurUtils.applyBlur(blurRoot?.viewRootImpl ?: root.viewRootImpl, blur) try { wallpaperManager.setWallpaperZoomOut(root.windowToken, Loading Loading @@ -202,6 +219,10 @@ class NotificationShadeDepthController @Inject constructor( brightnessMirrorSpring.finishIfRunning() } } override fun onDozeAmountChanged(linear: Float, eased: Float) { wakeAndUnlockBlurRadius = blurUtils.blurRadiusOfRatio(eased) } } init { Loading @@ -210,6 +231,10 @@ class NotificationShadeDepthController @Inject constructor( keyguardStateController.addCallback(keyguardStateCallback) } statusBarStateController.addCallback(statusBarStateCallback) notificationShadeWindowController.setScrimsVisibilityListener { // Stop blur effect when scrims is opaque to avoid unnecessary GPU composition. visibility -> scrimsVisible = visibility == ScrimController.OPAQUE } } /** Loading @@ -225,7 +250,8 @@ class NotificationShadeDepthController @Inject constructor( private fun updateShadeBlur() { var newBlur = 0 if (statusBarStateController.state == StatusBarState.SHADE) { val state = statusBarStateController.state if (state == StatusBarState.SHADE || state == StatusBarState.SHADE_LOCKED) { val animatedBlur = Interpolators.SHADE_ANIMATION.getInterpolation( MathUtils.constrain(shadeExpansion / 0.15f, 0f, 1f)) Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowController.java +13 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ import java.lang.ref.WeakReference; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; import java.util.function.Consumer; import javax.inject.Inject; import javax.inject.Singleton; Loading Loading @@ -92,6 +93,7 @@ public class NotificationShadeWindowController implements Callback, Dumpable, private final State mCurrentState = new State(); private OtherwisedCollapsedListener mListener; private ForcePluginOpenListener mForcePluginOpenListener; private Consumer<Integer> mScrimsVisibilityListener; private final ArrayList<WeakReference<StatusBarWindowCallback>> mCallbacks = Lists.newArrayList(); Loading Loading @@ -150,6 +152,16 @@ public class NotificationShadeWindowController implements Callback, Dumpable, mCallbacks.add(new WeakReference<StatusBarWindowCallback>(callback)); } /** * Register a listener to monitor scrims visibility * @param listener A listener to monitor scrims visibility */ public void setScrimsVisibilityListener(Consumer<Integer> listener) { if (listener != null && mScrimsVisibilityListener != listener) { mScrimsVisibilityListener = listener; } } private boolean shouldEnableKeyguardScreenRotation() { Resources res = mContext.getResources(); return SystemProperties.getBoolean("lockscreen.rot_override", false) Loading Loading @@ -477,6 +489,7 @@ public class NotificationShadeWindowController implements Callback, Dumpable, public void setScrimsVisibility(int scrimsVisibility) { mCurrentState.mScrimsVisibility = scrimsVisibility; apply(mCurrentState); mScrimsVisibilityListener.accept(scrimsVisibility); } /** Loading
packages/SystemUI/tests/src/com/android/systemui/ImageWallpaperTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -160,7 +160,7 @@ public class ImageWallpaperTest extends SysuiTestCase { LOW_BMP_HEIGHT /* bmpHeight */, LOW_BMP_WIDTH /* surfaceWidth */, LOW_BMP_HEIGHT /* surfaceHeight */, true /* assertion */); false /* assertion */); } @Test Loading @@ -172,7 +172,7 @@ public class ImageWallpaperTest extends SysuiTestCase { INVALID_BMP_HEIGHT /* bmpHeight */, ImageWallpaper.GLEngine.MIN_SURFACE_WIDTH /* surfaceWidth */, ImageWallpaper.GLEngine.MIN_SURFACE_HEIGHT /* surfaceHeight */, true /* assertion */); false /* assertion */); } private void verifySurfaceSizeAndAssertTransition(int bmpWidth, int bmpHeight, Loading