Merge branch 'heads/android-14.0.0_r18' into 14-dev
This commit is contained in:
1 parent
32700b0100
commit
cc8f9828ab
756 files changed
+23785
-12235
No files matched your search
@@ -16,6 +16,7 @@
|
||||
package com.android.launcher3.util;
|
||||
|
||||
import static android.provider.Settings.System.HAPTIC_FEEDBACK_ENABLED;
|
||||
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
|
||||
@@ -67,6 +68,9 @@ public class VibratorWrapper {
|
||||
@Nullable
|
||||
private final VibrationEffect mBumpEffect;
|
||||
|
||||
@Nullable
|
||||
private final VibrationEffect mAssistEffect;
|
||||
|
||||
private long mLastDragTime;
|
||||
private final int mThresholdUntilNextDragCallMillis;
|
||||
|
||||
@@ -123,6 +127,19 @@ public class VibratorWrapper {
|
||||
mBumpEffect = null;
|
||||
mThresholdUntilNextDragCallMillis = 0;
|
||||
}
|
||||
|
||||
if (Utilities.ATLEAST_R && mVibrator.areAllPrimitivesSupported(
|
||||
VibrationEffect.Composition.PRIMITIVE_QUICK_RISE,
|
||||
VibrationEffect.Composition.PRIMITIVE_TICK)) {
|
||||
// quiet ramp, short pause, then sharp tick
|
||||
mAssistEffect = VibrationEffect.startComposition()
|
||||
.addPrimitive(VibrationEffect.Composition.PRIMITIVE_QUICK_RISE, 0.25f)
|
||||
.addPrimitive(VibrationEffect.Composition.PRIMITIVE_TICK, 1f, 50)
|
||||
.compose();
|
||||
} else {
|
||||
// fallback for devices without composition support
|
||||
mAssistEffect = VibrationEffect.createPredefined(VibrationEffect.EFFECT_HEAVY_CLICK);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,6 +186,15 @@ public class VibratorWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The assist haptic is used to be called when an assistant is invoked
|
||||
*/
|
||||
public void vibrateForAssist() {
|
||||
if (mAssistEffect != null) {
|
||||
vibrate(mAssistEffect);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This should be used to cancel a haptic in case where the haptic shouldn't be
|
||||
* vibrating. For
|
||||
|
||||
Reference in new issue
Block a user