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

Commit 1ee02141 authored by Kevin Chyn's avatar Kevin Chyn Committed by Android (Google) Code Review
Browse files

Merge "Hide Udfps icon when shade is expanded" into sc-dev

parents bd4c2eab b7b70ace
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