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

Commit 9a086d9f authored by Kevin Chyn's avatar Kevin Chyn Committed by Android (Google) Code Review
Browse files

Merge "Update content descriptions when text/icons are updated" into qt-dev

parents f4585efd bb79c002
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -292,6 +292,14 @@
    <string name="biometric_dialog_try_again">Try again</string>
    <!-- Content description for empty spaces that are not taken by the biometric dialog. Clicking on these areas will cancel authentication and dismiss the biometric dialog [CHAR LIMIT=NONE] -->
    <string name="biometric_dialog_empty_space_description">Empty region, tap to cancel authentication</string>
    <!-- Content description for the face icon when the device is not authenticating anymore [CHAR LIMIT=NONE] -->
    <string name="biometric_dialog_face_icon_description_idle">Please try again</string>
    <!-- Content description for the face icon when the device is authenticating [CHAR LIMIT=NONE] -->
    <string name="biometric_dialog_face_icon_description_authenticating">Looking for your face</string>
    <!-- Content description for the face icon when the user has been authenticated [CHAR LIMIT=NONE] -->
    <string name="biometric_dialog_face_icon_description_authenticated">Face authenticated</string>
    <!-- Content description for the face icon when the user has been authenticated and the confirm button has been pressed [CHAR LIMIT=NONE] -->
    <string name="biometric_dialog_face_icon_description_confirmed">Confirmed</string>

    <!-- Message shown when the system-provided fingerprint dialog is shown, asking for authentication -->
    <string name="fingerprint_dialog_touch_sensor">Touch the fingerprint sensor</string>
+0 −1
Original line number Diff line number Diff line
@@ -325,7 +325,6 @@ public class BiometricDialogImpl extends SystemUI implements CommandQueue.Callba

    private void handleTryAgainPressed() {
        try {
            mCurrentDialog.clearTemporaryMessage();
            mReceiver.onTryAgainPressed();
        } catch (RemoteException e) {
            Log.e(TAG, "RemoteException when handling try again", e);
+3 −5
Original line number Diff line number Diff line
@@ -223,6 +223,7 @@ public abstract class BiometricDialogView extends LinearLayout {
        });

        mTryAgainButton.setOnClickListener((View v) -> {
            handleResetMessage();
            updateState(STATE_AUTHENTICATING);
            showTryAgainButton(false /* show */);
            mCallback.onTryAgainPressed();
@@ -265,6 +266,7 @@ public abstract class BiometricDialogView extends LinearLayout {
        if (mRestoredState == null) {
            updateState(STATE_AUTHENTICATING);
            mErrorText.setText(getHintStringResourceId());
            mErrorText.setContentDescription(mContext.getString(getHintStringResourceId()));
            mErrorText.setVisibility(View.VISIBLE);
        } else {
            updateState(mState);
@@ -415,11 +417,6 @@ public abstract class BiometricDialogView extends LinearLayout {
                BiometricPrompt.HIDE_DIALOG_DELAY);
    }

    public void clearTemporaryMessage() {
        mHandler.removeMessages(MSG_RESET_MESSAGE);
        mHandler.obtainMessage(MSG_RESET_MESSAGE).sendToTarget();
    }

    /**
     * Transient help message (acquire) is received, dialog stays showing. Sensor stays in
     * "authenticating" state.
@@ -478,6 +475,7 @@ public abstract class BiometricDialogView extends LinearLayout {
        mPositiveButton.setVisibility(bundle.getInt(KEY_CONFIRM_VISIBILITY));
        mState = bundle.getInt(KEY_STATE);
        mErrorText.setText(bundle.getCharSequence(KEY_ERROR_TEXT_STRING));
        mErrorText.setContentDescription(bundle.getCharSequence(KEY_ERROR_TEXT_STRING));
        mErrorText.setVisibility(bundle.getInt(KEY_ERROR_TEXT_VISIBILITY));
        mErrorText.setTextColor(bundle.getInt(KEY_ERROR_TEXT_COLOR));

+15 −0
Original line number Diff line number Diff line
@@ -288,6 +288,7 @@ public class FaceDialogView extends BiometricDialogView {
    @Override
    protected void handleResetMessage() {
        mErrorText.setText(getHintStringResourceId());
        mErrorText.setContentDescription(mContext.getString(getHintStringResourceId()));
        mErrorText.setTextColor(mTextColor);
        if (getState() == STATE_AUTHENTICATING) {
            mErrorText.setVisibility(View.VISIBLE);
@@ -406,13 +407,21 @@ public class FaceDialogView extends BiometricDialogView {
            } else {
                mIconController.showIcon(R.drawable.face_dialog_pulse_dark_to_light);
            }
            mBiometricIcon.setContentDescription(mContext.getString(
                    R.string.biometric_dialog_face_icon_description_authenticating));
        } else if (oldState == STATE_PENDING_CONFIRMATION && newState == STATE_AUTHENTICATED) {
            mIconController.animateOnce(R.drawable.face_dialog_dark_to_checkmark);
            mBiometricIcon.setContentDescription(mContext.getString(
                    R.string.biometric_dialog_face_icon_description_confirmed));
        } else if (oldState == STATE_ERROR && newState == STATE_IDLE) {
            mIconController.animateOnce(R.drawable.face_dialog_error_to_idle);
            mBiometricIcon.setContentDescription(mContext.getString(
                    R.string.biometric_dialog_face_icon_description_idle));
        } else if (oldState == STATE_ERROR && newState == STATE_AUTHENTICATED) {
            mHandler.removeCallbacks(mErrorToIdleAnimationRunnable);
            mIconController.animateOnce(R.drawable.face_dialog_dark_to_checkmark);
            mBiometricIcon.setContentDescription(mContext.getString(
                    R.string.biometric_dialog_face_icon_description_authenticated));
        } else if (newState == STATE_ERROR) {
            // It's easier to only check newState and gate showing the animation on the
            // mErrorToIdleAnimationRunnable as a proxy, than add a ton of extra state. For example,
@@ -426,11 +435,17 @@ public class FaceDialogView extends BiometricDialogView {
            }
        } else if (oldState == STATE_AUTHENTICATING && newState == STATE_AUTHENTICATED) {
            mIconController.animateOnce(R.drawable.face_dialog_dark_to_checkmark);
            mBiometricIcon.setContentDescription(mContext.getString(
                    R.string.biometric_dialog_face_icon_description_authenticated));
        } else if (newState == STATE_PENDING_CONFIRMATION) {
            mHandler.removeCallbacks(mErrorToIdleAnimationRunnable);
            mIconController.animateOnce(R.drawable.face_dialog_wink_from_dark);
            mBiometricIcon.setContentDescription(mContext.getString(
                    R.string.biometric_dialog_face_icon_description_authenticated));
        } else if (newState == STATE_IDLE) {
            mIconController.showStatic(R.drawable.face_dialog_idle_static);
            mBiometricIcon.setContentDescription(mContext.getString(
                    R.string.biometric_dialog_face_icon_description_idle));
        } else {
            Log.w(TAG, "Unknown animation from " + oldState + " -> " + newState);
        }