Loading packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceController.kt +5 −0 Original line number Original line Diff line number Diff line Loading @@ -86,6 +86,7 @@ class LockscreenSmartspaceController @Inject constructor( var stateChangeListener = object : View.OnAttachStateChangeListener { var stateChangeListener = object : View.OnAttachStateChangeListener { override fun onViewAttachedToWindow(v: View) { override fun onViewAttachedToWindow(v: View) { smartspaceViews.add(v as SmartspaceView) smartspaceViews.add(v as SmartspaceView) connectSession() updateTextColorFromWallpaper() updateTextColorFromWallpaper() statusBarStateListener.onDozeAmountChanged(0f, statusBarStateController.dozeAmount) statusBarStateListener.onDozeAmountChanged(0f, statusBarStateController.dozeAmount) Loading @@ -93,6 +94,10 @@ class LockscreenSmartspaceController @Inject constructor( override fun onViewDetachedFromWindow(v: View) { override fun onViewDetachedFromWindow(v: View) { smartspaceViews.remove(v as SmartspaceView) smartspaceViews.remove(v as SmartspaceView) if (smartspaceViews.isEmpty()) { disconnect() } } } } } Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceControllerTest.kt +3 −2 Original line number Original line Diff line number Diff line Loading @@ -199,8 +199,9 @@ class LockscreenSmartspaceControllerTest : SysuiTestCase() { `when`(deviceProvisionedController.isDeviceProvisioned()).thenReturn(false) `when`(deviceProvisionedController.isDeviceProvisioned()).thenReturn(false) `when`(deviceProvisionedController.isCurrentUserSetup()).thenReturn(false) `when`(deviceProvisionedController.isCurrentUserSetup()).thenReturn(false) // WHEN a connection attempt is made // WHEN a connection attempt is made and view is attached controller.buildAndConnectView(fakeParent) val view = controller.buildAndConnectView(fakeParent) controller.stateChangeListener.onViewAttachedToWindow(view) // THEN no session is created // THEN no session is created verify(smartspaceManager, never()).createSmartspaceSession(any()) verify(smartspaceManager, never()).createSmartspaceSession(any()) Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceController.kt +5 −0 Original line number Original line Diff line number Diff line Loading @@ -86,6 +86,7 @@ class LockscreenSmartspaceController @Inject constructor( var stateChangeListener = object : View.OnAttachStateChangeListener { var stateChangeListener = object : View.OnAttachStateChangeListener { override fun onViewAttachedToWindow(v: View) { override fun onViewAttachedToWindow(v: View) { smartspaceViews.add(v as SmartspaceView) smartspaceViews.add(v as SmartspaceView) connectSession() updateTextColorFromWallpaper() updateTextColorFromWallpaper() statusBarStateListener.onDozeAmountChanged(0f, statusBarStateController.dozeAmount) statusBarStateListener.onDozeAmountChanged(0f, statusBarStateController.dozeAmount) Loading @@ -93,6 +94,10 @@ class LockscreenSmartspaceController @Inject constructor( override fun onViewDetachedFromWindow(v: View) { override fun onViewDetachedFromWindow(v: View) { smartspaceViews.remove(v as SmartspaceView) smartspaceViews.remove(v as SmartspaceView) if (smartspaceViews.isEmpty()) { disconnect() } } } } } Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceControllerTest.kt +3 −2 Original line number Original line Diff line number Diff line Loading @@ -199,8 +199,9 @@ class LockscreenSmartspaceControllerTest : SysuiTestCase() { `when`(deviceProvisionedController.isDeviceProvisioned()).thenReturn(false) `when`(deviceProvisionedController.isDeviceProvisioned()).thenReturn(false) `when`(deviceProvisionedController.isCurrentUserSetup()).thenReturn(false) `when`(deviceProvisionedController.isCurrentUserSetup()).thenReturn(false) // WHEN a connection attempt is made // WHEN a connection attempt is made and view is attached controller.buildAndConnectView(fakeParent) val view = controller.buildAndConnectView(fakeParent) controller.stateChangeListener.onViewAttachedToWindow(view) // THEN no session is created // THEN no session is created verify(smartspaceManager, never()).createSmartspaceSession(any()) verify(smartspaceManager, never()).createSmartspaceSession(any()) Loading