Merge changes I255c033f,I4269b194 into sc-dev

* changes:
  Fix udfps auth scrim state
  Lock screen a11y updates
This commit is contained in:
TreeHugger Robot
2021-05-13 11:15:39 +00:00
committed by Android (Google) Code Review
7 changed files with 41 additions and 19 deletions

View File

@@ -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" />
<FrameLayout

View File

@@ -336,6 +336,8 @@
<string name="accessibility_phone_button">Phone</string>
<!-- Content description of the phone button for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_voice_assist_button">Voice Assist</string>
<!-- Content description of the wallet button for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_wallet_button">Wallet</string>
<!-- Content description of the unlock button for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_unlock_button">Unlock</string>
<!-- Content description of the lock icon for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
@@ -2965,8 +2967,10 @@
<!-- Accessibility action for tapping on an affordance on an unlocked lock screen (ie: "Double
tap to enter device") [CHAR LIMIT=NONE] -->
<string name="accessibility_enter_hint">enter device</string>
<!-- Message shown to suggest authentication using [CHAR LIMIT=60]-->
<!-- Message shown to suggest authentication using fingerprint [CHAR LIMIT=60]-->
<string name="keyguard_try_fingerprint">Use fingerprint to open</string>
<!-- Accessibility announcement to inform user to unlock using the fingerprint sensor [CHAR LIMIT=NONE] -->
<string name="accessibility_fingerprint_bouncer">Authentication required. Touch the fingerprint sensor to authenticate.</string>
<!-- Content description for a chip in the status bar showing that the user is currently on a phone call. [CHAR LIMIT=NONE] -->
<string name="ongoing_phone_call_content_description">Ongoing phone call</string>

View File

@@ -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<LockIconView> 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<LockIconView> 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<LockIconView> 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<LockIconView> 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<LockIconView> impleme
mView.setOnClickListener(v -> onAffordanceClick());
if (mAccessibilityManager.isTouchExplorationEnabled()) {
mView.setOnLongClickListener(null);
mView.setLongClickable(false);
} else {
mView.setOnLongClickListener(v -> onAffordanceClick());
}

View File

@@ -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;
}

View File

@@ -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<Ud
updatePauseAuth();
if (mShowingUdfpsBouncer) {
mView.animateUdfpsBouncer();
mView.announceForAccessibility(mView.getContext().getString(
R.string.accessibility_fingerprint_bouncer));
} else {
mView.animateAwayUdfpsBouncer(() -> mKeyguardViewManager.cancelPostAuthActions());
}

View File

@@ -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;
}
},

View File

@@ -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(