Moving various nav-bar configs out of feature flags
Bug: 332588958 Test: Presubmit Flag: None Change-Id: Ia4dc5b69bcf4d461e3444b9e37bb7334bb74aae4
This commit is contained in:
@@ -19,11 +19,6 @@ import static android.os.VibrationEffect.Composition.PRIMITIVE_LOW_TICK;
|
||||
import static android.os.VibrationEffect.createPredefined;
|
||||
import static android.provider.Settings.System.HAPTIC_FEEDBACK_ENABLED;
|
||||
|
||||
import static com.android.launcher3.config.FeatureFlags.LPNH_HAPTIC_HINT_DELAY;
|
||||
import static com.android.launcher3.config.FeatureFlags.LPNH_HAPTIC_HINT_END_SCALE_PERCENT;
|
||||
import static com.android.launcher3.config.FeatureFlags.LPNH_HAPTIC_HINT_ITERATIONS;
|
||||
import static com.android.launcher3.config.FeatureFlags.LPNH_HAPTIC_HINT_SCALE_EXPONENT;
|
||||
import static com.android.launcher3.config.FeatureFlags.LPNH_HAPTIC_HINT_START_SCALE_PERCENT;
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
|
||||
@@ -40,7 +35,6 @@ import android.provider.Settings;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
|
||||
/**
|
||||
* Wrapper around {@link Vibrator} to easily perform haptic feedback where necessary.
|
||||
@@ -71,9 +65,6 @@ public class VibratorWrapper {
|
||||
@Nullable
|
||||
private final VibrationEffect mBumpEffect;
|
||||
|
||||
@Nullable
|
||||
private final VibrationEffect mSearchEffect;
|
||||
|
||||
private long mLastDragTime;
|
||||
private final int mThresholdUntilNextDragCallMillis;
|
||||
|
||||
@@ -133,25 +124,6 @@ public class VibratorWrapper {
|
||||
mBumpEffect = null;
|
||||
mThresholdUntilNextDragCallMillis = 0;
|
||||
}
|
||||
|
||||
if (mVibrator.areAllPrimitivesSupported(
|
||||
VibrationEffect.Composition.PRIMITIVE_QUICK_RISE,
|
||||
VibrationEffect.Composition.PRIMITIVE_TICK)) {
|
||||
if (FeatureFlags.ENABLE_SEARCH_HAPTIC_HINT.get()) {
|
||||
mSearchEffect = VibrationEffect.startComposition()
|
||||
.addPrimitive(VibrationEffect.Composition.PRIMITIVE_TICK, 1f)
|
||||
.compose();
|
||||
} else {
|
||||
// quiet ramp, short pause, then sharp tick
|
||||
mSearchEffect = 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
|
||||
mSearchEffect = VibrationEffect.createPredefined(VibrationEffect.EFFECT_HEAVY_CLICK);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -233,13 +205,6 @@ public class VibratorWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
/** Indicates that search has been invoked. */
|
||||
public void vibrateForSearch() {
|
||||
if (mSearchEffect != null) {
|
||||
vibrate(mSearchEffect);
|
||||
}
|
||||
}
|
||||
|
||||
/** Indicates that Taskbar has been invoked. */
|
||||
public void vibrateForTaskbarUnstash() {
|
||||
if (Utilities.ATLEAST_S && mVibrator.areAllPrimitivesSupported(PRIMITIVE_LOW_TICK)) {
|
||||
@@ -251,32 +216,4 @@ public class VibratorWrapper {
|
||||
vibrate(primitiveLowTickEffect);
|
||||
}
|
||||
}
|
||||
|
||||
/** Indicates that search will be invoked if the current gesture is maintained. */
|
||||
public void vibrateForSearchHint() {
|
||||
if (FeatureFlags.ENABLE_SEARCH_HAPTIC_HINT.get() && Utilities.ATLEAST_S
|
||||
&& mVibrator.areAllPrimitivesSupported(PRIMITIVE_LOW_TICK)) {
|
||||
float startScale = LPNH_HAPTIC_HINT_START_SCALE_PERCENT.get() / 100f;
|
||||
float endScale = LPNH_HAPTIC_HINT_END_SCALE_PERCENT.get() / 100f;
|
||||
int scaleExponent = LPNH_HAPTIC_HINT_SCALE_EXPONENT.get();
|
||||
int iterations = LPNH_HAPTIC_HINT_ITERATIONS.get();
|
||||
int delayMs = LPNH_HAPTIC_HINT_DELAY.get();
|
||||
|
||||
VibrationEffect.Composition composition = VibrationEffect.startComposition();
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
float t = i / (iterations - 1f);
|
||||
float scale = (float) Math.pow((1 - t) * startScale + t * endScale,
|
||||
scaleExponent);
|
||||
if (i == 0) {
|
||||
// Adds a delay before the ramp starts
|
||||
composition.addPrimitive(PRIMITIVE_LOW_TICK, scale,
|
||||
delayMs);
|
||||
} else {
|
||||
composition.addPrimitive(PRIMITIVE_LOW_TICK, scale);
|
||||
}
|
||||
}
|
||||
|
||||
vibrate(composition.compose());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user