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

Commit 699de3bb authored by Andy Mast's avatar Andy Mast
Browse files

Keyguard: Add fingerprint icon to the bottom view

Change-Id: I7737a8de33c763119a1ac6b346479c0d757f1023
parent c109747d
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="40dp"
    android:height="40dp"
    android:viewportWidth="40"
    android:viewportHeight="40">

    <path
        android:fillColor="#9E9E9E"
        android:pathData="M10.1,6.5c4.9-3,13.1-3.1,18.3-0.1c0.6,0.3,1.4,0.1,1.7-0.5c0.3-0.6,0.1-1.4-0.5-1.7
c-6-3.5-15.2-3.4-20.9,0.1C8.2,4.7,8,5.5,8.4,6.1C8.6,6.4,9,6.7,9.5,6.7C9.7,6.7,9.9,6.6,10.1,6.5z
M34.5,16.1
c0.6-0.4,0.7-1.2,0.4-1.7C31.3,9,24.5,5.7,18,6.1C12.4,6.4,6.7,9.7,3.5,14.4c-0.4,0.6-0.2,1.4,0.3,1.7c0.6,0.4,1.3,0.2,1.7-0.3
c2.7-4.1,7.6-6.9,12.5-7.2c5.7-0.3,11.6,2.6,14.6,7.2c0.2,0.4,0.6,0.6,1,0.6C34,16.3,34.3,16.3,34.5,16.1z
M15.9,37.9
c0.5-0.5,0.6-1.3,0.1-1.8c-3.3-3.6-6.7-10.9-2.7-15.8c1.3-1.7,3.3-2.7,5.4-2.9c2.1-0.1,4.1,0.6,5.6,2c1.6,1.5,2.5,3.5,2.5,5.6
c0,0.7,0.6,1.2,1.2,1.2c0.7,0,1.2-0.6,1.2-1.2c0-2.8-1.2-5.5-3.3-7.4c-2.1-1.9-4.7-2.9-7.5-2.7c-2.7,0.2-5.4,1.6-7.1,3.8
c-4.5,5.5-2,13.8,2.8,19.1c0.2,0.3,0.6,0.4,0.9,0.4C15.4,38.2,15.7,38.1,15.9,37.9z
M25.5,37.7c0.1-0.7-0.3-1.3-1-1.5
c-3.4-0.7-6.5-3.5-7.9-7c-0.7-1.9-0.9-4.6,0.1-6.2c0.5-0.8,1.3-1.2,2.3-1.3c0.6-0.1,1.2,0.1,1.7,0.4c0.6,0.3,1,0.9,1.2,1.5
c0.2,0.5,0.2,1,0.3,1.5c0.2,1,0.4,2.2,1.1,3.3c1.4,2,4.2,2.9,6.6,2c4-1.5,4.3-6.2,3-9.8c-1.4-3.6-4-6.7-7.4-8.4
c-4.6-2.3-10.3-2-14.5,0.7c-6,3.9-8.3,12.7-5.2,19.6c0.3,0.6,1,0.9,1.7,0.6c0.6-0.3,0.9-1,0.6-1.7C5.6,25.6,7.5,18.2,12.5,15
c3.5-2.3,8.3-2.5,12.1-0.6c2.8,1.4,5,3.9,6.2,7c0.7,2,1.2,5.6-1.5,6.6c-1.3,0.5-2.9,0.1-3.7-1c-0.4-0.6-0.6-1.4-0.7-2.3
c-0.1-0.6-0.2-1.2-0.4-1.8c-0.4-1.2-1.3-2.3-2.4-2.9c-1-0.6-2.1-0.8-3.2-0.7c-1.8,0.2-3.3,1-4.2,2.5c-1.5,2.4-1.3,6-0.3,8.4
c1.6,4.3,5.4,7.7,9.7,8.6c0.1,0,0.2,0,0.3,0C24.9,38.7,25.4,38.3,25.5,37.7z
M27.9,34.9c-2.4,0-4.7-0.8-6.4-2.2
c-2.2-1.8-3.6-4.6-3.6-7.5c0-0.7,0.6-1.3,1.2-1.3c0.7,0,1.3,0.6,1.3,1.2c0,2.1,1,4.2,2.7,5.6c2.1,1.8,4.7,1.8,6.4,1.5
c0.7-0.1,1.3,0.4,1.4,1c0.1,0.7-0.4,1.3-1,1.4C29.2,34.8,28.5,34.9,27.9,34.9z" />
</vector>
 No newline at end of file
+15 −4
Original line number Diff line number Diff line
@@ -510,10 +510,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
            return;
        }
        // TODO: Real icon for facelock.
        int iconRes = mUnlockMethodCache.isFaceUnlockRunning()
                ? com.android.internal.R.drawable.ic_account_circle
                : mUnlockMethodCache.isCurrentlyInsecure() ? R.drawable.ic_lock_open_24dp
                : R.drawable.ic_lock_24dp;
        int iconRes = getIconLockResId();
        if (mLastUnlockIconRes != iconRes) {
            Drawable icon = mContext.getDrawable(iconRes);
            int iconHeight = getResources().getDimensionPixelSize(
@@ -530,6 +527,20 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
        updateLockIconClickability();
    }

    private int getIconLockResId() {
        int iconRes;
        if (mUnlockMethodCache.isFaceUnlockRunning()) {
            iconRes = com.android.internal.R.drawable.ic_account_circle;
        } else if (mUnlockMethodCache.isFingerUnlockRunning()) {
            iconRes = R.drawable.ic_fingerprint;
        } else if (mUnlockMethodCache.isCurrentlyInsecure()) {
            iconRes = R.drawable.ic_lock_open_24dp;
        } else {
            iconRes =  R.drawable.ic_lock_24dp;
        }
        return iconRes;
    }

    private String getIndexHint(LockscreenShortcutsHelper.Shortcuts shortcut) {
        if (mShortcutHelper.isTargetCustom(shortcut)) {
            boolean isRtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL;
+10 −1
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ public class UnlockMethodCache {
    private boolean mCurrentlyInsecure;
    private boolean mTrustManaged;
    private boolean mFaceUnlockRunning;
    private boolean mFingerUnlockRunning;

    private UnlockMethodCache(Context ctx) {
        mLockPatternUtils = new LockPatternUtils(ctx);
@@ -86,13 +87,17 @@ public class UnlockMethodCache {
        boolean trustManaged = mKeyguardUpdateMonitor.getUserTrustIsManaged(user);
        boolean faceUnlockRunning = mKeyguardUpdateMonitor.isFaceUnlockRunning(user)
                && trustManaged;
        boolean fingerUnlockRunning = mLockPatternUtils.usingFingerprint(user);

        boolean changed = secure != mSecure || currentlyInsecure != mCurrentlyInsecure ||
                trustManaged != mTrustManaged  || faceUnlockRunning != mFaceUnlockRunning;
                trustManaged != mTrustManaged  || faceUnlockRunning != mFaceUnlockRunning ||
                fingerUnlockRunning != mFingerUnlockRunning;
        if (changed || updateAlways) {
            mSecure = secure;
            mCurrentlyInsecure = currentlyInsecure;
            mTrustManaged = trustManaged;
            mFaceUnlockRunning = faceUnlockRunning;
            mFingerUnlockRunning = fingerUnlockRunning;
            notifyListeners();
        }
    }
@@ -143,6 +148,10 @@ public class UnlockMethodCache {
        return mFaceUnlockRunning;
    }

    public boolean isFingerUnlockRunning() {
        return mFingerUnlockRunning;
    }

    public static interface OnUnlockMethodChangedListener {
        void onUnlockMethodStateChanged();
    }