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

Commit 4417c142 authored by Ilya Matyukhin's avatar Ilya Matyukhin Committed by Automerger Merge Worker
Browse files

Merge "Respect halControlsIllumination provided by the HAL" into tm-d1-dev am:...

Merge "Respect halControlsIllumination provided by the HAL" into tm-d1-dev am: ee6461b6 am: 1e63fae2 am: 0316224c

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



Change-Id: I573411bead5cda52003708004e963b012c989ff5
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 31752e3a 0316224c
Loading
Loading
Loading
Loading
+8 −3
Original line number Original line Diff line number Diff line
@@ -39,6 +39,7 @@ public class FingerprintSensorPropertiesInternal extends SensorPropertiesInterna
     * See {@link FingerprintSensorProperties.SensorType}.
     * See {@link FingerprintSensorProperties.SensorType}.
     */
     */
    public final @FingerprintSensorProperties.SensorType int sensorType;
    public final @FingerprintSensorProperties.SensorType int sensorType;
    public final boolean halControlsIllumination;


    private final List<SensorLocationInternal> mSensorLocations;
    private final List<SensorLocationInternal> mSensorLocations;


@@ -46,6 +47,7 @@ public class FingerprintSensorPropertiesInternal extends SensorPropertiesInterna
            @SensorProperties.Strength int strength, int maxEnrollmentsPerUser,
            @SensorProperties.Strength int strength, int maxEnrollmentsPerUser,
            @NonNull List<ComponentInfoInternal> componentInfo,
            @NonNull List<ComponentInfoInternal> componentInfo,
            @FingerprintSensorProperties.SensorType int sensorType,
            @FingerprintSensorProperties.SensorType int sensorType,
            boolean halControlsIllumination,
            boolean resetLockoutRequiresHardwareAuthToken,
            boolean resetLockoutRequiresHardwareAuthToken,
            @NonNull List<SensorLocationInternal> sensorLocations) {
            @NonNull List<SensorLocationInternal> sensorLocations) {
        // IBiometricsFingerprint@2.1 handles lockout in the framework, so the challenge is not
        // IBiometricsFingerprint@2.1 handles lockout in the framework, so the challenge is not
@@ -55,6 +57,7 @@ public class FingerprintSensorPropertiesInternal extends SensorPropertiesInterna
        super(sensorId, strength, maxEnrollmentsPerUser, componentInfo,
        super(sensorId, strength, maxEnrollmentsPerUser, componentInfo,
            resetLockoutRequiresHardwareAuthToken, false /* resetLockoutRequiresChallenge */);
            resetLockoutRequiresHardwareAuthToken, false /* resetLockoutRequiresChallenge */);
        this.sensorType = sensorType;
        this.sensorType = sensorType;
        this.halControlsIllumination = halControlsIllumination;
        this.mSensorLocations = List.copyOf(sensorLocations);
        this.mSensorLocations = List.copyOf(sensorLocations);
    }
    }


@@ -68,14 +71,15 @@ public class FingerprintSensorPropertiesInternal extends SensorPropertiesInterna
            boolean resetLockoutRequiresHardwareAuthToken) {
            boolean resetLockoutRequiresHardwareAuthToken) {
        // TODO(b/179175438): Value should be provided from the HAL
        // TODO(b/179175438): Value should be provided from the HAL
        this(sensorId, strength, maxEnrollmentsPerUser, componentInfo, sensorType,
        this(sensorId, strength, maxEnrollmentsPerUser, componentInfo, sensorType,
                resetLockoutRequiresHardwareAuthToken, List.of(new SensorLocationInternal(
                false /* halControlsIllumination */, resetLockoutRequiresHardwareAuthToken,
                        "" /* displayId */,  540 /* sensorLocationX */, 1636 /* sensorLocationY */,
                List.of(new SensorLocationInternal("" /* displayId */, 540 /* sensorLocationX */,
                        130 /* sensorRadius */)));
                        1636 /* sensorLocationY */, 130 /* sensorRadius */)));
    }
    }


    protected FingerprintSensorPropertiesInternal(Parcel in) {
    protected FingerprintSensorPropertiesInternal(Parcel in) {
        super(in);
        super(in);
        sensorType = in.readInt();
        sensorType = in.readInt();
        halControlsIllumination = in.readBoolean();
        mSensorLocations = in.createTypedArrayList(SensorLocationInternal.CREATOR);
        mSensorLocations = in.createTypedArrayList(SensorLocationInternal.CREATOR);
    }
    }


