Register battery callbacks from USI notification startable.

This fixes a regression whew the stylus low battery
notifications wasn't showing.

Bug: 269087753
Test: StylusUsiPowerStartableTest
Change-Id: I781b36b340cc808fff566e40019304d283c7e3d6
This commit is contained in:
Vania Januar
2023-02-13 11:39:25 +00:00
parent bf0e9a8269
commit 6d1d3907c6
2 changed files with 9 additions and 0 deletions

View File

@@ -74,6 +74,7 @@ constructor(
stylusUsiPowerUi.init()
stylusManager.registerCallback(this)
stylusManager.registerBatteryCallback(this)
stylusManager.startListener()
}

View File

@@ -91,6 +91,14 @@ class StylusUsiPowerStartableTest : SysuiTestCase() {
verify(stylusUsiPowerUi, times(1)).init()
}
@Test
fun start_registersCallbacks() {
startable.start()
verify(stylusManager, times(1)).registerCallback(startable)
verify(stylusManager, times(1)).registerBatteryCallback(startable)
}
@Test
fun onStylusAdded_internal_updatesNotificationSuppression() {
startable.onStylusAdded(STYLUS_DEVICE_ID)