diff --git a/packages/SystemUI/res/layout/keyguard_bottom_area.xml b/packages/SystemUI/res/layout/keyguard_bottom_area.xml index 69d73c1b94e14..95483f13ec6a6 100644 --- a/packages/SystemUI/res/layout/keyguard_bottom_area.xml +++ b/packages/SystemUI/res/layout/keyguard_bottom_area.xml @@ -95,6 +95,7 @@ android:background="@drawable/wallet_lockscreen_bg" android:layout_marginEnd="@dimen/keyguard_affordance_horizontal_offset" android:layout_marginBottom="@dimen/keyguard_affordance_vertical_offset" + android:contentDescription="@string/accessibility_wallet_button" android:visibility="gone" /> Phone Voice Assist + + Wallet Unlock @@ -2965,8 +2967,10 @@ enter device - + Use fingerprint to open + + Authentication required. Touch the fingerprint sensor to authenticate. Ongoing phone call diff --git a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java index b5f2ab2135595..b367bdf08886e 100644 --- a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java @@ -50,6 +50,7 @@ import com.android.systemui.util.ViewController; import java.io.FileDescriptor; import java.io.PrintWriter; +import java.util.Objects; import javax.inject.Inject; @@ -75,6 +76,9 @@ public class LockIconViewController extends ViewController impleme @NonNull private final Drawable mButton; @NonNull private final Drawable mUnlockIcon; @NonNull private final Drawable mLockIcon; + @NonNull private final CharSequence mDisabledLabel; + @NonNull private final CharSequence mUnlockedLabel; + @NonNull private final CharSequence mLockedLabel; private boolean mIsDozing; private boolean mIsBouncerShowing; @@ -121,6 +125,10 @@ public class LockIconViewController extends ViewController impleme com.android.internal.R.drawable.ic_lock, context.getTheme()), context.getResources().getDimensionPixelSize( com.android.systemui.R.dimen.udfps_unlock_icon_inset)); + mDisabledLabel = context.getResources().getString( + R.string.accessibility_udfps_disabled_button); + mUnlockedLabel = context.getResources().getString(R.string.accessibility_unlock_button); + mLockedLabel = context.getResources().getString(R.string.accessibility_lock_icon); dumpManager.registerDumpable("LockIconViewController", this); } @@ -225,25 +233,27 @@ public class LockIconViewController extends ViewController impleme && mFaceAuthEnrolled; updateClickListener(); + final CharSequence prevContentDescription = mView.getContentDescription(); if (mShowButton) { mView.setImageDrawable(mButton); mView.setVisibility(View.VISIBLE); - mView.setContentDescription(getResources().getString( - R.string.accessibility_udfps_disabled_button)); + mView.setContentDescription(mDisabledLabel); } else if (mShowUnlockIcon) { mView.setImageDrawable(mUnlockIcon); mView.setVisibility(View.VISIBLE); - mView.setContentDescription(getResources().getString( - R.string.accessibility_unlock_button)); + mView.setContentDescription(mUnlockedLabel); } else if (mShowLockIcon) { mView.setImageDrawable(mLockIcon); mView.setVisibility(View.VISIBLE); - mView.setContentDescription(getResources().getString( - R.string.accessibility_lock_icon)); + mView.setContentDescription(mLockedLabel); } else { mView.setVisibility(View.INVISIBLE); mView.setContentDescription(null); } + if (!Objects.equals(prevContentDescription, mView.getContentDescription()) + && mView.getContentDescription() != null) { + mView.announceForAccessibility(mView.getContentDescription()); + } } private final View.AccessibilityDelegate mAccessibilityDelegate = @@ -258,20 +268,12 @@ public class LockIconViewController extends ViewController impleme getResources().getString(R.string.accessibility_enter_hint)); public void onInitializeAccessibilityNodeInfo(View v, AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(v, info); - removeAllActions(info); if (mShowButton || mShowLockIcon) { info.addAction(mAccessibilityAuthenticateHint); } else if (mShowUnlockIcon) { info.addAction(mAccessibilityEnterHint); } } - - private void removeAllActions(AccessibilityNodeInfo info) { - info.removeAction(mAccessibilityAuthenticateHint); - info.removeAction(mAccessibilityEnterHint); - info.removeAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_LONG_CLICK); - mView.setLongClickable(false); - } }; private boolean isLockScreen() { @@ -286,6 +288,7 @@ public class LockIconViewController extends ViewController impleme mView.setOnClickListener(v -> onAffordanceClick()); if (mAccessibilityManager.isTouchExplorationEnabled()) { mView.setOnLongClickListener(null); + mView.setLongClickable(false); } else { mView.setOnLongClickListener(v -> onAffordanceClick()); } diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java index 875bfdbffff3c..e8300b92a3764 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java @@ -338,7 +338,7 @@ public class UdfpsController implements DozeReceiver { switch (event.getActionMasked()) { case MotionEvent.ACTION_OUTSIDE: udfpsView.onTouchOutsideView(); - break; + return true; case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_HOVER_ENTER: // To simplify the lifecycle of the velocity tracker, make sure it's never null @@ -602,6 +602,8 @@ public class UdfpsController implements DozeReceiver { default: // Do nothing to stay in portrait mode. } + // avoid announcing window title + mCoreLayoutParams.accessibilityTitle = " "; return mCoreLayoutParams; } diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java index 33d0d0c5b5ffd..819e829c53b09 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java @@ -27,6 +27,7 @@ import androidx.annotation.Nullable; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitorCallback; +import com.android.systemui.R; import com.android.systemui.dump.DumpManager; import com.android.systemui.keyguard.KeyguardViewMediator; import com.android.systemui.plugins.statusbar.StatusBarStateController; @@ -165,6 +166,8 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController mKeyguardViewManager.cancelPostAuthActions()); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java index 1469cdab2d626..35dda44268498 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java @@ -96,11 +96,14 @@ public enum ScrimState { AUTH_SCRIMMED { @Override public void prepare(ScrimState previousState) { - mFrontTint = Color.BLACK; + mNotifTint = previousState.mNotifTint; + mNotifAlpha = previousState.mNotifAlpha; - mBehindAlpha = 0f; + mBehindTint = previousState.mBehindTint; + mBehindAlpha = previousState.mBehindAlpha; + + mFrontTint = Color.BLACK; mFrontAlpha = .66f; - mBubbleAlpha = 0f; } }, diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerTest.java index 3a657c816937f..a1f283b9a26b1 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerTest.java @@ -18,10 +18,12 @@ package com.android.systemui.biometrics; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.Mockito.atLeast; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import android.content.Context; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper.RunWithLooper; @@ -55,6 +57,8 @@ public class UdfpsKeyguardViewControllerTest extends SysuiTestCase { @Mock private UdfpsKeyguardView mView; @Mock + private Context mResourceContext; + @Mock private StatusBarStateController mStatusBarStateController; @Mock private StatusBar mStatusBar; @@ -90,6 +94,8 @@ public class UdfpsKeyguardViewControllerTest extends SysuiTestCase { @Before public void setUp() { MockitoAnnotations.initMocks(this); + when(mView.getContext()).thenReturn(mResourceContext); + when(mResourceContext.getString(anyInt())).thenReturn("test string"); when(mKeyguardViewMediator.isAnimatingScreenOff()).thenReturn(false); when(mKeyguardUpdateMonitor.isKeyguardVisible()).thenReturn(true); mController = new UdfpsKeyguardViewController(