@@ -101,6 +105,7 @@ public class FingerprintSensorPropertiesInternal extends SensorPropertiesInterna
    public void writeToParcel(Parcel dest, int flags) {
    public void writeToParcel(Parcel dest, int flags) {
        super.writeToParcel(dest, flags);
        super.writeToParcel(dest, flags);
        dest.writeInt(sensorType);
        dest.writeInt(sensorType);
        dest.writeBoolean(halControlsIllumination);
        dest.writeTypedList(mSensorLocations);
        dest.writeTypedList(mSensorLocations);
    }
    }


+1 −0
Original line number Original line Diff line number Diff line
@@ -278,6 +278,7 @@ public class AuthController extends CoreStartable implements CommandQueue.Callba
                }
                }
            });
            });
            mUdfpsController.setAuthControllerUpdateUdfpsLocation(this::updateUdfpsLocation);
            mUdfpsController.setAuthControllerUpdateUdfpsLocation(this::updateUdfpsLocation);
            mUdfpsController.setHalControlsIllumination(mUdfpsProps.get(0).halControlsIllumination);
            mUdfpsBounds = mUdfpsProps.get(0).getLocation().getRect();
            mUdfpsBounds = mUdfpsProps.get(0).getLocation().getRect();
            updateUdfpsLocation();
            updateUdfpsLocation();
        }
        }
+10 −3
Original line number Original line Diff line number Diff line
@@ -131,6 +131,7 @@ public class UdfpsController implements DozeReceiver {
    // Currently the UdfpsController supports a single UDFPS sensor. If devices have multiple
    // Currently the UdfpsController supports a single UDFPS sensor. If devices have multiple
    // sensors, this, in addition to a lot of the code here, will be updated.
    // sensors, this, in addition to a lot of the code here, will be updated.
    @VisibleForTesting int mSensorId;
    @VisibleForTesting int mSensorId;
    private boolean mHalControlsIllumination;
    @VisibleForTesting @NonNull UdfpsOverlayParams mOverlayParams = new UdfpsOverlayParams();
    @VisibleForTesting @NonNull UdfpsOverlayParams mOverlayParams = new UdfpsOverlayParams();
    // TODO(b/229290039): UDFPS controller should manage its dimensions on its own. Remove this.
    // TODO(b/229290039): UDFPS controller should manage its dimensions on its own. Remove this.
    @Nullable private Runnable mAuthControllerUpdateUdfpsLocation;
    @Nullable private Runnable mAuthControllerUpdateUdfpsLocation;
@@ -201,8 +202,9 @@ public class UdfpsController implements DozeReceiver {
                            mKeyguardUpdateMonitor, mDialogManager, mDumpManager,
                            mKeyguardUpdateMonitor, mDialogManager, mDumpManager,
                            mLockscreenShadeTransitionController, mConfigurationController,
                            mLockscreenShadeTransitionController, mConfigurationController,
                            mSystemClock, mKeyguardStateController,
                            mSystemClock, mKeyguardStateController,
                            mUnlockedScreenOffAnimationController, mHbmProvider, requestId, reason,
                            mUnlockedScreenOffAnimationController, mHalControlsIllumination,
                            callback, (view, event, fromUdfpsView) -> onTouch(requestId, event,
                            mHbmProvider, requestId, reason, callback,
                            (view, event, fromUdfpsView) -> onTouch(requestId, event,
                                    fromUdfpsView), mActivityLaunchAnimator)));
                                    fromUdfpsView), mActivityLaunchAnimator)));
        }
        }


