Merge changes I5d467e8e,I5795f5ad into sc-dev
* changes: Trigger udfps-start haptic on the first fingerDown Remove test haptics for UX
This commit is contained in:
committed by
Android (Google) Code Review
commit
e684a19bbb
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.android.server.biometrics.sensors.fingerprint.aidl;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.app.TaskStackListener;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.hardware.biometrics.BiometricAuthenticator;
|
||||
import android.hardware.biometrics.BiometricFingerprintConstants;
|
||||
@@ -30,7 +29,6 @@ import android.hardware.biometrics.fingerprint.ISession;
|
||||
import android.hardware.fingerprint.IUdfpsOverlayController;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.provider.Settings;
|
||||
import android.util.Slog;
|
||||
|
||||
import com.android.server.biometrics.Utils;
|
||||
@@ -57,9 +55,6 @@ class FingerprintAuthenticationClient extends AuthenticationClient<ISession> imp
|
||||
@Nullable private final IUdfpsOverlayController mUdfpsOverlayController;
|
||||
@Nullable private ICancellationSignal mCancellationSignal;
|
||||
|
||||
@NonNull private final ContentResolver mContentResolver;
|
||||
private final boolean mCustomHaptics;
|
||||
|
||||
FingerprintAuthenticationClient(@NonNull Context context,
|
||||
@NonNull LazyDaemon<ISession> lazyDaemon, @NonNull IBinder token,
|
||||
@NonNull ClientMonitorCallbackConverter listener, int targetUserId, long operationId,
|
||||
@@ -74,10 +69,6 @@ class FingerprintAuthenticationClient extends AuthenticationClient<ISession> imp
|
||||
lockoutCache, allowBackgroundAuthentication);
|
||||
mLockoutCache = lockoutCache;
|
||||
mUdfpsOverlayController = udfpsOverlayController;
|
||||
|
||||
mContentResolver = context.getContentResolver();
|
||||
mCustomHaptics = Settings.Global.getInt(mContentResolver,
|
||||
"fp_custom_success_error", 0) == 1;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@@ -213,18 +204,4 @@ class FingerprintAuthenticationClient extends AuthenticationClient<ISession> imp
|
||||
UdfpsHelper.hideUdfpsOverlay(getSensorId(), mUdfpsOverlayController);
|
||||
mCallback.onClientFinished(this, false /* success */);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean successHapticsEnabled() {
|
||||
return mCustomHaptics
|
||||
? Settings.Global.getInt(mContentResolver, "fp_success_enabled", 1) == 0
|
||||
: super.successHapticsEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean errorHapticsEnabled() {
|
||||
return mCustomHaptics
|
||||
? Settings.Global.getInt(mContentResolver, "fp_error_enabled", 1) == 0
|
||||
: super.errorHapticsEnabled();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user