Loading packages/SystemUI/src/com/android/keyguard/LockIconViewController.java +12 −2 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ import com.android.systemui.dump.DumpManager; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor; import com.android.systemui.keyguard.domain.interactor.PrimaryBouncerInteractor; import com.android.systemui.keyguard.shared.model.TransitionStep; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; Loading Loading @@ -112,6 +113,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme @NonNull private final VibratorHelper mVibrator; @Nullable private final AuthRippleController mAuthRippleController; @NonNull private final FeatureFlags mFeatureFlags; @NonNull private final PrimaryBouncerInteractor mPrimaryBouncerInteractor; @NonNull private final KeyguardTransitionInteractor mTransitionInteractor; @NonNull private final KeyguardInteractor mKeyguardInteractor; Loading Loading @@ -180,7 +182,8 @@ public class LockIconViewController extends ViewController<LockIconView> impleme @NonNull @Main Resources resources, @NonNull KeyguardTransitionInteractor transitionInteractor, @NonNull KeyguardInteractor keyguardInteractor, @NonNull FeatureFlags featureFlags @NonNull FeatureFlags featureFlags, PrimaryBouncerInteractor primaryBouncerInteractor ) { super(view); mStatusBarStateController = statusBarStateController; Loading @@ -197,6 +200,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme mTransitionInteractor = transitionInteractor; mKeyguardInteractor = keyguardInteractor; mFeatureFlags = featureFlags; mPrimaryBouncerInteractor = primaryBouncerInteractor; mMaxBurnInOffsetX = resources.getDimensionPixelSize(R.dimen.udfps_burn_in_offset_x); mMaxBurnInOffsetY = resources.getDimensionPixelSize(R.dimen.udfps_burn_in_offset_y); Loading Loading @@ -325,8 +329,14 @@ public class LockIconViewController extends ViewController<LockIconView> impleme mView.setContentDescription(null); } boolean accessibilityEnabled = !mPrimaryBouncerInteractor.isAnimatingAway() && mView.isVisibleToUser(); mView.setImportantForAccessibility( accessibilityEnabled ? View.IMPORTANT_FOR_ACCESSIBILITY_YES : View.IMPORTANT_FOR_ACCESSIBILITY_NO); if (!Objects.equals(prevContentDescription, mView.getContentDescription()) && mView.getContentDescription() != null && mView.isVisibleToUser()) { && mView.getContentDescription() != null && accessibilityEnabled) { mView.announceForAccessibility(mView.getContentDescription()); } } Loading packages/SystemUI/tests/src/com/android/keyguard/LockIconViewControllerBaseTest.java +5 −1 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository; import com.android.systemui.keyguard.data.repository.KeyguardTransitionRepository; import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor; import com.android.systemui.keyguard.domain.interactor.PrimaryBouncerInteractor; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.CommandQueue; Loading Loading @@ -95,6 +96,8 @@ public class LockIconViewControllerBaseTest extends SysuiTestCase { protected @Mock KeyguardTransitionRepository mTransitionRepository; protected @Mock CommandQueue mCommandQueue; protected FakeExecutor mDelayableExecutor = new FakeExecutor(new FakeSystemClock()); protected @Mock PrimaryBouncerInteractor mPrimaryBouncerInteractor; protected LockIconViewController mUnderTest; Loading Loading @@ -167,7 +170,8 @@ public class LockIconViewControllerBaseTest extends SysuiTestCase { mFeatureFlags, new FakeKeyguardBouncerRepository() ), mFeatureFlags mFeatureFlags, mPrimaryBouncerInteractor ); } Loading packages/SystemUI/tests/src/com/android/keyguard/LockIconViewControllerTest.java +72 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import android.hardware.biometrics.BiometricSourceType; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; import android.util.Pair; import android.view.View; import androidx.test.filters.SmallTest; Loading Loading @@ -267,4 +268,75 @@ public class LockIconViewControllerTest extends LockIconViewControllerBaseTest { // THEN the lock icon is shown verify(mLockIconView).setContentDescription(LOCKED_LABEL); } @Test public void lockIconAccessibility_notVisibleToUser() { // GIVEN lock icon controller is initialized and view is attached init(/* useMigrationFlag= */false); captureKeyguardStateCallback(); captureKeyguardUpdateMonitorCallback(); // GIVEN user has unlocked with a biometric auth (ie: face auth) // and biometric running state changes when(mKeyguardUpdateMonitor.getUserUnlockedWithBiometric(anyInt())).thenReturn(true); mKeyguardUpdateMonitorCallback.onBiometricRunningStateChanged(false, BiometricSourceType.FACE); reset(mLockIconView); when(mLockIconView.isVisibleToUser()).thenReturn(false); // WHEN the unlocked state changes when(mKeyguardUpdateMonitor.getUserUnlockedWithBiometric(anyInt())).thenReturn(false); mKeyguardStateCallback.onUnlockedChanged(); // THEN the lock icon is shown verify(mLockIconView).setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); } @Test public void lockIconAccessibility_bouncerAnimatingAway() { // GIVEN lock icon controller is initialized and view is attached init(/* useMigrationFlag= */false); captureKeyguardStateCallback(); captureKeyguardUpdateMonitorCallback(); // GIVEN user has unlocked with a biometric auth (ie: face auth) // and biometric running state changes when(mKeyguardUpdateMonitor.getUserUnlockedWithBiometric(anyInt())).thenReturn(true); mKeyguardUpdateMonitorCallback.onBiometricRunningStateChanged(false, BiometricSourceType.FACE); reset(mLockIconView); when(mLockIconView.isVisibleToUser()).thenReturn(true); when(mPrimaryBouncerInteractor.isAnimatingAway()).thenReturn(true); // WHEN the unlocked state changes when(mKeyguardUpdateMonitor.getUserUnlockedWithBiometric(anyInt())).thenReturn(false); mKeyguardStateCallback.onUnlockedChanged(); // THEN the lock icon is shown verify(mLockIconView).setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); } @Test public void lockIconAccessibility_bouncerNotAnimatingAway_viewVisible() { // GIVEN lock icon controller is initialized and view is attached init(/* useMigrationFlag= */false); captureKeyguardStateCallback(); captureKeyguardUpdateMonitorCallback(); // GIVEN user has unlocked with a biometric auth (ie: face auth) // and biometric running state changes when(mKeyguardUpdateMonitor.getUserUnlockedWithBiometric(anyInt())).thenReturn(true); mKeyguardUpdateMonitorCallback.onBiometricRunningStateChanged(false, BiometricSourceType.FACE); reset(mLockIconView); when(mLockIconView.isVisibleToUser()).thenReturn(true); when(mPrimaryBouncerInteractor.isAnimatingAway()).thenReturn(false); // WHEN the unlocked state changes when(mKeyguardUpdateMonitor.getUserUnlockedWithBiometric(anyInt())).thenReturn(false); mKeyguardStateCallback.onUnlockedChanged(); // THEN the lock icon is shown verify(mLockIconView).setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES); } } Loading
packages/SystemUI/src/com/android/keyguard/LockIconViewController.java +12 −2 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ import com.android.systemui.dump.DumpManager; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor; import com.android.systemui.keyguard.domain.interactor.PrimaryBouncerInteractor; import com.android.systemui.keyguard.shared.model.TransitionStep; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; Loading Loading @@ -112,6 +113,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme @NonNull private final VibratorHelper mVibrator; @Nullable private final AuthRippleController mAuthRippleController; @NonNull private final FeatureFlags mFeatureFlags; @NonNull private final PrimaryBouncerInteractor mPrimaryBouncerInteractor; @NonNull private final KeyguardTransitionInteractor mTransitionInteractor; @NonNull private final KeyguardInteractor mKeyguardInteractor; Loading Loading @@ -180,7 +182,8 @@ public class LockIconViewController extends ViewController<LockIconView> impleme @NonNull @Main Resources resources, @NonNull KeyguardTransitionInteractor transitionInteractor, @NonNull KeyguardInteractor keyguardInteractor, @NonNull FeatureFlags featureFlags @NonNull FeatureFlags featureFlags, PrimaryBouncerInteractor primaryBouncerInteractor ) { super(view); mStatusBarStateController = statusBarStateController; Loading @@ -197,6 +200,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme mTransitionInteractor = transitionInteractor; mKeyguardInteractor = keyguardInteractor; mFeatureFlags = featureFlags; mPrimaryBouncerInteractor = primaryBouncerInteractor; mMaxBurnInOffsetX = resources.getDimensionPixelSize(R.dimen.udfps_burn_in_offset_x); mMaxBurnInOffsetY = resources.getDimensionPixelSize(R.dimen.udfps_burn_in_offset_y); Loading Loading @@ -325,8 +329,14 @@ public class LockIconViewController extends ViewController<LockIconView> impleme mView.setContentDescription(null); } boolean accessibilityEnabled = !mPrimaryBouncerInteractor.isAnimatingAway() && mView.isVisibleToUser(); mView.setImportantForAccessibility( accessibilityEnabled ? View.IMPORTANT_FOR_ACCESSIBILITY_YES : View.IMPORTANT_FOR_ACCESSIBILITY_NO); if (!Objects.equals(prevContentDescription, mView.getContentDescription()) && mView.getContentDescription() != null && mView.isVisibleToUser()) { && mView.getContentDescription() != null && accessibilityEnabled) { mView.announceForAccessibility(mView.getContentDescription()); } } Loading
packages/SystemUI/tests/src/com/android/keyguard/LockIconViewControllerBaseTest.java +5 −1 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository; import com.android.systemui.keyguard.data.repository.KeyguardTransitionRepository; import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor; import com.android.systemui.keyguard.domain.interactor.PrimaryBouncerInteractor; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.CommandQueue; Loading Loading @@ -95,6 +96,8 @@ public class LockIconViewControllerBaseTest extends SysuiTestCase { protected @Mock KeyguardTransitionRepository mTransitionRepository; protected @Mock CommandQueue mCommandQueue; protected FakeExecutor mDelayableExecutor = new FakeExecutor(new FakeSystemClock()); protected @Mock PrimaryBouncerInteractor mPrimaryBouncerInteractor; protected LockIconViewController mUnderTest; Loading Loading @@ -167,7 +170,8 @@ public class LockIconViewControllerBaseTest extends SysuiTestCase { mFeatureFlags, new FakeKeyguardBouncerRepository() ), mFeatureFlags mFeatureFlags, mPrimaryBouncerInteractor ); } Loading
packages/SystemUI/tests/src/com/android/keyguard/LockIconViewControllerTest.java +72 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import android.hardware.biometrics.BiometricSourceType; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; import android.util.Pair; import android.view.View; import androidx.test.filters.SmallTest; Loading Loading @@ -267,4 +268,75 @@ public class LockIconViewControllerTest extends LockIconViewControllerBaseTest { // THEN the lock icon is shown verify(mLockIconView).setContentDescription(LOCKED_LABEL); } @Test public void lockIconAccessibility_notVisibleToUser() { // GIVEN lock icon controller is initialized and view is attached init(/* useMigrationFlag= */false); captureKeyguardStateCallback(); captureKeyguardUpdateMonitorCallback(); // GIVEN user has unlocked with a biometric auth (ie: face auth) // and biometric running state changes when(mKeyguardUpdateMonitor.getUserUnlockedWithBiometric(anyInt())).thenReturn(true); mKeyguardUpdateMonitorCallback.onBiometricRunningStateChanged(false, BiometricSourceType.FACE); reset(mLockIconView); when(mLockIconView.isVisibleToUser()).thenReturn(false); // WHEN the unlocked state changes when(mKeyguardUpdateMonitor.getUserUnlockedWithBiometric(anyInt())).thenReturn(false); mKeyguardStateCallback.onUnlockedChanged(); // THEN the lock icon is shown verify(mLockIconView).setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); } @Test public void lockIconAccessibility_bouncerAnimatingAway() { // GIVEN lock icon controller is initialized and view is attached init(/* useMigrationFlag= */false); captureKeyguardStateCallback(); captureKeyguardUpdateMonitorCallback(); // GIVEN user has unlocked with a biometric auth (ie: face auth) // and biometric running state changes when(mKeyguardUpdateMonitor.getUserUnlockedWithBiometric(anyInt())).thenReturn(true); mKeyguardUpdateMonitorCallback.onBiometricRunningStateChanged(false, BiometricSourceType.FACE); reset(mLockIconView); when(mLockIconView.isVisibleToUser()).thenReturn(true); when(mPrimaryBouncerInteractor.isAnimatingAway()).thenReturn(true); // WHEN the unlocked state changes when(mKeyguardUpdateMonitor.getUserUnlockedWithBiometric(anyInt())).thenReturn(false); mKeyguardStateCallback.onUnlockedChanged(); // THEN the lock icon is shown verify(mLockIconView).setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); } @Test public void lockIconAccessibility_bouncerNotAnimatingAway_viewVisible() { // GIVEN lock icon controller is initialized and view is attached init(/* useMigrationFlag= */false); captureKeyguardStateCallback(); captureKeyguardUpdateMonitorCallback(); // GIVEN user has unlocked with a biometric auth (ie: face auth) // and biometric running state changes when(mKeyguardUpdateMonitor.getUserUnlockedWithBiometric(anyInt())).thenReturn(true); mKeyguardUpdateMonitorCallback.onBiometricRunningStateChanged(false, BiometricSourceType.FACE); reset(mLockIconView); when(mLockIconView.isVisibleToUser()).thenReturn(true); when(mPrimaryBouncerInteractor.isAnimatingAway()).thenReturn(false); // WHEN the unlocked state changes when(mKeyguardUpdateMonitor.getUserUnlockedWithBiometric(anyInt())).thenReturn(false); mKeyguardStateCallback.onUnlockedChanged(); // THEN the lock icon is shown verify(mLockIconView).setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES); } }