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

Commit 72cc3702 authored by Adrian Roos's avatar Adrian Roos
Browse files

Fix wrong face unlock size

Bug: 17533062
Change-Id: I532d7197fcd59baffd8f6c4e76a9fb8eda389eac
parent a300fca9
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -452,10 +452,14 @@
    <!-- How far the user needs to drag up to invoke search. -->
    <dimen name="search_panel_threshold">100dp</dimen>

    <!-- The width/height of the phone/camera/unlock icon on keyguard. -->
    <!-- The width/height of the phone/camera/unlock icon view on keyguard. -->
    <dimen name="keyguard_affordance_height">56dp</dimen>
    <dimen name="keyguard_affordance_width">56dp</dimen>

    <!-- The width/height of the phone/camera/unlock icon drawable on keyguard. -->
    <dimen name="keyguard_affordance_icon_height">24dp</dimen>
    <dimen name="keyguard_affordance_icon_width">24dp</dimen>

    <dimen name="keyguard_indication_margin_bottom">65dp</dimen>

    <!-- The text size for battery level -->
+41 −1
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@ import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Configuration;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.InsetDrawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.RemoteException;
@@ -91,6 +93,8 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL

    private final TrustDrawable mTrustDrawable;

    private int mLastUnlockIconRes = 0;

    public KeyguardBottomAreaView(Context context) {
        this(context, null);
    }
@@ -380,7 +384,17 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
                ? com.android.internal.R.drawable.ic_account_circle
                : mUnlockMethodCache.isMethodInsecure() ? R.drawable.ic_lock_open_24dp
                : R.drawable.ic_lock_24dp;
        mLockIcon.setImageResource(iconRes);
        if (mLastUnlockIconRes != iconRes) {
            Drawable icon = mContext.getDrawable(iconRes);
            int iconHeight = getResources().getDimensionPixelSize(
                    R.dimen.keyguard_affordance_icon_height);
            int iconWidth = getResources().getDimensionPixelSize(
                    R.dimen.keyguard_affordance_icon_width);
            if (icon.getIntrinsicHeight() != iconHeight || icon.getIntrinsicWidth() != iconWidth) {
                icon = new IntrinsicSizeDrawable(icon, iconWidth, iconHeight);
            }
            mLockIcon.setImageDrawable(icon);
        }
        boolean trustManaged = mUnlockMethodCache.isTrustManaged();
        mTrustDrawable.setTrustManaged(trustManaged);
        updateLockIconClickability();
@@ -469,4 +483,30 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
            KeyguardIndicationController keyguardIndicationController) {
        mIndicationController = keyguardIndicationController;
    }


    /**
     * A wrapper around another Drawable that overrides the intrinsic size.
     */
    private static class IntrinsicSizeDrawable extends InsetDrawable {

        private final int mIntrinsicWidth;
        private final int mIntrinsicHeight;

        public IntrinsicSizeDrawable(Drawable drawable, int intrinsicWidth, int intrinsicHeight) {
            super(drawable, 0);
            mIntrinsicWidth = intrinsicWidth;
            mIntrinsicHeight = intrinsicHeight;
        }

        @Override
        public int getIntrinsicWidth() {
            return mIntrinsicWidth;
        }

        @Override
        public int getIntrinsicHeight() {
            return mIntrinsicHeight;
        }
    }
}