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

Commit 1c38e6dc authored by Beverly's avatar Beverly
Browse files

Updates for co-ex

- Hint fp icon after face auth fail
- Rename StatusBarKeygaurdViewManager.AlternateAuthInterceptor methods
to clarify it is showing/hiding an alt auth bouncer
- Update SystemUI fingerprint icon resource
- Re-enable burn-in offsets for keyguard fingerprint icon
- Animate fingerprint stroke AOD <=> LS
- Coex: DisabledUdfpsController will show an unlock icon if face auth
has authenticated and bypass is disabled
- Don't listen for udfps if canDismissLockscreen

Test: manual
Test: atest KeyguardUpdateMonitorTest UdfpsControllerTest
UdfpsKeyguardViewControllerTest
Bug: 184183899
Bug: 183910378
Bug: 178418596

Change-Id: I6b108aae708e39f8ab6c1894787b0de415153e3b
parent af4aea5f
Loading
Loading
Loading
Loading
+19 −39
Original line number Diff line number Diff line
@@ -15,45 +15,25 @@
-->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="32dp"
        android:height="32dp"
        android:width="72dp"
        android:height="72dp"
        android:tint="?attr/wallpaperTextColor"
        android:alpha=".75"
        android:viewportHeight="32.0"
        android:viewportWidth="32.0">
        android:viewportWidth="72"
        android:viewportHeight="72">
    <path
        android:fillColor="#ffffff"
        android:pathData="M23.7,5.9c-0.1,0.0 -0.2,0.0 -0.3,-0.1C21.0,4.5 18.6,3.9 16.0,3.9c-2.5,0.0
         -4.6,0.6 -6.9,1.9C8.8,6.0 8.3,5.9 8.1,5.5C7.9,5.2 8.0,4.7 8.4,4.5c2.5,-1.4 4.9,-2.1 7.7,
         -2.1c2.8,0.0 5.4,0.7 8.0,2.1c0.4,0.2 0.5,0.6 0.3,1.0C24.2,5.7 24.0,5.9 23.7,5.9z" />
    <path
        android:fillColor="#ffffff"
        android:pathData="M5.3,13.2c-0.1,0.0 -0.3,0.0 -0.4,-0.1c-0.3,-0.2 -0.4,-0.7 -0.2,-1.0c1.3,
        -1.9 2.9,-3.4 4.9,-4.5c4.1,-2.2 9.3,-2.2 13.4,0.0c1.9,1.1 3.6,2.5 4.9,4.4c0.2,0.3 0.1,0.8
        -0.2,1.0c-0.3,0.2 -0.8,0.1 -1.0,-0.2c-1.2,-1.7 -2.6,-3.0 -4.3,-4.0c-3.7,-2.0 -8.3,-2.0
         -12.0,0.0c-1.7,0.9 -3.2,2.3 -4.3,4.0C5.7,13.1 5.5,13.2 5.3,13.2z" />
    <path
        android:fillColor="#ffffff"
        android:pathData="M13.3,29.6c-0.2,0.0 -0.4,-0.1 -0.5,-0.2c-1.1,-1.2 -1.7,-2.0 -2.6,
        -3.6c-0.9,-1.7 -1.4,-3.7 -1.4,-5.9c0.0,-4.1 3.3,-7.4 7.4,-7.4c4.1,0.0 7.4,3.3 7.4,7.4c0.0,
        0.4 -0.3,0.7 -0.7,0.7s-0.7,-0.3 -0.7,-0.7c0.0,-3.3 -2.7,-5.9 -5.9,-5.9c-3.3,0.0 -5.9,
        2.7 -5.9,5.9c0.0,2.0 0.4,3.8 1.2,5.2c0.8,1.6 1.4,2.2 2.4,3.3c0.3,0.3 0.3,0.8 0.0,1.0
        C13.7,29.5 13.5,29.6 13.3,29.6z" />
    <path
        android:fillColor="#ffffff"
        android:pathData="M22.6,27.1c-1.6,0.0 -2.9,-0.4 -4.1,-1.2c-1.9,-1.4 -3.1,-3.6 -3.1,
        -6.0c0.0,-0.4 0.3,-0.7 0.7,-0.7s0.7,0.3 0.7,0.7c0.0,1.9 0.9,3.7 2.5,4.8c0.9,0.6 1.9,
        1.0 3.2,1.0c0.3,0.0 0.8,0.0 1.3,-0.1c0.4,-0.1 0.8,0.2 0.8,0.6c0.1,0.4 -0.2,0.8 -0.6,
        0.8C23.4,27.1 22.8,27.1 22.6,27.1z" />
    <path
        android:fillColor="#ffffff"
        android:pathData="M20.0,29.9c-0.1,0.0 -0.1,0.0 -0.2,0.0c-2.1,-0.6 -3.4,-1.4 -4.8,-2.9c-1.8,
        -1.9 -2.8,-4.4 -2.8,-7.1c0.0,-2.2 1.8,-4.1 4.1,-4.1c2.2,0.0 4.1,1.8 4.1,4.1c0.0,1.4 1.2,
        2.6 2.6,2.6c1.4,0.0 2.6,-1.2 2.6,-2.6c0.0,-5.1 -4.2,-9.3 -9.3,-9.3c-3.6,0.0 -6.9,2.1 -8.4,
        5.4C7.3,17.1 7.0,18.4 7.0,19.8c0.0,1.1 0.1,2.7 0.9,4.9c0.1,0.4 -0.1,0.8 -0.4,0.9c-0.4,
        0.1 -0.8,-0.1 -0.9,-0.4c-0.6,-1.8 -0.9,-3.6 -0.9,-5.4c0.0,-1.6 0.3,-3.1 0.9,-4.4c1.7,
        -3.8 5.6,-6.3 9.8,-6.3c5.9,0.0 10.7,4.8 10.7,10.7c0.0,2.2 -1.8,4.1 -4.1,4.1s-4.0,
        -1.8 -4.0,-4.1c0.0,-1.4 -1.2,-2.6 -2.6,-2.6c-1.4,0.0 -2.6,1.2 -2.6,2.6c0.0,2.3 0.9,
        4.5 2.4,6.1c1.2,1.3 2.4,2.0 4.2,2.5c0.4,0.1 0.6,0.5 0.5,0.9C20.6,29.7 20.3,29.9 20.0,
        29.9z" />
        android:pathData=
            "M25.5,16.3283C28.47,14.8433 31.9167,14 35.5834,14C39.2501,14 42.6968,
            14.8433 45.6668,16.3283
            M20,28.6669C22.7683,24.3402 28.7084,21.3335 35.5834,21.3335C42.4585,
            21.3335 48.3985,24.3402 51.1669,28.6669
            M22.8607,47.0002C21.834,44.3235 21.834,41.5002 21.834,41.5002C21.834,
            34.4051 27.7374,28.6667 35.5841,28.6667C43.4308,28.6667 49.3341,34.4051 49.3341,41.5002
            M49.3344,41.5003V42.0319C49.3344,44.7636 47.1161,47.0003 44.3661,47.0003C41.9461,
            47.0003 39.8744,45.2403 39.471,42.857L38.9577,39.7769C38.591,37.5953 36.7027,
            36.0002 34.5027,36.0002C26.5826,36.0002 29.846,49.1087 35.291,50.6487
            M44.9713,54.6267C42.5513,56.7167 39.2879,58.0001 35.5846,58.0001C32.2296,
            58.0001 29.2229,56.9551 26.8945,55.195"
        android:strokeWidth="3"
        android:strokeColor="#ffffff"
        android:strokeLineCap="round"/>
