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

Commit ee6461b6 authored by Ilya Matyukhin's avatar Ilya Matyukhin Committed by Android (Google) Code Review
Browse files

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

parents 130494a4 faae3453
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ public class FingerprintSensorPropertiesInternal extends SensorPropertiesInterna
     * See {@link FingerprintSensorProperties.SensorType}.
     */
    public final @FingerprintSensorProperties.SensorType int sensorType;
    public final boolean halControlsIllumination;

    private final List<SensorLocationInternal> mSensorLocations;

@@ -46,6 +47,7 @@ public class FingerprintSensorPropertiesInternal extends SensorPropertiesInterna
            @SensorProperties.Strength int strength, int maxEnrollmentsPerUser,
            @NonNull List<ComponentInfoInternal> componentInfo,
            @FingerprintSensorProperties.SensorType int sensorType,
            boolean halControlsIllumination,
            boolean resetLockoutRequiresHardwareAuthToken,
            @NonNull List<SensorLocationInternal> sensorLocations) {
        // 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,
            resetLockoutRequiresHardwareAuthToken, false /* resetLockoutRequiresChallenge */);
        this.sensorType = sensorType;
        this.halControlsIllumination = halControlsIllumination;
        this.mSensorLocations = List.copyOf(sensorLocations);
    }

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

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

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

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

@@ -310,6 +312,11 @@ public class UdfpsController implements DozeReceiver {
        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.
     * This assumes that the velocity tracker has already been passed all relevant motion events.
+2 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ class UdfpsControllerOverlay(
    private val systemClock: SystemClock,
    private val keyguardStateController: KeyguardStateController,
    private val unlockedScreenOffAnimationController: UnlockedScreenOffAnimationController,
    private val halControlsIllumination: Boolean,
    private var hbmProvider: UdfpsHbmProvider,
    val requestId: Long,
    @ShowReason val requestReason: Int,
@@ -137,6 +138,7 @@ class UdfpsControllerOverlay(
                    R.layout.udfps_view, null, false
                ) as UdfpsView).apply {
                    overlayParams = params
                    halControlsIllumination = this@UdfpsControllerOverlay.halControlsIllumination
                    setHbmProvider(hbmProvider)
                    val animation = inflateUdfpsAnimation(this, controller)
                    if (animation != null) {
+4 −3
Original line number Diff line number Diff line
@@ -34,8 +34,11 @@ public interface UdfpsHbmProvider {
     * invoked from the UI thread.
     *
     * @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.
@@ -46,8 +49,6 @@ public interface UdfpsHbmProvider {
     * The call must be made from the UI thread. The callback, if provided, will also be invoked
     * from the UI thread.
     *
     *
     *
     * @param onHbmDisabled A runnable that will be executed once HBM is disabled.
     */
    void disableHbm(@Nullable Runnable onHbmDisabled);
Loading