Loading packages/SystemUI/src/com/android/systemui/stylus/StylusUsiPowerUI.kt +3 −5 Original line number Diff line number Diff line Loading @@ -29,13 +29,14 @@ import android.os.Bundle import android.os.Handler import android.os.UserHandle import android.util.Log import android.view.InputDevice import androidx.core.app.NotificationCompat import androidx.core.app.NotificationManagerCompat import com.android.internal.annotations.VisibleForTesting import com.android.systemui.R import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.shared.hardware.hasInputDevice import com.android.systemui.shared.hardware.isAnyStylusSource import com.android.systemui.util.NotificationChannels import java.text.NumberFormat import javax.inject.Inject Loading Loading @@ -150,10 +151,7 @@ constructor( } private fun hasConnectedBluetoothStylus(): Boolean { // TODO(b/257936830): get bt address once input api available return inputManager.inputDeviceIds.any { deviceId -> inputManager.getInputDevice(deviceId).supportsSource(InputDevice.SOURCE_STYLUS) } return inputManager.hasInputDevice { it.isAnyStylusSource && it.bluetoothAddress != null } } private fun getPendingBroadcast(action: String): PendingIntent? { Loading packages/SystemUI/tests/src/com/android/systemui/stylus/StylusUsiPowerUiTest.kt +1 −4 Original line number Diff line number Diff line Loading @@ -36,7 +36,6 @@ import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat import junit.framework.Assert.assertEquals import org.junit.Before import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.mockito.ArgumentCaptor Loading Loading @@ -79,7 +78,7 @@ class StylusUsiPowerUiTest : SysuiTestCase() { whenever(inputManager.inputDeviceIds).thenReturn(intArrayOf()) whenever(inputManager.getInputDevice(0)).thenReturn(btStylusDevice) whenever(btStylusDevice.supportsSource(InputDevice.SOURCE_STYLUS)).thenReturn(true) // whenever(btStylusDevice.bluetoothAddress).thenReturn("SO:ME:AD:DR:ES") whenever(btStylusDevice.bluetoothAddress).thenReturn("SO:ME:AD:DR:ES") stylusUsiPowerUi = StylusUsiPowerUI(contextSpy, notificationManager, inputManager, handler) broadcastReceiver = stylusUsiPowerUi.receiver Loading Loading @@ -179,7 +178,6 @@ class StylusUsiPowerUiTest : SysuiTestCase() { } @Test @Ignore("TODO(b/257936830): get bt address once input api available") fun refresh_hasConnectedBluetoothStylus_cancelsNotification() { whenever(inputManager.inputDeviceIds).thenReturn(intArrayOf(0)) Loading @@ -189,7 +187,6 @@ class StylusUsiPowerUiTest : SysuiTestCase() { } @Test @Ignore("TODO(b/257936830): get bt address once input api available") fun refresh_hasConnectedBluetoothStylus_existingNotification_cancelsNotification() { stylusUsiPowerUi.updateBatteryState(0, FixedCapacityBatteryState(0.1f)) whenever(inputManager.inputDeviceIds).thenReturn(intArrayOf(0)) Loading Loading
packages/SystemUI/src/com/android/systemui/stylus/StylusUsiPowerUI.kt +3 −5 Original line number Diff line number Diff line Loading @@ -29,13 +29,14 @@ import android.os.Bundle import android.os.Handler import android.os.UserHandle import android.util.Log import android.view.InputDevice import androidx.core.app.NotificationCompat import androidx.core.app.NotificationManagerCompat import com.android.internal.annotations.VisibleForTesting import com.android.systemui.R import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.shared.hardware.hasInputDevice import com.android.systemui.shared.hardware.isAnyStylusSource import com.android.systemui.util.NotificationChannels import java.text.NumberFormat import javax.inject.Inject Loading Loading @@ -150,10 +151,7 @@ constructor( } private fun hasConnectedBluetoothStylus(): Boolean { // TODO(b/257936830): get bt address once input api available return inputManager.inputDeviceIds.any { deviceId -> inputManager.getInputDevice(deviceId).supportsSource(InputDevice.SOURCE_STYLUS) } return inputManager.hasInputDevice { it.isAnyStylusSource && it.bluetoothAddress != null } } private fun getPendingBroadcast(action: String): PendingIntent? { Loading
packages/SystemUI/tests/src/com/android/systemui/stylus/StylusUsiPowerUiTest.kt +1 −4 Original line number Diff line number Diff line Loading @@ -36,7 +36,6 @@ import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat import junit.framework.Assert.assertEquals import org.junit.Before import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.mockito.ArgumentCaptor Loading Loading @@ -79,7 +78,7 @@ class StylusUsiPowerUiTest : SysuiTestCase() { whenever(inputManager.inputDeviceIds).thenReturn(intArrayOf()) whenever(inputManager.getInputDevice(0)).thenReturn(btStylusDevice) whenever(btStylusDevice.supportsSource(InputDevice.SOURCE_STYLUS)).thenReturn(true) // whenever(btStylusDevice.bluetoothAddress).thenReturn("SO:ME:AD:DR:ES") whenever(btStylusDevice.bluetoothAddress).thenReturn("SO:ME:AD:DR:ES") stylusUsiPowerUi = StylusUsiPowerUI(contextSpy, notificationManager, inputManager, handler) broadcastReceiver = stylusUsiPowerUi.receiver Loading Loading @@ -179,7 +178,6 @@ class StylusUsiPowerUiTest : SysuiTestCase() { } @Test @Ignore("TODO(b/257936830): get bt address once input api available") fun refresh_hasConnectedBluetoothStylus_cancelsNotification() { whenever(inputManager.inputDeviceIds).thenReturn(intArrayOf(0)) Loading @@ -189,7 +187,6 @@ class StylusUsiPowerUiTest : SysuiTestCase() { } @Test @Ignore("TODO(b/257936830): get bt address once input api available") fun refresh_hasConnectedBluetoothStylus_existingNotification_cancelsNotification() { stylusUsiPowerUi.updateBatteryState(0, FixedCapacityBatteryState(0.1f)) whenever(inputManager.inputDeviceIds).thenReturn(intArrayOf(0)) Loading