</vector>
 No newline at end of file
+0 −2
Original line number Diff line number Diff line
@@ -16,9 +16,7 @@
  -->
<com.android.keyguard.DisabledUdfpsView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:systemui="http://schemas.android.com/apk/res-auto"
    android:id="@+id/disabled_udfps_view"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/circle_white"
/>
+15 −0
Original line number Diff line number Diff line
@@ -606,6 +606,21 @@
    <!-- Determines whether the shell features all run on another thread. -->
    <bool name="config_enableShellMainThread">false</bool>

    <!-- Default udfps icon. Same path as ic_fingerprint.xml -->
    <string name="config_udfpsIcon" translatable="false">
        M25.5,16.3283C28.47,14.8433 31.9167,14 35.5834,14C39.2501,14 42.6968,14.8433 45.6668,16.3283
        M20,28.6669C22.7683,24.3402 28.7084,21.3335 35.5834,21.3335C42.4585,21.3335 48.3985,
        24.3402 51.1669,28.6669
        M22.8607,47.0002C21.834,44.3235 21.834,41.5002 21.834,41.5002C21.834,
        34.4051 27.7374,28.6667 35.5841,28.6667C43.4308,28.6667 49.3341,34.4051 49.3341,41.5002
        M49.3344,41.5003V42.0319C49.3344,44.7636 47.1161,47.0003 44.3661,47.0003C41.9461,
        47.0003 39.8744,45.2403 39.471,42.857L38.9577,
        39.7769C38.591,37.5953 36.7027,36.0002 34.5027,
        36.0002C26.5826,36.0002 29.846,49.1087 35.291,50.6487
        M44.9713,54.6267C42.5513,56.7167 39.2879,58.0001 35.5846,58.0001C32.2296,
        58.0001 29.2229,56.9551 26.8945,55.195
    </string>

    <!-- package name of a built-in camera app to use to restrict implicit intent resolution
         when the double-press power gesture is used. Ignored if empty. -->
    <string translatable="false" name="config_cameraGesturePackage"></string>
