Loading packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt +5 −1 Original line number Original line Diff line number Diff line Loading @@ -189,7 +189,11 @@ class NotificationShadeDepthController @Inject constructor( blurUtils.applyBlur(blurRoot?.viewRootImpl ?: root.viewRootImpl, blur) blurUtils.applyBlur(blurRoot?.viewRootImpl ?: root.viewRootImpl, blur) val zoomOut = blurUtils.ratioOfBlurRadius(blur) val zoomOut = blurUtils.ratioOfBlurRadius(blur) try { try { if (root.isAttachedToWindow) { wallpaperManager.setWallpaperZoomOut(root.windowToken, zoomOut) wallpaperManager.setWallpaperZoomOut(root.windowToken, zoomOut) } else { Log.i(TAG, "Won't set zoom. Window not attached $root") } } catch (e: IllegalArgumentException) { } catch (e: IllegalArgumentException) { Log.w(TAG, "Can't set zoom. Window is gone: ${root.windowToken}", e) Log.w(TAG, "Can't set zoom. Window is gone: ${root.windowToken}", e) } } Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationShadeDepthControllerTest.kt +9 −0 Original line number Original line Diff line number Diff line Loading @@ -45,6 +45,7 @@ import org.mockito.Mockito.anyString import org.mockito.Mockito.clearInvocations import org.mockito.Mockito.clearInvocations import org.mockito.Mockito.doThrow import org.mockito.Mockito.doThrow import org.mockito.Mockito.never import org.mockito.Mockito.never import org.mockito.Mockito.times import org.mockito.Mockito.verify import org.mockito.Mockito.verify import org.mockito.junit.MockitoJUnit import org.mockito.junit.MockitoJUnit Loading Loading @@ -79,6 +80,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() { @Before @Before fun setup() { fun setup() { `when`(root.viewRootImpl).thenReturn(viewRootImpl) `when`(root.viewRootImpl).thenReturn(viewRootImpl) `when`(root.isAttachedToWindow).thenReturn(true) `when`(statusBarStateController.state).then { statusBarState } `when`(statusBarStateController.state).then { statusBarState } `when`(blurUtils.blurRadiusOfRatio(anyFloat())).then { answer -> `when`(blurUtils.blurRadiusOfRatio(anyFloat())).then { answer -> (answer.arguments[0] as Float * maxBlur).toInt() (answer.arguments[0] as Float * maxBlur).toInt() Loading Loading @@ -219,6 +221,13 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() { @Test @Test fun updateBlurCallback_invalidWindow() { fun updateBlurCallback_invalidWindow() { `when`(root.isAttachedToWindow).thenReturn(false) notificationShadeDepthController.updateBlurCallback.doFrame(0) verify(wallpaperManager, times(0)).setWallpaperZoomOut(any(), anyFloat()) } @Test fun updateBlurCallback_exception() { doThrow(IllegalArgumentException("test exception")).`when`(wallpaperManager) doThrow(IllegalArgumentException("test exception")).`when`(wallpaperManager) .setWallpaperZoomOut(any(), anyFloat()) .setWallpaperZoomOut(any(), anyFloat()) notificationShadeDepthController.updateBlurCallback.doFrame(0) notificationShadeDepthController.updateBlurCallback.doFrame(0) Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/NotificationShadeDepthController.kt +5 −1 Original line number Original line Diff line number Diff line Loading @@ -189,7 +189,11 @@ class NotificationShadeDepthController @Inject constructor( blurUtils.applyBlur(blurRoot?.viewRootImpl ?: root.viewRootImpl, blur) blurUtils.applyBlur(blurRoot?.viewRootImpl ?: root.viewRootImpl, blur) val zoomOut = blurUtils.ratioOfBlurRadius(blur) val zoomOut = blurUtils.ratioOfBlurRadius(blur) try { try { if (root.isAttachedToWindow) { wallpaperManager.setWallpaperZoomOut(root.windowToken, zoomOut) wallpaperManager.setWallpaperZoomOut(root.windowToken, zoomOut) } else { Log.i(TAG, "Won't set zoom. Window not attached $root") } } catch (e: IllegalArgumentException) { } catch (e: IllegalArgumentException) { Log.w(TAG, "Can't set zoom. Window is gone: ${root.windowToken}", e) Log.w(TAG, "Can't set zoom. Window is gone: ${root.windowToken}", e) } } Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationShadeDepthControllerTest.kt +9 −0 Original line number Original line Diff line number Diff line Loading @@ -45,6 +45,7 @@ import org.mockito.Mockito.anyString import org.mockito.Mockito.clearInvocations import org.mockito.Mockito.clearInvocations import org.mockito.Mockito.doThrow import org.mockito.Mockito.doThrow import org.mockito.Mockito.never import org.mockito.Mockito.never import org.mockito.Mockito.times import org.mockito.Mockito.verify import org.mockito.Mockito.verify import org.mockito.junit.MockitoJUnit import org.mockito.junit.MockitoJUnit Loading Loading @@ -79,6 +80,7 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() { @Before @Before fun setup() { fun setup() { `when`(root.viewRootImpl).thenReturn(viewRootImpl) `when`(root.viewRootImpl).thenReturn(viewRootImpl) `when`(root.isAttachedToWindow).thenReturn(true) `when`(statusBarStateController.state).then { statusBarState } `when`(statusBarStateController.state).then { statusBarState } `when`(blurUtils.blurRadiusOfRatio(anyFloat())).then { answer -> `when`(blurUtils.blurRadiusOfRatio(anyFloat())).then { answer -> (answer.arguments[0] as Float * maxBlur).toInt() (answer.arguments[0] as Float * maxBlur).toInt() Loading Loading @@ -219,6 +221,13 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() { @Test @Test fun updateBlurCallback_invalidWindow() { fun updateBlurCallback_invalidWindow() { `when`(root.isAttachedToWindow).thenReturn(false) notificationShadeDepthController.updateBlurCallback.doFrame(0) verify(wallpaperManager, times(0)).setWallpaperZoomOut(any(), anyFloat()) } @Test fun updateBlurCallback_exception() { doThrow(IllegalArgumentException("test exception")).`when`(wallpaperManager) doThrow(IllegalArgumentException("test exception")).`when`(wallpaperManager) .setWallpaperZoomOut(any(), anyFloat()) .setWallpaperZoomOut(any(), anyFloat()) notificationShadeDepthController.updateBlurCallback.doFrame(0) notificationShadeDepthController.updateBlurCallback.doFrame(0) Loading