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

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

Merge changes from topic "fix-isUdfps" into sc-dev

* changes:
  Provide default UDFPS location for fake UDFPS
  Remove retry in Fingerprint21 getService
parents 8984325c ace2ea13
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -109,9 +109,10 @@ public class FingerprintSensorPropertiesInternal extends SensorPropertiesInterna
            this.sensorLocationY = props[1];
            this.sensorRadius = props[2];
        } else {
            this.sensorLocationX = 0;
            this.sensorLocationY = 0;
            this.sensorRadius = 0;
            // Fake coordinates that could be used for the fake UDFPS mode.
            this.sensorLocationX = 540;
            this.sensorLocationY = 1636;
            this.sensorRadius = 130;
        }
    }

+8 −16
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ import android.util.proto.ProtoOutputStream;

import com.android.internal.R;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.FrameworkStatsLog;
import com.android.server.biometrics.SensorServiceStateProto;
import com.android.server.biometrics.SensorStateProto;
@@ -113,7 +114,7 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider
    @NonNull private final HalResultController mHalResultController;
    @Nullable private IUdfpsOverlayController mUdfpsOverlayController;
    private int mCurrentUserId = UserHandle.USER_NULL;
    private boolean mIsUdfps = false;
    private final boolean mIsUdfps;
    private final int mSensorId;

    private final class BiometricTaskStackListener extends TaskStackListener {
@@ -335,19 +336,10 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider
            Slog.e(TAG, "Unable to register user switch observer");
        }

        final IBiometricsFingerprint daemon = getDaemon();
        mIsUdfps = false;
        android.hardware.biometrics.fingerprint.V2_3.IBiometricsFingerprint extension =
                android.hardware.biometrics.fingerprint.V2_3.IBiometricsFingerprint.castFrom(
                        daemon);
        if (extension != null) {
            try {
                mIsUdfps = extension.isUdfps(sensorId);
            } catch (RemoteException e) {
                Slog.e(TAG, "Remote exception while quering udfps", e);
                mIsUdfps = false;
            }
        }
        // TODO(b/179175438): Remove this code block after transition to AIDL.
        // The existence of config_udfps_sensor_props indicates that the sensor is UDFPS.
        mIsUdfps = !ArrayUtils.isEmpty(
                mContext.getResources().getIntArray(R.array.config_udfps_sensor_props));

        final @FingerprintSensorProperties.SensorType int sensorType =
                mIsUdfps ? FingerprintSensorProperties.TYPE_UDFPS_OPTICAL
@@ -415,7 +407,7 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider
        Slog.d(TAG, "Daemon was null, reconnecting, current operation: "
                + mScheduler.getCurrentClient());
        try {
            mDaemon = IBiometricsFingerprint.getService(true /* retry */);
            mDaemon = IBiometricsFingerprint.getService();
        } catch (java.util.NoSuchElementException e) {
            // Service doesn't exist or cannot be opened.
            Slog.w(TAG, "NoSuchElementException", e);