Merge "DO NOT MERGE Revert back to old udfps haptics experience" into sc-v2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
23bedb2676
@@ -595,17 +595,6 @@
|
||||
280
|
||||
</integer>
|
||||
|
||||
<!-- Haptic feedback intensity for ticks used for the udfps dwell time -->
|
||||
<item name="config_udfpsTickIntensity" translatable="false" format="float"
|
||||
type="dimen">.5</item>
|
||||
|
||||
<!-- Haptic feedback delay between ticks used for udfps dwell time -->
|
||||
<integer name="config_udfpsTickDelay" translatable="false">25</integer>
|
||||
|
||||
<!-- Haptic feedback tick type - if true, uses VibrationEffect.Composition.PRIMITIVE_LOW_TICK
|
||||
else uses VibrationEffect.Composition.PRIMITIVE_TICK -->
|
||||
<bool name="config_udfpsUseLowTick">true</bool>
|
||||
|
||||
<!-- package name of a built-in camera app to use to restrict implicit intent resolution
|
||||
when the double-press power gesture is used. Ignored if empty. -->
|
||||
<string translatable="false" name="config_cameraGesturePackage"></string>
|
||||
|
||||
@@ -35,7 +35,6 @@ import android.hardware.biometrics.SensorLocationInternal;
|
||||
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
|
||||
import android.media.AudioAttributes;
|
||||
import android.os.Process;
|
||||
import android.os.VibrationEffect;
|
||||
import android.os.Vibrator;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
@@ -119,7 +118,6 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
|
||||
private VelocityTracker mVelocityTracker;
|
||||
// The ID of the pointer for which ACTION_DOWN has occurred. -1 means no pointer is active.
|
||||
private int mActivePointerId = -1;
|
||||
private VibrationEffect mTick;
|
||||
|
||||
private boolean mIsDozing;
|
||||
private boolean mIsBouncerShowing;
|
||||
@@ -597,15 +595,11 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
case MotionEvent.ACTION_HOVER_ENTER:
|
||||
if (mVibrator != null && !mDownDetected) {
|
||||
if (mTick == null) {
|
||||
mTick = UdfpsController.lowTick(getContext(), true,
|
||||
LONG_PRESS_TIMEOUT);
|
||||
}
|
||||
mVibrator.vibrate(
|
||||
Process.myUid(),
|
||||
getContext().getOpPackageName(),
|
||||
mTick,
|
||||
"lock-icon-tick",
|
||||
UdfpsController.EFFECT_CLICK,
|
||||
"lock-icon-down",
|
||||
VIBRATION_SONIFICATION_ATTRIBUTES);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ import android.os.RemoteException;
|
||||
import android.os.Trace;
|
||||
import android.os.VibrationEffect;
|
||||
import android.os.Vibrator;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -165,9 +164,6 @@ public class UdfpsController implements DozeReceiver {
|
||||
private boolean mAttemptedToDismissKeyguard;
|
||||
private Set<Callback> mCallbacks = new HashSet<>();
|
||||
|
||||
private static final int DEFAULT_TICK = VibrationEffect.Composition.PRIMITIVE_LOW_TICK;
|
||||
private final VibrationEffect mTick;
|
||||
|
||||
@VisibleForTesting
|
||||
public static final AudioAttributes VIBRATION_SONIFICATION_ATTRIBUTES =
|
||||
new AudioAttributes.Builder()
|
||||
@@ -282,9 +278,6 @@ public class UdfpsController implements DozeReceiver {
|
||||
return;
|
||||
}
|
||||
mGoodCaptureReceived = true;
|
||||
if (mVibrator != null) {
|
||||
mVibrator.cancel();
|
||||
}
|
||||
mView.stopIllumination();
|
||||
if (mServerRequest != null) {
|
||||
mServerRequest.onAcquiredGood();
|
||||
@@ -586,7 +579,6 @@ public class UdfpsController implements DozeReceiver {
|
||||
mConfigurationController = configurationController;
|
||||
mSystemClock = systemClock;
|
||||
mUnlockedScreenOffAnimationController = unlockedScreenOffAnimationController;
|
||||
mTick = lowTick(context, false /* useShortRampup */, DEFAULT_VIBRATION_DURATION);
|
||||
|
||||
mSensorProps = findFirstUdfps();
|
||||
// At least one UDFPS sensor exists
|
||||
@@ -621,47 +613,6 @@ public class UdfpsController implements DozeReceiver {
|
||||
udfpsHapticsSimulator.setUdfpsController(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the continuous low tick effect that starts playing on the udfps finger-down event.
|
||||
*/
|
||||
public static VibrationEffect lowTick(
|
||||
Context context,
|
||||
boolean useShortRampUp,
|
||||
long duration
|
||||
) {
|
||||
boolean useLowTickDefault = context.getResources()
|
||||
.getBoolean(R.bool.config_udfpsUseLowTick);
|
||||
int primitiveTick = DEFAULT_TICK;
|
||||
if (Settings.Global.getFloat(
|
||||
context.getContentResolver(),
|
||||
"tick-low", useLowTickDefault ? 1 : 0) == 0) {
|
||||
primitiveTick = VibrationEffect.Composition.PRIMITIVE_TICK;
|
||||
}
|
||||
float tickIntensity = Settings.Global.getFloat(
|
||||
context.getContentResolver(),
|
||||
"tick-intensity",
|
||||
context.getResources().getFloat(R.dimen.config_udfpsTickIntensity));
|
||||
int tickDelay = Settings.Global.getInt(
|
||||
context.getContentResolver(),
|
||||
"tick-delay",
|
||||
context.getResources().getInteger(R.integer.config_udfpsTickDelay));
|
||||
|
||||
VibrationEffect.Composition composition = VibrationEffect.startComposition();
|
||||
composition.addPrimitive(primitiveTick, tickIntensity, 0);
|
||||
int primitives = (int) (duration / tickDelay);
|
||||
float[] rampUp = new float[]{.48f, .58f, .69f, .83f};
|
||||
if (useShortRampUp) {
|
||||
rampUp = new float[]{.5f, .7f};
|
||||
}
|
||||
for (int i = 0; i < rampUp.length; i++) {
|
||||
composition.addPrimitive(primitiveTick, tickIntensity * rampUp[i], tickDelay);
|
||||
}
|
||||
for (int i = rampUp.length; i < primitives; i++) {
|
||||
composition.addPrimitive(primitiveTick, tickIntensity, tickDelay);
|
||||
}
|
||||
return composition.compose();
|
||||
}
|
||||
|
||||
/**
|
||||
* Play haptic to signal udfps scanning started.
|
||||
*/
|
||||
@@ -671,8 +622,8 @@ public class UdfpsController implements DozeReceiver {
|
||||
mVibrator.vibrate(
|
||||
Process.myUid(),
|
||||
mContext.getOpPackageName(),
|
||||
mTick,
|
||||
"udfps-onStart-tick",
|
||||
EFFECT_CLICK,
|
||||
"udfps-onStart-click",
|
||||
VIBRATION_SONIFICATION_ATTRIBUTES);
|
||||
}
|
||||
}
|
||||
@@ -1059,7 +1010,6 @@ public class UdfpsController implements DozeReceiver {
|
||||
}
|
||||
}
|
||||
mOnFingerDown = false;
|
||||
mVibrator.cancel();
|
||||
if (mView.isIlluminationRequested()) {
|
||||
mView.stopIllumination();
|
||||
}
|
||||
|
||||
@@ -642,12 +642,12 @@ public class UdfpsControllerTest extends SysuiTestCase {
|
||||
mTouchListenerCaptor.getValue().onTouch(mUdfpsView, moveEvent);
|
||||
moveEvent.recycle();
|
||||
|
||||
// THEN low-tick haptic is played
|
||||
// THEN click haptic is played
|
||||
verify(mVibrator).vibrate(
|
||||
anyInt(),
|
||||
anyString(),
|
||||
any(),
|
||||
eq("udfps-onStart-tick"),
|
||||
eq("udfps-onStart-click"),
|
||||
eq(UdfpsController.VIBRATION_SONIFICATION_ATTRIBUTES));
|
||||
|
||||
// THEN make sure vibration attributes has so that it always will play the haptic,
|
||||
|
||||
Reference in New Issue
Block a user