@@ -310,6 +312,11 @@ public class UdfpsController implements DozeReceiver {
        mAuthControllerUpdateUdfpsLocation = r;
        mAuthControllerUpdateUdfpsLocation = r;
    }
    }


    // TODO(b/229290039): UDFPS controller should manage its properties on its own. Remove this.
    public void setHalControlsIllumination(boolean value) {
        mHalControlsIllumination = value;
    }

    /**
    /**
     * Calculate the pointer speed given a velocity tracker and the pointer id.
     * Calculate the pointer speed given a velocity tracker and the pointer id.
     * This assumes that the velocity tracker has already been passed all relevant motion events.
     * This assumes that the velocity tracker has already been passed all relevant motion events.
+2 −0
Original line number Original line Diff line number Diff line
@@ -77,6 +77,7 @@ class UdfpsControllerOverlay(
    private val systemClock: SystemClock,
    private val systemClock: SystemClock,
    private val keyguardStateController: KeyguardStateController,
    private val keyguardStateController: KeyguardStateController,
    private val unlockedScreenOffAnimationController: UnlockedScreenOffAnimationController,
    private val unlockedScreenOffAnimationController: UnlockedScreenOffAnimationController,
    private val halControlsIllumination: Boolean,
    private var hbmProvider: UdfpsHbmProvider,
    private var hbmProvider: UdfpsHbmProvider,
    val requestId: Long,
    val requestId: Long,
    @ShowReason val requestReason: Int,
    @ShowReason val requestReason: Int,
@@ -137,6 +138,7 @@ class UdfpsControllerOverlay(
                    R.layout.udfps_view, null, false
                    R.layout.udfps_view, null, false
                ) as UdfpsView).apply {
                ) as UdfpsView).apply {
                    overlayParams = params
                    overlayParams = params
                    halControlsIllumination = this@UdfpsControllerOverlay.halControlsIllumination
                    setHbmProvider(hbmProvider)
                    setHbmProvider(hbmProvider)
                    val animation = inflateUdfpsAnimation(this, controller)
                    val animation = inflateUdfpsAnimation(this, controller)
                    if (animation != null) {
                    if (animation != null) {
+4 −3
Original line number Original line Diff line number Diff line
@@ -34,8 +34,11 @@ public interface UdfpsHbmProvider {
     * invoked from the UI thread.
     * invoked from the UI thread.
     *
     *
     * @param onHbmEnabled A runnable that will be executed once HBM is enabled.
     * @param onHbmEnabled A runnable that will be executed once HBM is enabled.
     *
     * TODO(b/231335067): enableHbm with halControlsIllumination=true shouldn't make sense.
     *     This only makes sense now because vendor code may rely on the side effects of enableHbm.
     */
     */
    void enableHbm(@Nullable Runnable onHbmEnabled);
    void enableHbm(boolean halControlsIllumination, @Nullable Runnable onHbmEnabled);


    /**
    /**
     * UdfpsView will call this to disable HBM when illumination is no longer needed.
     * UdfpsView will call this to disable HBM when illumination is no longer needed.
@@ -46,8 +49,6 @@ public interface UdfpsHbmProvider {
     * The call must be made from the UI thread. The callback, if provided, will also be invoked
     * The call must be made from the UI thread. The callback, if provided, will also be invoked
     * from the UI thread.
     * from the UI thread.
     *
     *
     *
     *
     * @param onHbmDisabled A runnable that will be executed once HBM is disabled.
     * @param onHbmDisabled A runnable that will be executed once HBM is disabled.
     */
     */
    void disableHbm(@Nullable Runnable onHbmDisabled);
    void disableHbm(@Nullable Runnable onHbmDisabled);
Loading