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

Commit 42c20d99 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge changes I5d467e8e,I5795f5ad into sc-dev am: e684a19b

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

Change-Id: Iffcf0f694d2d5cbe264ea760b0e845d561ae2e0a
parents 5a058e98 e684a19b
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -285,7 +285,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
    @VisibleForTesting
    protected boolean mTelephonyCapable;

    private final boolean mAcquiredHapticEnabled;
    private final boolean mAcquiredHapticEnabled = false;
    @Nullable private final Vibrator mVibrator;

    // Device provisioning state
@@ -1413,11 +1413,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
    @VisibleForTesting
    public void playAcquiredHaptic() {
        if (mAcquiredHapticEnabled && mVibrator != null) {
            String effect = Settings.Global.getString(
                    mContext.getContentResolver(),
                    "udfps_acquired_type");
            mVibrator.vibrate(UdfpsController.getVibration(effect,
                    UdfpsController.EFFECT_TICK),
            mVibrator.vibrate(UdfpsController.EFFECT_CLICK,
                    UdfpsController.VIBRATION_SONIFICATION_ATTRIBUTES);
        }
    }
@@ -1730,8 +1726,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        mLockPatternUtils = lockPatternUtils;
        mAuthController = authController;
        dumpManager.registerDumpable(getClass().getName(), this);
        mAcquiredHapticEnabled = Settings.Global.getInt(mContext.getContentResolver(),
            "udfps_acquired", 0) == 1;
        mVibrator = vibrator;

        mHandler = new Handler(mainLooper) {
+6 −59
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.systemui.biometrics;

import static android.hardware.fingerprint.IUdfpsOverlayController.REASON_AUTH_FPM_KEYGUARD;
import static android.os.VibrationEffect.Composition.PRIMITIVE_LOW_TICK;

import static com.android.internal.util.Preconditions.checkArgument;
import static com.android.internal.util.Preconditions.checkNotNull;
@@ -27,7 +26,6 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
@@ -47,8 +45,6 @@ import android.os.SystemClock;
import android.os.Trace;
import android.os.VibrationEffect;
import android.os.Vibrator;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
@@ -160,16 +156,8 @@ public class UdfpsController implements DozeReceiver {
                    .setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION)
                    .build();

    public static final VibrationEffect EFFECT_TICK =
            VibrationEffect.get(VibrationEffect.EFFECT_TICK);
    private static final VibrationEffect EFFECT_TEXTURE_TICK =
            VibrationEffect.get(VibrationEffect.EFFECT_TEXTURE_TICK);
    @VisibleForTesting
    static final VibrationEffect EFFECT_CLICK = VibrationEffect.get(VibrationEffect.EFFECT_CLICK);
    private static final VibrationEffect EFFECT_HEAVY =
            VibrationEffect.get(VibrationEffect.EFFECT_HEAVY_CLICK);
    private static final VibrationEffect EFFECT_DOUBLE_CLICK =
            VibrationEffect.get(VibrationEffect.EFFECT_DOUBLE_CLICK);
    public static final VibrationEffect EFFECT_CLICK =
            VibrationEffect.get(VibrationEffect.EFFECT_CLICK);

    private final ScreenLifecycle.Observer mScreenObserver = new ScreenLifecycle.Observer() {
        @Override
@@ -437,7 +425,6 @@ public class UdfpsController implements DozeReceiver {
                            mTouchLogTime = SystemClock.elapsedRealtime();
                            mPowerManager.userActivity(SystemClock.uptimeMillis(),
                                    PowerManager.USER_ACTIVITY_EVENT_TOUCH, 0);
                            playStartHaptic();
                            handled = true;
                        } else if (sinceLastLog >= MIN_TOUCH_LOG_INTERVAL) {
                            Log.v(TAG, "onTouch | finger move: " + touchInfo);
@@ -552,18 +539,7 @@ public class UdfpsController implements DozeReceiver {
    @VisibleForTesting
    public void playStartHaptic() {
        if (mVibrator != null) {
            final ContentResolver contentResolver =
                    mContext.getContentResolver();
            // TODO: these settings checks should eventually be removed after ux testing
            //  (b/185124905)
            int startEnabled = Settings.Global.getInt(contentResolver,
                    "udfps_start", 1);
            if (startEnabled > 0) {
                String startEffectSetting = Settings.Global.getString(
                        contentResolver, "udfps_start_type");
                mVibrator.vibrate(getVibration(startEffectSetting,
                        EFFECT_CLICK), VIBRATION_SONIFICATION_ATTRIBUTES);
            }
            mVibrator.vibrate(EFFECT_CLICK, VIBRATION_SONIFICATION_ATTRIBUTES);
        }
    }

@@ -854,6 +830,9 @@ public class UdfpsController implements DozeReceiver {
            Log.w(TAG, "Null view in onFingerDown");
            return;
        }
        if (!mOnFingerDown) {
            playStartHaptic();
        }
        mOnFingerDown = true;
        mFingerprintManager.onPointerDown(mSensorProps.sensorId, x, y, minor, major);
        Trace.endAsyncSection("UdfpsController.e2e.onPointerDown", 0);
@@ -881,38 +860,6 @@ public class UdfpsController implements DozeReceiver {
        }
    }

    /**
     * get vibration to play given string
     * used for testing purposes (b/185124905)
     */
    public static VibrationEffect getVibration(String effect, VibrationEffect defaultEffect) {
        if (TextUtils.isEmpty(effect)) {
            return defaultEffect;
        }

        switch (effect.toLowerCase()) {
            case "click":
                return EFFECT_CLICK;
            case "heavy":
                return EFFECT_HEAVY;
            case "texture_tick":
                return EFFECT_TEXTURE_TICK;
            case "tick":
                return EFFECT_TICK;
            case "double_tap":
                return EFFECT_DOUBLE_CLICK;
            default:
                try {
                    int primitive = Integer.parseInt(effect);
                    if (primitive <= PRIMITIVE_LOW_TICK && primitive > -1) {
                        return VibrationEffect.startComposition().addPrimitive(primitive).compose();
                    }
                } catch (NumberFormatException e) {
                }
                return defaultEffect;
        }
    }

    private void updateTouchListener() {
        if (mView == null) {
            return;
+0 −14
Original line number Diff line number Diff line
@@ -188,18 +188,7 @@ public abstract class AcquisitionClient<T> extends HalClientMonitor<T> implement
        mPowerManager.userActivity(now, PowerManager.USER_ACTIVITY_EVENT_TOUCH, 0);
    }

    protected boolean successHapticsEnabled() {
        return true;
    }

    protected boolean errorHapticsEnabled() {
        return true;
    }

    protected final void vibrateSuccess() {
        if (!successHapticsEnabled()) {
            return;
        }
        Vibrator vibrator = getContext().getSystemService(Vibrator.class);
        if (vibrator != null) {
            vibrator.vibrate(SUCCESS_VIBRATION_EFFECT, VIBRATION_SONIFICATION_ATTRIBUTES);
@@ -207,9 +196,6 @@ public abstract class AcquisitionClient<T> extends HalClientMonitor<T> implement
    }

    protected final void vibrateError() {
        if (!errorHapticsEnabled()) {
            return;
        }
        Vibrator vibrator = getContext().getSystemService(Vibrator.class);
        if (vibrator != null) {
            vibrator.vibrate(ERROR_VIBRATION_EFFECT, VIBRATION_SONIFICATION_ATTRIBUTES);
+0 −23
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.server.biometrics.sensors.face.aidl;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.NotificationManager;
import android.content.ContentResolver;
import android.content.Context;
import android.content.res.Resources;
import android.hardware.biometrics.BiometricAuthenticator;
@@ -33,7 +32,6 @@ import android.hardware.face.FaceAuthenticationFrame;
import android.hardware.face.FaceManager;
import android.os.IBinder;
import android.os.RemoteException;
import android.provider.Settings;
import android.util.Slog;

import com.android.internal.R;
@@ -59,9 +57,6 @@ class FaceAuthenticationClient extends AuthenticationClient<ISession> implements
    @Nullable private final NotificationManager mNotificationManager;
    @Nullable private ICancellationSignal mCancellationSignal;

    @NonNull private final ContentResolver mContentResolver;
    private final boolean mCustomHaptics;

    private final int[] mBiometricPromptIgnoreList;
    private final int[] mBiometricPromptIgnoreListVendor;
    private final int[] mKeyguardIgnoreList;
@@ -92,10 +87,6 @@ class FaceAuthenticationClient extends AuthenticationClient<ISession> implements
                R.array.config_face_acquire_keyguard_ignorelist);
        mKeyguardIgnoreListVendor = resources.getIntArray(
                R.array.config_face_acquire_vendor_keyguard_ignorelist);

        mContentResolver = context.getContentResolver();
        mCustomHaptics = Settings.Global.getInt(mContentResolver,
                "face_custom_success_error", 0) == 1;
    }

    @NonNull
@@ -261,18 +252,4 @@ class FaceAuthenticationClient extends AuthenticationClient<ISession> implements
            Slog.e(TAG, "Remote exception", e);
        }
    }

    @Override
    protected boolean successHapticsEnabled() {
        return mCustomHaptics
            ? Settings.Global.getInt(mContentResolver, "face_success_enabled", 1) == 0
            : super.successHapticsEnabled();
    }

    @Override
    protected boolean errorHapticsEnabled() {
        return mCustomHaptics
            ? Settings.Global.getInt(mContentResolver, "face_error_enabled", 1) == 0
            : super.errorHapticsEnabled();
    }
}
+0 −22
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.server.biometrics.sensors.face.hidl;

import android.annotation.NonNull;
import android.content.ContentResolver;
import android.content.Context;
import android.content.res.Resources;
import android.hardware.biometrics.BiometricAuthenticator;
@@ -28,7 +27,6 @@ import android.hardware.biometrics.face.V1_0.IBiometricsFace;
import android.hardware.face.FaceManager;
import android.os.IBinder;
import android.os.RemoteException;
import android.provider.Settings;
import android.util.Slog;

import com.android.internal.R;
@@ -49,8 +47,6 @@ class FaceAuthenticationClient extends AuthenticationClient<IBiometricsFace> {

    private static final String TAG = "FaceAuthenticationClient";

    @NonNull private final ContentResolver mContentResolver;
    private final boolean mCustomHaptics;
    private final UsageStats mUsageStats;

    private final int[] mBiometricPromptIgnoreList;
@@ -81,10 +77,6 @@ class FaceAuthenticationClient extends AuthenticationClient<IBiometricsFace> {
                R.array.config_face_acquire_keyguard_ignorelist);
        mKeyguardIgnoreListVendor = resources.getIntArray(
                R.array.config_face_acquire_vendor_keyguard_ignorelist);

        mContentResolver = context.getContentResolver();
        mCustomHaptics = Settings.Global.getInt(mContentResolver,
                "face_custom_success_error", 0) == 1;
    }

    @NonNull
@@ -200,18 +192,4 @@ class FaceAuthenticationClient extends AuthenticationClient<IBiometricsFace> {
        final boolean shouldSend = shouldSend(acquireInfo, vendorCode);
        onAcquiredInternal(acquireInfo, vendorCode, shouldSend);
    }

    @Override
    protected boolean successHapticsEnabled() {
        return mCustomHaptics
            ? Settings.Global.getInt(mContentResolver, "face_success_enabled", 1) == 0
            : super.successHapticsEnabled();
    }

    @Override
    protected boolean errorHapticsEnabled() {
        return mCustomHaptics
            ? Settings.Global.getInt(mContentResolver, "face_error_enabled", 1) == 0
            : super.errorHapticsEnabled();
    }
}
Loading