Loading packages/SystemUI/src/com/android/systemui/stylus/StylusUsiPowerStartable.kt +0 −8 Original line number Diff line number Diff line Loading @@ -50,14 +50,6 @@ constructor( } } override fun onStylusBluetoothConnected(deviceId: Int, btAddress: String) { stylusUsiPowerUi.refresh() } override fun onStylusBluetoothDisconnected(deviceId: Int, btAddress: String) { stylusUsiPowerUi.refresh() } override fun onStylusUsiBatteryStateChanged( deviceId: Int, eventTimeMillis: Long, Loading packages/SystemUI/src/com/android/systemui/stylus/StylusUsiPowerUI.kt +6 −1 Original line number Diff line number Diff line Loading @@ -94,12 +94,17 @@ constructor( return@refreshNotification } // Only hide notification in two cases: battery has been recharged above the // threshold, or user has dismissed or clicked notification ("suppression"). if (suppressed || !batteryBelowThreshold) { hideNotification() } if (!batteryBelowThreshold) { // Reset suppression when stylus battery is recharged, so that the next time // it reaches a low battery, the notification will show again. suppressed = false } hideNotification() } } Loading packages/SystemUI/tests/src/com/android/systemui/stylus/StylusUsiPowerStartableTest.kt +0 −14 Original line number Diff line number Diff line Loading @@ -112,20 +112,6 @@ class StylusUsiPowerStartableTest : SysuiTestCase() { verifyZeroInteractions(stylusUsiPowerUi) } @Test fun onStylusBluetoothConnected_refreshesNotification() { startable.onStylusBluetoothConnected(STYLUS_DEVICE_ID, "ANY") verify(stylusUsiPowerUi, times(1)).refresh() } @Test fun onStylusBluetoothDisconnected_refreshesNotification() { startable.onStylusBluetoothDisconnected(STYLUS_DEVICE_ID, "ANY") verify(stylusUsiPowerUi, times(1)).refresh() } @Test fun onStylusUsiBatteryStateChanged_batteryPresentValidCapacity_refreshesNotification() { val batteryState = FixedCapacityBatteryState(0.1f) Loading packages/SystemUI/tests/src/com/android/systemui/stylus/StylusUsiPowerUiTest.kt +4 −11 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import org.junit.runner.RunWith import org.mockito.ArgumentCaptor import org.mockito.Captor import org.mockito.Mock import org.mockito.Mockito.clearInvocations import org.mockito.Mockito.doNothing import org.mockito.Mockito.inOrder import org.mockito.Mockito.never Loading Loading @@ -194,22 +195,14 @@ class StylusUsiPowerUiTest : SysuiTestCase() { } @Test fun refresh_hasConnectedBluetoothStylus_cancelsNotification() { whenever(inputManager.inputDeviceIds).thenReturn(intArrayOf(0)) stylusUsiPowerUi.refresh() verify(notificationManager).cancel(R.string.stylus_battery_low_percentage) } @Test fun refresh_hasConnectedBluetoothStylus_existingNotification_cancelsNotification() { fun refresh_hasConnectedBluetoothStylus_existingNotification_doesNothing() { stylusUsiPowerUi.updateBatteryState(0, FixedCapacityBatteryState(0.1f)) whenever(inputManager.inputDeviceIds).thenReturn(intArrayOf(0)) clearInvocations(notificationManager) stylusUsiPowerUi.refresh() verify(notificationManager).cancel(R.string.stylus_battery_low_percentage) verifyNoMoreInteractions(notificationManager) } @Test Loading Loading
packages/SystemUI/src/com/android/systemui/stylus/StylusUsiPowerStartable.kt +0 −8 Original line number Diff line number Diff line Loading @@ -50,14 +50,6 @@ constructor( } } override fun onStylusBluetoothConnected(deviceId: Int, btAddress: String) { stylusUsiPowerUi.refresh() } override fun onStylusBluetoothDisconnected(deviceId: Int, btAddress: String) { stylusUsiPowerUi.refresh() } override fun onStylusUsiBatteryStateChanged( deviceId: Int, eventTimeMillis: Long, Loading
packages/SystemUI/src/com/android/systemui/stylus/StylusUsiPowerUI.kt +6 −1 Original line number Diff line number Diff line Loading @@ -94,12 +94,17 @@ constructor( return@refreshNotification } // Only hide notification in two cases: battery has been recharged above the // threshold, or user has dismissed or clicked notification ("suppression"). if (suppressed || !batteryBelowThreshold) { hideNotification() } if (!batteryBelowThreshold) { // Reset suppression when stylus battery is recharged, so that the next time // it reaches a low battery, the notification will show again. suppressed = false } hideNotification() } } Loading
packages/SystemUI/tests/src/com/android/systemui/stylus/StylusUsiPowerStartableTest.kt +0 −14 Original line number Diff line number Diff line Loading @@ -112,20 +112,6 @@ class StylusUsiPowerStartableTest : SysuiTestCase() { verifyZeroInteractions(stylusUsiPowerUi) } @Test fun onStylusBluetoothConnected_refreshesNotification() { startable.onStylusBluetoothConnected(STYLUS_DEVICE_ID, "ANY") verify(stylusUsiPowerUi, times(1)).refresh() } @Test fun onStylusBluetoothDisconnected_refreshesNotification() { startable.onStylusBluetoothDisconnected(STYLUS_DEVICE_ID, "ANY") verify(stylusUsiPowerUi, times(1)).refresh() } @Test fun onStylusUsiBatteryStateChanged_batteryPresentValidCapacity_refreshesNotification() { val batteryState = FixedCapacityBatteryState(0.1f) Loading
packages/SystemUI/tests/src/com/android/systemui/stylus/StylusUsiPowerUiTest.kt +4 −11 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import org.junit.runner.RunWith import org.mockito.ArgumentCaptor import org.mockito.Captor import org.mockito.Mock import org.mockito.Mockito.clearInvocations import org.mockito.Mockito.doNothing import org.mockito.Mockito.inOrder import org.mockito.Mockito.never Loading Loading @@ -194,22 +195,14 @@ class StylusUsiPowerUiTest : SysuiTestCase() { } @Test fun refresh_hasConnectedBluetoothStylus_cancelsNotification() { whenever(inputManager.inputDeviceIds).thenReturn(intArrayOf(0)) stylusUsiPowerUi.refresh() verify(notificationManager).cancel(R.string.stylus_battery_low_percentage) } @Test fun refresh_hasConnectedBluetoothStylus_existingNotification_cancelsNotification() { fun refresh_hasConnectedBluetoothStylus_existingNotification_doesNothing() { stylusUsiPowerUi.updateBatteryState(0, FixedCapacityBatteryState(0.1f)) whenever(inputManager.inputDeviceIds).thenReturn(intArrayOf(0)) clearInvocations(notificationManager) stylusUsiPowerUi.refresh() verify(notificationManager).cancel(R.string.stylus_battery_low_percentage) verifyNoMoreInteractions(notificationManager) } @Test Loading