+4 −1
Original line number Diff line number Diff line
@@ -1085,7 +1085,7 @@

    <!-- The maximum offset for the under-display fingerprint sensor (UDFPS) icon in either
         direction that elements aer moved to prevent burn-in on AOD-->
    <dimen name="udfps_burn_in_offset_x">8dp</dimen>
    <dimen name="udfps_burn_in_offset_x">2dp</dimen>
    <dimen name="udfps_burn_in_offset_y">8dp</dimen>

    <dimen name="corner_size">8dp</dimen>
@@ -1401,6 +1401,9 @@
    <!-- rounded_slider_track_width / 2 -->
    <dimen name="rounded_slider_track_corner_radius">4dp</dimen>

    <!-- inset for ic_lock_open within a DisabledUdfpsView -->
    <dimen name="udfps_unlock_icon_inset">16dp</dimen>

    <!-- Location on the screen of the center of the physical power button. This is a reasonable
    default that should be overridden by device-specific overlays. -->
    <dimen name="physical_power_button_center_screen_location_y">620px</dimen>
+70 −35
Original line number Diff line number Diff line
@@ -18,27 +18,31 @@ package com.android.keyguard;

import static android.hardware.biometrics.BiometricSourceType.FINGERPRINT;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.InsetDrawable;
import android.hardware.biometrics.BiometricSourceType;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;

import com.android.settingslib.Utils;
import com.android.systemui.Dumpable;
import com.android.systemui.R;
import com.android.systemui.biometrics.AuthController;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.util.ViewController;

import java.io.FileDescriptor;
import java.io.PrintWriter;

/**
 * Controls when to show the DisabledUdfpsView to unlock the device on the lockscreen.
 * If the device is not authenticated, the bouncer will show.
 * Controls when to show the DisabledUdfpsView affordance (unlock icon or circle) on lock screen.
 *
 * This tap target will only show when:
 * This view only exists when:
 * - User has UDFPS enrolled
 * - UDFPS is currently unavailable see {@link KeyguardUpdateMonitor#shouldListenForUdfps}
 */
