Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c99d9a95 authored by Selim Cinek's avatar Selim Cinek
Browse files

Fixed content description of the lock icon when fingerprint is on

Also surfacing Fingerprint Errors now with a message.

Bug: 21565811
Change-Id: I3bba66303c08313dbca1df5ef2f20b251f541bc1
parent 08d9834c
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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>
+4 −0
Original line number Diff line number Diff line
@@ -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] -->
+11 −0
Original line number Diff line number Diff line
@@ -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);
        }
    };

+21 −2
Original line number Diff line number Diff line
@@ -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;
    }