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

Commit 9a3248ce authored by Kevin Chyn's avatar Kevin Chyn Committed by Automerger Merge Worker
Browse files

Merge "Hide Udfps icon when shade is expanded" into sc-dev am: 1ee02141

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13411519

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Icf4f89689a04a1a0cb7cf095813b8c2d7341cac3
parents 43e4e7c1 1ee02141
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -47,4 +47,9 @@ public abstract class UdfpsAnimation extends Drawable {
                (int) sensorRect.right - margin,
                (int) sensorRect.bottom - margin);
    }

    @Override
    public void setAlpha(int alpha) {
        mFingerprintDrawable.setAlpha(alpha);
    }
}
+17 −2
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@ import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.android.internal.graphics.ColorUtils;
import com.android.settingslib.Utils;
import com.android.systemui.R;

/**
@@ -36,8 +38,11 @@ import com.android.systemui.R;
public class UdfpsAnimationEnroll extends UdfpsAnimation {
    private static final String TAG = "UdfpsAnimationEnroll";

    private static final float SHADOW_RADIUS = 5.f;

    @Nullable private RectF mSensorRect;
    @NonNull private final Paint mSensorPaint;
    private final int mNotificationShadeColor;

    UdfpsAnimationEnroll(@NonNull Context context) {
        super(context);
@@ -45,8 +50,11 @@ public class UdfpsAnimationEnroll extends UdfpsAnimation {
        mSensorPaint = new Paint(0 /* flags */);
        mSensorPaint.setAntiAlias(true);
        mSensorPaint.setColor(Color.WHITE);
        mSensorPaint.setShadowLayer(UdfpsView.SENSOR_SHADOW_RADIUS, 0, 0, Color.BLACK);
        mSensorPaint.setShadowLayer(SHADOW_RADIUS, 0, 0, Color.BLACK);
        mSensorPaint.setStyle(Paint.Style.FILL);

        mNotificationShadeColor = Utils.getColorAttr(context,
                android.R.attr.colorBackgroundFloating).getDefaultColor();
    }

    @Override
@@ -74,7 +82,14 @@ public class UdfpsAnimationEnroll extends UdfpsAnimation {

    @Override
    public void setAlpha(int alpha) {

        super.setAlpha(alpha);

        // Gradually fade into the notification shade color. This needs to be done because the
        // UDFPS view is drawn on a layer on top of the notification shade
        final float percent = alpha / 255.f;
        mSensorPaint.setColor(ColorUtils.blendARGB(mNotificationShadeColor, Color.WHITE, percent));
        mSensorPaint.setShadowLayer(SHADOW_RADIUS, 0, 0,
                ColorUtils.blendARGB(mNotificationShadeColor, Color.BLACK, percent));
    }

    @Override
+0 −5
Original line number Diff line number Diff line
@@ -43,11 +43,6 @@ public class UdfpsAnimationFpmOther extends UdfpsAnimation {
        mFingerprintDrawable.draw(canvas);
    }

    @Override
    public void setAlpha(int alpha) {

    }

    @Override
    public void setColorFilter(@Nullable ColorFilter colorFilter) {

+0 −5
Original line number Diff line number Diff line
@@ -98,11 +98,6 @@ public class UdfpsAnimationKeyguard extends UdfpsAnimation implements DozeReceiv
        canvas.restore();
    }

    @Override
    public void setAlpha(int alpha) {

    }

    @Override
    public void setColorFilter(@Nullable ColorFilter colorFilter) {

+5 −1
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ import com.android.systemui.R;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.doze.DozeReceiver;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.phone.ScrimController;
import com.android.systemui.util.concurrency.DelayableExecutor;
import com.android.systemui.util.settings.SystemSettings;

@@ -184,7 +185,8 @@ class UdfpsController implements DozeReceiver {
            WindowManager windowManager,
            SystemSettings systemSettings,
            @NonNull StatusBarStateController statusBarStateController,
            @Main DelayableExecutor fgExecutor) {
            @Main DelayableExecutor fgExecutor,
            @NonNull ScrimController scrimController) {
        mContext = context;
        // The fingerprint manager is queried for UDFPS before this class is constructed, so the
        // fingerprint manager should never be null.
@@ -220,6 +222,8 @@ class UdfpsController implements DozeReceiver {

        mHbmSupported = !TextUtils.isEmpty(mHbmPath);
        mView.setHbmSupported(mHbmSupported);
        scrimController.addScrimChangedListener(mView);
        statusBarStateController.addCallback(mView);

        // This range only consists of the minimum and maximum values, which only cover
        // non-high-brightness mode.
Loading