@@ -47,21 +51,26 @@ public class DisabledUdfpsController extends ViewController<DisabledUdfpsView> i
    @NonNull private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
    @NonNull private final KeyguardViewController mKeyguardViewController;
    @NonNull private final StatusBarStateController mStatusBarStateController;
    @NonNull private final KeyguardStateController mKeyguardStateController;
    @NonNull private final Drawable mButton;
    @NonNull private final Drawable mUnlockIcon;

    private boolean mIsDozing;
    private boolean mIsBouncerShowing;
    private boolean mIsKeyguardShowing;
    private boolean mRunningFPS;
    private boolean mAuthenticated;
    private boolean mCanDismissLockScreen;

    private boolean mShowButton;
    private boolean mShowUnlockIcon;

    public DisabledUdfpsController(
            @NonNull DisabledUdfpsView view,
            @NonNull StatusBarStateController statusBarStateController,
            @NonNull KeyguardUpdateMonitor keyguardUpdateMonitor,
            @NonNull AuthController authController,
            @NonNull KeyguardViewController keyguardViewController
            @NonNull KeyguardViewController keyguardViewController,
            @NonNull KeyguardStateController keyguardStateController
    ) {
        super(view);
        mView.setOnClickListener(mOnClickListener);
@@ -70,25 +79,38 @@ public class DisabledUdfpsController extends ViewController<DisabledUdfpsView> i
        mStatusBarStateController = statusBarStateController;
        mKeyguardUpdateMonitor = keyguardUpdateMonitor;
        mKeyguardViewController = keyguardViewController;
        mKeyguardStateController = keyguardStateController;

        final Context context = view.getContext();
        mButton = context.getResources().getDrawable(
                com.android.systemui.R.drawable.circle_white, context.getTheme());
        mUnlockIcon = new InsetDrawable(context.getResources().getDrawable(
                com.android.internal.R.drawable.ic_lock_open, context.getTheme()),
                context.getResources().getDimensionPixelSize(
                        com.android.systemui.R.dimen.udfps_unlock_icon_inset));
    }

    @Override
    protected void onViewAttached() {
        mIsBouncerShowing = mKeyguardViewController.isBouncerShowing();
        mIsKeyguardShowing = mStatusBarStateController.getState() == StatusBarState.KEYGUARD;
        mIsKeyguardShowing = mKeyguardStateController.isShowing();
        mIsDozing = mStatusBarStateController.isDozing();
        mRunningFPS = mKeyguardUpdateMonitor.isFingerprintDetectionRunning();
        mAuthenticated = false;
        updateButtonVisibility();
        mCanDismissLockScreen = mKeyguardStateController.canDismissLockScreen();
        mUnlockIcon.setTint(Utils.getColorAttrDefaultColor(mView.getContext(),
                R.attr.wallpaperTextColorAccent));
        updateVisibility();

        mKeyguardUpdateMonitor.registerCallback(mKeyguardUpdateMonitorCallback);
        mStatusBarStateController.addCallback(mStatusBarStateListener);
        mKeyguardStateController.addCallback(mKeyguardStateCallback);
    }

    @Override
    protected void onViewDetached() {
        mKeyguardUpdateMonitor.removeCallback(mKeyguardUpdateMonitorCallback);
        mStatusBarStateController.removeCallback(mStatusBarStateListener);
        mKeyguardStateController.removeCallback(mKeyguardStateCallback);
    }

    /**
@@ -100,46 +122,51 @@ public class DisabledUdfpsController extends ViewController<DisabledUdfpsView> i
        }
    }

    private void updateButtonVisibility() {
        mShowButton = !mAuthenticated && !mIsDozing && mIsKeyguardShowing
                && !mIsBouncerShowing && !mRunningFPS;
    private void updateVisibility() {
        mShowButton = !mCanDismissLockScreen && !mRunningFPS && isLockScreen();
        mShowUnlockIcon = mCanDismissLockScreen && isLockScreen();

        if (mShowButton) {
            mView.setImageDrawable(mButton);
            mView.setVisibility(View.VISIBLE);
        } else if (mShowUnlockIcon) {
            mView.setImageDrawable(mUnlockIcon);
            mView.setVisibility(View.VISIBLE);
        } else {
            mView.setVisibility(View.INVISIBLE);
        }
    }

    private boolean isLockScreen() {
        return mIsKeyguardShowing && !mIsDozing && !mIsBouncerShowing;
    }

    @Override
    public void dump(@NonNull FileDescriptor fd, @NonNull PrintWriter pw, @NonNull String[] args) {
        pw.println("DisabledUdfpsController state:");
        pw.println("  mShowBouncerButton: " + mShowButton);
        pw.println("  mShowUnlockIcon: " + mShowUnlockIcon);
        pw.println("  mIsDozing: " + mIsDozing);
        pw.println("  mIsKeyguardShowing: " + mIsKeyguardShowing);
        pw.println("  mIsBouncerShowing: " + mIsBouncerShowing);
        pw.println("  mRunningFPS: " + mRunningFPS);
        pw.println("  mAuthenticated: " + mAuthenticated);
        pw.println("  mCanDismissLockScreen: " + mCanDismissLockScreen);
    }

    private final View.OnClickListener mOnClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            // if the device is locked, shows bouncer, else goes to launcher
            mKeyguardViewController.showBouncer(/* scrim */ true);
        }
    };

    private StatusBarStateController.StateListener mStatusBarStateListener =
            new StatusBarStateController.StateListener() {
                @Override
                public void onStateChanged(int newState) {
                    mIsKeyguardShowing = newState == StatusBarState.KEYGUARD;
                    updateButtonVisibility();
                }

                @Override
                public void onDozingChanged(boolean isDozing) {
                    mIsDozing = isDozing;
                    updateButtonVisibility();
                    updateVisibility();
                }
            };

@@ -148,7 +175,7 @@ public class DisabledUdfpsController extends ViewController<DisabledUdfpsView> i
                @Override
                public void onKeyguardBouncerChanged(boolean bouncer) {
                    mIsBouncerShowing = bouncer;
                    updateButtonVisibility();
                    updateVisibility();
                }

                @Override
@@ -157,21 +184,29 @@ public class DisabledUdfpsController extends ViewController<DisabledUdfpsView> i
                    if (biometricSourceType == FINGERPRINT) {
                        mRunningFPS = running;
                    }
                    mAuthenticated &= !mRunningFPS;
                    updateButtonVisibility();

                    updateVisibility();
                }
            };

    private final KeyguardStateController.Callback mKeyguardStateCallback =
            new KeyguardStateController.Callback() {
        @Override
                public void onBiometricAuthenticated(int userId,
                        BiometricSourceType biometricSourceType, boolean isStrongBiometric) {
                    mAuthenticated = true;
                    updateButtonVisibility();
        public void onKeyguardShowingChanged() {
            updateIsKeyguardShowing();
            updateVisibility();
        }

        @Override
                public void onUserUnlocked() {
                    mAuthenticated = true;
                    updateButtonVisibility();
        public void onUnlockedChanged() {
            updateIsKeyguardShowing();
            mCanDismissLockScreen = mKeyguardStateController.canDismissLockScreen();
            updateVisibility();
        }

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