diff options
4 files changed, 37 insertions, 4 deletions
diff --git a/packages/SystemUI/res/layout/keyguard_bottom_area.xml b/packages/SystemUI/res/layout/keyguard_bottom_area.xml index 48af565..1488ad6 100644 --- a/packages/SystemUI/res/layout/keyguard_bottom_area.xml +++ b/packages/SystemUI/res/layout/keyguard_bottom_area.xml @@ -68,7 +68,6 @@ android:layout_height="@dimen/keyguard_affordance_height" android:layout_gravity="bottom|center_horizontal" android:src="@drawable/ic_lock_24dp" - android:scaleType="center" - android:contentDescription="@string/accessibility_unlock_button" /> + android:scaleType="center" /> </com.android.systemui.statusbar.phone.KeyguardBottomAreaView> diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 47c642d..e2a318a 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -215,6 +215,10 @@ <string name="accessibility_voice_assist_button">Voice Assist</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 unlock button when fingerpint is on (not shown on the screen). [CHAR LIMIT=NONE] --> + <string name="accessibility_unlock_button_fingerprint">Unlock button, waiting for fingerprint</string> + <!-- Accessibility action of the unlock button when fingerpint is on (not shown on the screen). [CHAR LIMIT=NONE] --> + <string name="accessibility_unlock_without_fingerprint">Unlock without using your fingerprint</string> <!-- Click action label for accessibility for the unlock button. [CHAR LIMIT=NONE] --> <string name="unlock_label">unlock</string> <!-- Click action label for accessibility for the phone button. [CHAR LIMIT=NONE] --> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java index 3258a9f..815e123 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java @@ -614,6 +614,13 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL } }; + private final Runnable mHideTransientIndicationRunnable = new Runnable() { + @Override + public void run() { + mIndicationController.hideTransientIndication(); + } + }; + private final KeyguardUpdateMonitorCallback mUpdateMonitorCallback = new KeyguardUpdateMonitorCallback() { @Override @@ -657,6 +664,10 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL @Override public void onFingerprintError(int msgId, String errString) { // TODO: Go to bouncer if this is "too many attempts" (lockout) error. + mIndicationController.showTransientIndication(errString, + getResources().getColor(R.color.system_warning_color, null)); + removeCallbacks(mHideTransientIndicationRunnable); + postDelayed(mHideTransientIndicationRunnable, 5000); } }; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java index 2063b26..f5fdf48 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java @@ -16,14 +16,13 @@ package com.android.systemui.statusbar.phone; -import android.annotation.NonNull; -import android.annotation.Nullable; import android.content.Context; import android.graphics.drawable.AnimatedVectorDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.InsetDrawable; import android.util.AttributeSet; import android.view.View; +import android.view.accessibility.AccessibilityNodeInfo; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.systemui.R; @@ -54,6 +53,7 @@ public class LockIcon extends KeyguardAffordanceView { private final TrustDrawable mTrustDrawable; private final UnlockMethodCache mUnlockMethodCache; private AccessibilityController mAccessibilityController; + private boolean mHasFingerPrintIcon; public LockIcon(Context context, AttributeSet attrs) { super(context, attrs); @@ -128,6 +128,11 @@ public class LockIcon extends KeyguardAffordanceView { setRestingAlpha( anyFingerprintIcon ? 1f : KeyguardAffordanceHelper.SWIPE_RESTING_ALPHA_AMOUNT); setImageDrawable(icon); + String contentDescription = getResources().getString(anyFingerprintIcon + ? R.string.accessibility_unlock_button_fingerprint + : R.string.accessibility_unlock_button); + setContentDescription(contentDescription); + mHasFingerPrintIcon = anyFingerprintIcon; if (animation != null) { // If we play the draw on animation, delay it by one frame when the screen is @@ -167,6 +172,20 @@ public class LockIcon extends KeyguardAffordanceView { setFocusable(mAccessibilityController.isAccessibilityEnabled()); } + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + if (mHasFingerPrintIcon) { + // Avoid that the button description is also spoken + info.setClassName(LockIcon.class.getName()); + AccessibilityNodeInfo.AccessibilityAction unlock + = new AccessibilityNodeInfo.AccessibilityAction( + AccessibilityNodeInfo.ACTION_CLICK, + getContext().getString(R.string.accessibility_unlock_without_fingerprint)); + info.addAction(unlock); + } + } + public void setAccessibilityController(AccessibilityController accessibilityController) { mAccessibilityController = accessibilityController; } |
