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

Commit 71d2fb23 authored by Lucas Dupin's avatar Lucas Dupin
Browse files

Clearer scanning state and debug logs

Always show scanning state, even on lock screen.
Also added some logs to make it easier to debug face auth.

Fixes: 133342103
Fixes: 133873875
Test: logcat
Test: manual
Change-Id: I1e5c1825a3fc33b5c9862b4f72a7652a89779514
parent a124cdd7
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -111,6 +111,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
    private static final String TAG = "KeyguardUpdateMonitor";
    private static final String TAG = "KeyguardUpdateMonitor";
    private static final boolean DEBUG = KeyguardConstants.DEBUG;
    private static final boolean DEBUG = KeyguardConstants.DEBUG;
    private static final boolean DEBUG_SIM_STATES = KeyguardConstants.DEBUG_SIM_STATES;
    private static final boolean DEBUG_SIM_STATES = KeyguardConstants.DEBUG_SIM_STATES;
    private static final boolean DEBUG_FACE = true;
    private static final int LOW_BATTERY_THRESHOLD = 20;
    private static final int LOW_BATTERY_THRESHOLD = 20;


    private static final String ACTION_FACE_UNLOCK_STARTED
    private static final String ACTION_FACE_UNLOCK_STARTED
@@ -182,6 +183,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
     * Prudently disable lockscreen.
     * Prudently disable lockscreen.
     */
     */
    public static final boolean CORE_APPS_ONLY;
    public static final boolean CORE_APPS_ONLY;

    static {
    static {
        try {
        try {
            CORE_APPS_ONLY = IPackageManager.Stub.asInterface(
            CORE_APPS_ONLY = IPackageManager.Stub.asInterface(
@@ -734,6 +736,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
        if (acquireInfo != FaceManager.FACE_ACQUIRED_GOOD) {
        if (acquireInfo != FaceManager.FACE_ACQUIRED_GOOD) {
            return;
            return;
        }
        }
        if (DEBUG_FACE) Log.d(TAG, "Face acquired");
        for (int i = 0; i < mCallbacks.size(); i++) {
        for (int i = 0; i < mCallbacks.size(); i++) {
            KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
            KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
            if (cb != null) {
            if (cb != null) {
@@ -760,6 +763,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
                Log.d(TAG, "Face authentication disabled by DPM for userId: " + userId);
                Log.d(TAG, "Face authentication disabled by DPM for userId: " + userId);
                return;
                return;
            }
            }
            if (DEBUG_FACE) Log.d(TAG, "Face auth succeeded for user " + userId);
            onFaceAuthenticated(userId);
            onFaceAuthenticated(userId);
        } finally {
        } finally {
            setFaceRunningState(BIOMETRIC_STATE_STOPPED);
            setFaceRunningState(BIOMETRIC_STATE_STOPPED);
@@ -768,6 +772,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
    }
    }


    private void handleFaceHelp(int msgId, String helpString) {
    private void handleFaceHelp(int msgId, String helpString) {
        if (DEBUG_FACE) Log.d(TAG, "Face help received: " + helpString);
        for (int i = 0; i < mCallbacks.size(); i++) {
        for (int i = 0; i < mCallbacks.size(); i++) {
            KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
            KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
            if (cb != null) {
            if (cb != null) {
@@ -786,6 +791,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
    };
    };


    private void handleFaceError(int msgId, String errString) {
    private void handleFaceError(int msgId, String errString) {
        if (DEBUG_FACE) Log.d(TAG, "Face error received: " + errString);
        if (msgId == FaceManager.FACE_ERROR_CANCELED
        if (msgId == FaceManager.FACE_ERROR_CANCELED
                && mFaceRunningState == BIOMETRIC_STATE_CANCELLING_RESTARTING) {
                && mFaceRunningState == BIOMETRIC_STATE_CANCELLING_RESTARTING) {
            setFaceRunningState(BIOMETRIC_STATE_STOPPED);
            setFaceRunningState(BIOMETRIC_STATE_STOPPED);
+1 −9
Original line number Original line Diff line number Diff line
@@ -741,13 +741,5 @@ public class KeyguardIndicationController implements StateListener,
                updateIndication(false);
                updateIndication(false);
            }
            }
        }
        }

        @Override
        public void onKeyguardBouncerChanged(boolean bouncer) {
            if (mLockIcon == null) {
                return;
    }
    }
            mLockIcon.setBouncerVisible(bouncer);
        }
    };
}
}
+4 −19
Original line number Original line Diff line number Diff line
@@ -90,11 +90,9 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
    private int mDensity;
    private int mDensity;
    private boolean mPulsing;
    private boolean mPulsing;
    private boolean mDozing;
    private boolean mDozing;
    private boolean mBouncerVisible;
    private boolean mDocked;
    private boolean mDocked;
    private boolean mLastDozing;
    private boolean mLastDozing;
    private boolean mLastPulsing;
    private boolean mLastPulsing;
    private boolean mLastBouncerVisible;
    private int mIconColor;
    private int mIconColor;
    private float mDozeAmount;
    private float mDozeAmount;
    private int mIconRes;
    private int mIconRes;
@@ -252,9 +250,9 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
        int state = getState();
        int state = getState();
        mIsFaceUnlockState = state == STATE_SCANNING_FACE;
        mIsFaceUnlockState = state == STATE_SCANNING_FACE;
        if (state != mLastState || mLastDozing != mDozing || mLastPulsing != mPulsing
        if (state != mLastState || mLastDozing != mDozing || mLastPulsing != mPulsing
                || mLastScreenOn != mScreenOn || mLastBouncerVisible != mBouncerVisible || force) {
                || mLastScreenOn != mScreenOn || force) {
            @LockAnimIndex final int lockAnimIndex = getAnimationIndexForTransition(mLastState,
            @LockAnimIndex final int lockAnimIndex = getAnimationIndexForTransition(mLastState,
                    state, mLastPulsing, mPulsing, mLastDozing, mDozing, mBouncerVisible);
                    state, mLastPulsing, mPulsing, mLastDozing, mDozing);
            boolean isAnim = lockAnimIndex != -1;
            boolean isAnim = lockAnimIndex != -1;


            int iconRes = isAnim ? getThemedAnimationResId(lockAnimIndex) : getIconForState(state);
            int iconRes = isAnim ? getThemedAnimationResId(lockAnimIndex) : getIconForState(state);
@@ -302,7 +300,6 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
            mLastScreenOn = mScreenOn;
            mLastScreenOn = mScreenOn;
            mLastDozing = mDozing;
            mLastDozing = mDozing;
            mLastPulsing = mPulsing;
            mLastPulsing = mPulsing;
            mLastBouncerVisible = mBouncerVisible;
        }
        }


        boolean onAodNotPulsingOrDocked = mDozing && (!mPulsing || mDocked);
        boolean onAodNotPulsingOrDocked = mDozing && (!mPulsing || mDocked);
@@ -371,8 +368,7 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
    }
    }


    private int getAnimationIndexForTransition(int oldState, int newState,
    private int getAnimationIndexForTransition(int oldState, int newState,
            boolean wasPulsing, boolean pulsing, boolean wasDozing, boolean dozing,
            boolean wasPulsing, boolean pulsing, boolean wasDozing, boolean dozing) {
            boolean bouncerVisible) {


        // Never animate when screen is off
        // Never animate when screen is off
        if (dozing && !pulsing && !mWasPulsingOnThisFrame) {
        if (dozing && !pulsing && !mWasPulsingOnThisFrame) {
@@ -391,7 +387,7 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
            return UNLOCK;
            return UNLOCK;
        } else if (justLocked) {
        } else if (justLocked) {
            return LOCK;
            return LOCK;
        } else if (newState == STATE_SCANNING_FACE && bouncerVisible) {
        } else if (newState == STATE_SCANNING_FACE) {
            return SCANNING;
            return SCANNING;
        } else if ((nowPulsing || turningOn) && newState != STATE_LOCK_OPEN) {
        } else if ((nowPulsing || turningOn) && newState != STATE_LOCK_OPEN) {
            return LOCK_IN;
            return LOCK_IN;
@@ -496,17 +492,6 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
        setImageTintList(ColorStateList.valueOf(color));
        setImageTintList(ColorStateList.valueOf(color));
    }
    }


    /**
     * If bouncer is visible or not.
     */
    public void setBouncerVisible(boolean bouncerVisible) {
        if (mBouncerVisible == bouncerVisible) {
            return;
        }
        mBouncerVisible = bouncerVisible;
        update();
    }

    @Override
    @Override
    public void onDensityOrFontScaleChanged() {
    public void onDensityOrFontScaleChanged() {
        ViewGroup.LayoutParams lp = getLayoutParams();
        ViewGroup.LayoutParams lp = getLayoutParams();