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

Commit 5f82e987 authored by Beverly Tai's avatar Beverly Tai Committed by Android (Google) Code Review
Browse files

Merge "Don't show udfps disabled after biometric auth" into sc-dev

parents afbe75fd a95ecb02
Loading
Loading
Loading
Loading
+0 −22
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2020 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<com.android.keyguard.DisabledUdfpsView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/disabled_udfps_view"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
/>
+25 −6
Original line number Diff line number Diff line
@@ -83,6 +83,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
    private boolean mQsExpanded;
    private int mStatusBarState;
    private boolean mIsKeyguardShowing;
    private boolean mUserUnlockedWithBiometric;

    private boolean mShowButton;
    private boolean mShowUnlockIcon;
@@ -155,7 +156,8 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
            mView.setLocation(new PointF(props[0], props[1]), props[2]);
        }

        mIsKeyguardShowing = mKeyguardViewController.isShowing();
        updateKeyguardShowing();
        mUserUnlockedWithBiometric = false;
        mIsBouncerShowing = mKeyguardViewController.isBouncerShowing();
        mIsDozing = mStatusBarStateController.isDozing();
        mRunningFPS = mKeyguardUpdateMonitor.isFingerprintDetectionRunning();
@@ -216,7 +218,8 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
        }

        // these three states are mutually exclusive:
        mShowButton = mUdfpsEnrolled && !mCanDismissLockScreen && !mRunningFPS && isLockScreen();
        mShowButton = mUdfpsEnrolled && !mCanDismissLockScreen && !mRunningFPS
                && !mUserUnlockedWithBiometric && isLockScreen();
        mShowUnlockIcon = mFaceAuthEnrolled & mCanDismissLockScreen && isLockScreen();
        mShowLockIcon = !mUdfpsEnrolled && !mCanDismissLockScreen && isLockScreen()
            && mFaceAuthEnrolled;
@@ -289,6 +292,11 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
        }
    }

    private void updateKeyguardShowing() {
        mIsKeyguardShowing = mKeyguardStateController.isShowing()
                && !mKeyguardStateController.isKeyguardGoingAway();
    }

    @Override
    public void dump(@NonNull FileDescriptor fd, @NonNull PrintWriter pw, @NonNull String[] args) {
        pw.println("  mShowBouncerButton: " + mShowButton);
@@ -300,6 +308,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
        pw.println("  mIsKeyguardShowing: " + mIsKeyguardShowing);
        pw.println("  mIsDozing: " + mIsDozing);
        pw.println("  mIsBouncerShowing: " + mIsBouncerShowing);
        pw.println("  mUserUnlockedWithBiometric: " + mUserUnlockedWithBiometric);
        pw.println("  mRunningFPS: " + mRunningFPS);
        pw.println("  mCanDismissLockScreen: " + mCanDismissLockScreen);
        pw.println("  mStatusBarState: " + StatusBarState.toShortString(mStatusBarState));
@@ -326,19 +335,21 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
                @Override
                public void onKeyguardBouncerChanged(boolean bouncer) {
                    mIsBouncerShowing = bouncer;
                    mIsKeyguardShowing = mKeyguardStateController.isShowing();
                    updateVisibility();
                }

                @Override
                public void onBiometricRunningStateChanged(boolean running,
                        BiometricSourceType biometricSourceType) {
                    mUserUnlockedWithBiometric =
                            mKeyguardUpdateMonitor.getUserUnlockedWithBiometric(
                                    KeyguardUpdateMonitor.getCurrentUser());

                    if (biometricSourceType == FINGERPRINT) {
                        mRunningFPS = running;
                    }

                        updateVisibility();
                    }
                }
            };

    private final KeyguardStateController.Callback mKeyguardStateCallback =
@@ -346,15 +357,23 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
        @Override
        public void onUnlockedChanged() {
            mCanDismissLockScreen = mKeyguardStateController.canDismissLockScreen();
            updateKeyguardShowing();
            updateVisibility();
        }

        @Override
        public void onKeyguardShowingChanged() {
            mIsKeyguardShowing = mKeyguardStateController.isShowing();
            updateKeyguardShowing();
            mUdfpsEnrolled = mKeyguardUpdateMonitor.isUdfpsEnrolled();
            mFaceAuthEnrolled = mKeyguardUpdateMonitor.isFaceEnrolled();
            updateVisibility();
        }

        @Override
        public void onKeyguardFadingAwayChanged() {
            updateKeyguardShowing();
            updateVisibility();
        }
    };

    private final AccessibilityManager.TouchExplorationStateChangeListener