Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/DeviceEntryIconViewBinder.kt +6 −2 Original line number Diff line number Diff line Loading @@ -132,8 +132,12 @@ object DeviceEntryIconViewBinder { view.getIconState(viewModel.type, viewModel.useAodVariant), /* merge */ false ) if (viewModel.type.contentDescriptionResId != -1) { fgIconView.contentDescription = fgIconView.resources.getString(viewModel.type.contentDescriptionResId) fgIconView.resources.getString( viewModel.type.contentDescriptionResId ) } fgIconView.imageTintList = ColorStateList.valueOf(viewModel.tint) fgIconView.setPadding( viewModel.padding, Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/view/DeviceEntryIconView.kt +3 −1 Original line number Diff line number Diff line Loading @@ -214,7 +214,7 @@ constructor( R.id.unlocked, R.id.locked_aod, context.getDrawable(R.drawable.unlocked_to_aod_lock) as AnimatedVectorDrawable, /* reversible */ true, /* reversible */ false, ) } Loading Loading @@ -252,6 +252,7 @@ constructor( IconType.LOCK -> lockIconState[0] = android.R.attr.state_first IconType.UNLOCK -> lockIconState[0] = android.R.attr.state_last IconType.FINGERPRINT -> lockIconState[0] = android.R.attr.state_middle IconType.NONE -> return StateSet.NOTHING } if (aod) { lockIconState[1] = android.R.attr.state_single Loading @@ -265,6 +266,7 @@ constructor( LOCK(R.string.accessibility_lock_icon), UNLOCK(R.string.accessibility_unlock_button), FINGERPRINT(R.string.accessibility_fingerprint_label), NONE(-1), } enum class AccessibilityHintType { Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/DeviceEntryIconViewModel.kt +12 −4 Original line number Diff line number Diff line Loading @@ -195,7 +195,14 @@ constructor( isUnlocked, ) { isListeningForUdfps, isUnlocked -> if (isListeningForUdfps) { if (isUnlocked) { // Don't show any UI until isUnlocked=false. This covers the case // when the "Power button instantly locks > 0s" or the device doesn't lock // immediately after a screen time. DeviceEntryIconView.IconType.NONE } else { DeviceEntryIconView.IconType.FINGERPRINT } } else if (isUnlocked) { DeviceEntryIconView.IconType.UNLOCK } else { Loading @@ -211,7 +218,8 @@ constructor( when (deviceEntryStatus) { DeviceEntryIconView.IconType.LOCK -> isUdfps DeviceEntryIconView.IconType.UNLOCK -> true DeviceEntryIconView.IconType.FINGERPRINT -> false DeviceEntryIconView.IconType.FINGERPRINT, DeviceEntryIconView.IconType.NONE -> false } } Loading Loading @@ -239,8 +247,8 @@ constructor( DeviceEntryIconView.IconType.LOCK -> DeviceEntryIconView.AccessibilityHintType.AUTHENTICATE DeviceEntryIconView.IconType.UNLOCK -> DeviceEntryIconView.AccessibilityHintType.ENTER DeviceEntryIconView.IconType.FINGERPRINT -> DeviceEntryIconView.AccessibilityHintType.NONE DeviceEntryIconView.IconType.FINGERPRINT, DeviceEntryIconView.IconType.NONE -> DeviceEntryIconView.AccessibilityHintType.NONE } } Loading packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/DeviceEntryIconViewModelTest.kt +41 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ import com.android.systemui.keyguard.data.repository.FakeDeviceEntryFingerprintA import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository import com.android.systemui.keyguard.data.repository.fakeDeviceEntryFingerprintAuthRepository import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository import com.android.systemui.keyguard.data.repository.keyguardRepository import com.android.systemui.keyguard.ui.view.DeviceEntryIconView import com.android.systemui.keyguard.ui.viewmodel.DeviceEntryIconViewModel.Companion.UNLOCKED_DELAY_MS import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos Loading Loading @@ -110,6 +110,46 @@ class DeviceEntryIconViewModelTest : SysuiTestCase() { assertThat(isVisible).isTrue() } @Test fun iconType_fingerprint() = testScope.runTest { val iconType by collectLastValue(underTest.iconType) keyguardRepository.setKeyguardDismissible(false) fingerprintPropertyRepository.supportsUdfps() fingerprintAuthRepository.setIsRunning(true) assertThat(iconType).isEqualTo(DeviceEntryIconView.IconType.FINGERPRINT) } @Test fun iconType_locked() = testScope.runTest { val iconType by collectLastValue(underTest.iconType) keyguardRepository.setKeyguardDismissible(false) fingerprintAuthRepository.setIsRunning(false) assertThat(iconType).isEqualTo(DeviceEntryIconView.IconType.LOCK) } @Test fun iconType_unlocked() = testScope.runTest { val iconType by collectLastValue(underTest.iconType) keyguardRepository.setKeyguardDismissible(true) advanceTimeBy(UNLOCKED_DELAY_MS * 2) // wait for unlocked delay fingerprintAuthRepository.setIsRunning(false) assertThat(iconType).isEqualTo(DeviceEntryIconView.IconType.UNLOCK) } @Test fun iconType_none() = testScope.runTest { val iconType by collectLastValue(underTest.iconType) keyguardRepository.setKeyguardDismissible(true) advanceTimeBy(UNLOCKED_DELAY_MS * 2) // wait for unlocked delay fingerprintPropertyRepository.supportsUdfps() fingerprintAuthRepository.setIsRunning(true) assertThat(iconType).isEqualTo(DeviceEntryIconView.IconType.NONE) } private fun deviceEntryIconTransitionAlpha(alpha: Float) { deviceEntryIconTransition.setDeviceEntryParentViewAlpha(alpha) } Loading Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/DeviceEntryIconViewBinder.kt +6 −2 Original line number Diff line number Diff line Loading @@ -132,8 +132,12 @@ object DeviceEntryIconViewBinder { view.getIconState(viewModel.type, viewModel.useAodVariant), /* merge */ false ) if (viewModel.type.contentDescriptionResId != -1) { fgIconView.contentDescription = fgIconView.resources.getString(viewModel.type.contentDescriptionResId) fgIconView.resources.getString( viewModel.type.contentDescriptionResId ) } fgIconView.imageTintList = ColorStateList.valueOf(viewModel.tint) fgIconView.setPadding( viewModel.padding, Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/view/DeviceEntryIconView.kt +3 −1 Original line number Diff line number Diff line Loading @@ -214,7 +214,7 @@ constructor( R.id.unlocked, R.id.locked_aod, context.getDrawable(R.drawable.unlocked_to_aod_lock) as AnimatedVectorDrawable, /* reversible */ true, /* reversible */ false, ) } Loading Loading @@ -252,6 +252,7 @@ constructor( IconType.LOCK -> lockIconState[0] = android.R.attr.state_first IconType.UNLOCK -> lockIconState[0] = android.R.attr.state_last IconType.FINGERPRINT -> lockIconState[0] = android.R.attr.state_middle IconType.NONE -> return StateSet.NOTHING } if (aod) { lockIconState[1] = android.R.attr.state_single Loading @@ -265,6 +266,7 @@ constructor( LOCK(R.string.accessibility_lock_icon), UNLOCK(R.string.accessibility_unlock_button), FINGERPRINT(R.string.accessibility_fingerprint_label), NONE(-1), } enum class AccessibilityHintType { Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/DeviceEntryIconViewModel.kt +12 −4 Original line number Diff line number Diff line Loading @@ -195,7 +195,14 @@ constructor( isUnlocked, ) { isListeningForUdfps, isUnlocked -> if (isListeningForUdfps) { if (isUnlocked) { // Don't show any UI until isUnlocked=false. This covers the case // when the "Power button instantly locks > 0s" or the device doesn't lock // immediately after a screen time. DeviceEntryIconView.IconType.NONE } else { DeviceEntryIconView.IconType.FINGERPRINT } } else if (isUnlocked) { DeviceEntryIconView.IconType.UNLOCK } else { Loading @@ -211,7 +218,8 @@ constructor( when (deviceEntryStatus) { DeviceEntryIconView.IconType.LOCK -> isUdfps DeviceEntryIconView.IconType.UNLOCK -> true DeviceEntryIconView.IconType.FINGERPRINT -> false DeviceEntryIconView.IconType.FINGERPRINT, DeviceEntryIconView.IconType.NONE -> false } } Loading Loading @@ -239,8 +247,8 @@ constructor( DeviceEntryIconView.IconType.LOCK -> DeviceEntryIconView.AccessibilityHintType.AUTHENTICATE DeviceEntryIconView.IconType.UNLOCK -> DeviceEntryIconView.AccessibilityHintType.ENTER DeviceEntryIconView.IconType.FINGERPRINT -> DeviceEntryIconView.AccessibilityHintType.NONE DeviceEntryIconView.IconType.FINGERPRINT, DeviceEntryIconView.IconType.NONE -> DeviceEntryIconView.AccessibilityHintType.NONE } } Loading
packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/DeviceEntryIconViewModelTest.kt +41 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ import com.android.systemui.keyguard.data.repository.FakeDeviceEntryFingerprintA import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository import com.android.systemui.keyguard.data.repository.fakeDeviceEntryFingerprintAuthRepository import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository import com.android.systemui.keyguard.data.repository.keyguardRepository import com.android.systemui.keyguard.ui.view.DeviceEntryIconView import com.android.systemui.keyguard.ui.viewmodel.DeviceEntryIconViewModel.Companion.UNLOCKED_DELAY_MS import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos Loading Loading @@ -110,6 +110,46 @@ class DeviceEntryIconViewModelTest : SysuiTestCase() { assertThat(isVisible).isTrue() } @Test fun iconType_fingerprint() = testScope.runTest { val iconType by collectLastValue(underTest.iconType) keyguardRepository.setKeyguardDismissible(false) fingerprintPropertyRepository.supportsUdfps() fingerprintAuthRepository.setIsRunning(true) assertThat(iconType).isEqualTo(DeviceEntryIconView.IconType.FINGERPRINT) } @Test fun iconType_locked() = testScope.runTest { val iconType by collectLastValue(underTest.iconType) keyguardRepository.setKeyguardDismissible(false) fingerprintAuthRepository.setIsRunning(false) assertThat(iconType).isEqualTo(DeviceEntryIconView.IconType.LOCK) } @Test fun iconType_unlocked() = testScope.runTest { val iconType by collectLastValue(underTest.iconType) keyguardRepository.setKeyguardDismissible(true) advanceTimeBy(UNLOCKED_DELAY_MS * 2) // wait for unlocked delay fingerprintAuthRepository.setIsRunning(false) assertThat(iconType).isEqualTo(DeviceEntryIconView.IconType.UNLOCK) } @Test fun iconType_none() = testScope.runTest { val iconType by collectLastValue(underTest.iconType) keyguardRepository.setKeyguardDismissible(true) advanceTimeBy(UNLOCKED_DELAY_MS * 2) // wait for unlocked delay fingerprintPropertyRepository.supportsUdfps() fingerprintAuthRepository.setIsRunning(true) assertThat(iconType).isEqualTo(DeviceEntryIconView.IconType.NONE) } private fun deviceEntryIconTransitionAlpha(alpha: Float) { deviceEntryIconTransition.setDeviceEntryParentViewAlpha(alpha) } Loading