Remove obsolete features
Flag: EXEMPT legacy ENABLE_TWOLINE_DEVICESEARCH, ENABLE_ICON_IN_TEXT_HEADER, ENABLE_PREMIUM_HAPTICS_ALL_APPS
Bug: 270396358
Bug: 201388851
Bug: 270395143
Test: Verified manually
Change-Id: I88ca7b255d2ae4eba393c1aee52153ef0a459140
diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java
index d1aa472..ff726e6 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java
@@ -42,7 +42,6 @@
import com.android.launcher3.LauncherState;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimatorPlaybackController;
-import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.taskbar.LauncherTaskbarUIController;
import com.android.launcher3.uioverrides.QuickstepLauncher;
@@ -221,11 +220,6 @@
mCancelSplitRunnable.accept(animatorSet, duration);
animatorSet.start();
}
- if (FeatureFlags.ENABLE_PREMIUM_HAPTICS_ALL_APPS.get() &&
- ((mFromState == NORMAL && mToState == ALL_APPS)
- || (mFromState == ALL_APPS && mToState == NORMAL)) && isFling) {
- mVibratorWrapper.vibrateForDragBump();
- }
}
private void onMotionPauseDetected() {
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index 1b0ad04..742648e 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -37,7 +37,6 @@
import android.animation.Animator;
import android.animation.ObjectAnimator;
-import android.animation.ValueAnimator;
import android.util.FloatProperty;
import android.view.HapticFeedbackConstants;
import android.view.View;
@@ -52,7 +51,6 @@
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
-import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimatedFloat;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.anim.PropertySetter;
@@ -359,22 +357,6 @@
});
}
- if (FeatureFlags.ENABLE_PREMIUM_HAPTICS_ALL_APPS.get() && config.isUserControlled()
- && Utilities.ATLEAST_S) {
- if (toState == ALL_APPS) {
- builder.addOnFrameListener(
- new VibrationAnimatorUpdateListener(this, mVibratorWrapper,
- SWIPE_DRAG_COMMIT_THRESHOLD, 1));
- } else {
- builder.addOnFrameListener(
- new VibrationAnimatorUpdateListener(this, mVibratorWrapper,
- 0, SWIPE_DRAG_COMMIT_THRESHOLD));
- }
- builder.addEndListener((unused) -> {
- mVibratorWrapper.cancelVibrate();
- });
- }
-
float targetProgress = toState.getVerticalProgress(mLauncher);
if (Float.compare(mProgress, targetProgress) == 0) {
setAlphas(toState, config, builder);
@@ -391,8 +373,7 @@
setAlphas(toState, config, builder);
// This controls both haptics for tapping on QSB and going to all apps.
- if (ALL_APPS.equals(toState) && mLauncher.isInState(NORMAL) &&
- !FeatureFlags.ENABLE_PREMIUM_HAPTICS_ALL_APPS.get()) {
+ if (ALL_APPS.equals(toState) && mLauncher.isInState(NORMAL)) {
mLauncher.getAppsView().performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY,
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
}
@@ -445,45 +426,4 @@
public void setShiftRange(float shiftRange) {
mShiftRange = shiftRange;
}
-
- /**
- * This VibrationAnimatorUpdateListener class takes in four parameters, a controller, start
- * threshold, end threshold, and a Vibrator wrapper. We use the progress given by the controller
- * as it gives an accurate progress that dictates where the vibrator should vibrate.
- * Note: once the user begins a gesture and does the commit haptic, there should not be anymore
- * haptics played for that gesture.
- */
- private static class VibrationAnimatorUpdateListener implements
- ValueAnimator.AnimatorUpdateListener {
- private final VibratorWrapper mVibratorWrapper;
- private final AllAppsTransitionController mController;
- private final float mStartThreshold;
- private final float mEndThreshold;
- private boolean mHasCommitted;
-
- VibrationAnimatorUpdateListener(AllAppsTransitionController controller,
- VibratorWrapper vibratorWrapper, float startThreshold,
- float endThreshold) {
- mController = controller;
- mVibratorWrapper = vibratorWrapper;
- mStartThreshold = startThreshold;
- mEndThreshold = endThreshold;
- }
-
- @Override
- public void onAnimationUpdate(ValueAnimator animation) {
- if (mHasCommitted) {
- return;
- }
- float currentProgress =
- AllAppsTransitionController.ALL_APPS_PROGRESS.get(mController);
- if (currentProgress > mStartThreshold && currentProgress < mEndThreshold) {
- mVibratorWrapper.vibrateForDragTexture();
- } else if (!(currentProgress == 0 || currentProgress == 1)) {
- // This check guards against committing at the location of the start of the gesture
- mVibratorWrapper.vibrateForDragCommit();
- mHasCommitted = true;
- }
- }
- }
}
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index d0596fa..21900c1 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -93,18 +93,6 @@
270394468, "ENABLE_SHOW_KEYBOARD_OPTION_IN_ALL_APPS", ENABLED,
"Enable option to show keyboard when going to all-apps");
- // TODO(Block 5): Clean up flags
- public static final BooleanFlag ENABLE_TWOLINE_DEVICESEARCH = getDebugFlag(201388851,
- "ENABLE_TWOLINE_DEVICESEARCH", DISABLED,
- "Enable two line label for icons with labels on device search.");
-
- public static final BooleanFlag ENABLE_ICON_IN_TEXT_HEADER = getDebugFlag(270395143,
- "ENABLE_ICON_IN_TEXT_HEADER", DISABLED, "Show icon in textheader");
-
- public static final BooleanFlag ENABLE_PREMIUM_HAPTICS_ALL_APPS = getDebugFlag(270396358,
- "ENABLE_PREMIUM_HAPTICS_ALL_APPS", DISABLED,
- "Enables haptics opening/closing All apps");
-
// TODO(Block 6): Clean up flags
public static final BooleanFlag ENABLE_ALL_APPS_SEARCH_IN_TASKBAR = getDebugFlag(270393900,
"ENABLE_ALL_APPS_SEARCH_IN_TASKBAR", ENABLED,
diff --git a/src/com/android/launcher3/util/VibratorWrapper.java b/src/com/android/launcher3/util/VibratorWrapper.java
index 6bae1ba..a4b8eb0 100644
--- a/src/com/android/launcher3/util/VibratorWrapper.java
+++ b/src/com/android/launcher3/util/VibratorWrapper.java
@@ -25,12 +25,10 @@
import android.content.Context;
import android.media.AudioAttributes;
import android.net.Uri;
-import android.os.SystemClock;
import android.os.VibrationEffect;
import android.os.Vibrator;
import android.provider.Settings;
-import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import com.android.launcher3.Utilities;
@@ -54,20 +52,6 @@
static final Uri HAPTIC_FEEDBACK_URI = Settings.System.getUriFor(HAPTIC_FEEDBACK_ENABLED);
@VisibleForTesting static final float LOW_TICK_SCALE = 0.9f;
- @VisibleForTesting static final float DRAG_TEXTURE_SCALE = 0.03f;
- @VisibleForTesting static final float DRAG_COMMIT_SCALE = 0.5f;
- @VisibleForTesting static final float DRAG_BUMP_SCALE = 0.4f;
- @VisibleForTesting static final int DRAG_TEXTURE_EFFECT_SIZE = 200;
-
- @Nullable
- private final VibrationEffect mDragEffect;
- @Nullable
- private final VibrationEffect mCommitEffect;
- @Nullable
- private final VibrationEffect mBumpEffect;
-
- private long mLastDragTime;
- private final int mThresholdUntilNextDragCallMillis;
/**
* Haptic when entering overview.
@@ -100,28 +84,6 @@
} else {
mIsHapticFeedbackEnabled = false;
}
-
- if (Utilities.ATLEAST_S && mVibrator.areAllPrimitivesSupported(
- PRIMITIVE_LOW_TICK)) {
-
- // Drag texture, Commit, and Bump should only be used for premium phones.
- // Before using these haptics make sure check if the device can use it
- mDragEffect = getDragEffect();
- mCommitEffect = VibrationEffect.startComposition().addPrimitive(
- VibrationEffect.Composition.PRIMITIVE_TICK, DRAG_COMMIT_SCALE).compose();
- mBumpEffect = VibrationEffect.startComposition().addPrimitive(
- PRIMITIVE_LOW_TICK, DRAG_BUMP_SCALE).compose();
- int primitiveDuration = mVibrator.getPrimitiveDurations(
- PRIMITIVE_LOW_TICK)[0];
-
- mThresholdUntilNextDragCallMillis =
- DRAG_TEXTURE_EFFECT_SIZE * primitiveDuration + 100;
- } else {
- mDragEffect = null;
- mCommitEffect = null;
- mBumpEffect = null;
- mThresholdUntilNextDragCallMillis = 0;
- }
}
@Override
@@ -132,52 +94,11 @@
}
/**
- * This is called when the user swipes to/from all apps. This is meant to be used in between
- * long animation progresses so that it gives a dragging texture effect. For a better
- * experience, this should be used in combination with vibrateForDragCommit().
- */
- public void vibrateForDragTexture() {
- if (mDragEffect == null) {
- return;
- }
- long currentTime = SystemClock.elapsedRealtime();
- long elapsedTimeSinceDrag = currentTime - mLastDragTime;
- if (elapsedTimeSinceDrag >= mThresholdUntilNextDragCallMillis) {
- vibrate(mDragEffect);
- mLastDragTime = currentTime;
- }
- }
-
- /**
- * This is used when user reaches the commit threshold when swiping to/from from all apps.
- */
- public void vibrateForDragCommit() {
- if (mCommitEffect != null) {
- vibrate(mCommitEffect);
- }
- // resetting dragTexture timestamp to be able to play dragTexture again
- mLastDragTime = 0;
- }
-
- /**
- * The bump haptic is used to be called at the end of a swipe and only if it the gesture is a
- * FLING going to/from all apps. Client can just call this method elsewhere just for the
- * effect.
- */
- public void vibrateForDragBump() {
- if (mBumpEffect != null) {
- vibrate(mBumpEffect);
- }
- }
-
- /**
* This should be used to cancel a haptic in case where the haptic shouldn't be vibrating. For
* example, when no animation is happening but a vibrator happens to be vibrating still.
*/
public void cancelVibrate() {
UI_HELPER_EXECUTOR.execute(mVibrator::cancel);
- // reset dragTexture timestamp to be able to play dragTexture again whenever cancelled
- mLastDragTime = 0;
}
/** Vibrates with the given effect if haptic feedback is available and enabled. */
@@ -217,13 +138,4 @@
vibrate(primitiveLowTickEffect);
}
}
-
- static VibrationEffect getDragEffect() {
- VibrationEffect.Composition dragEffect = VibrationEffect.startComposition();
- for (int i = 0; i < DRAG_TEXTURE_EFFECT_SIZE; i++) {
- dragEffect.addPrimitive(
- PRIMITIVE_LOW_TICK, DRAG_TEXTURE_SCALE);
- }
- return dragEffect.compose();
- }
}
diff --git a/tests/multivalentTests/src/com/android/launcher3/util/VibratorWrapperTest.kt b/tests/multivalentTests/src/com/android/launcher3/util/VibratorWrapperTest.kt
index 330c394..d321e41 100644
--- a/tests/multivalentTests/src/com/android/launcher3/util/VibratorWrapperTest.kt
+++ b/tests/multivalentTests/src/com/android/launcher3/util/VibratorWrapperTest.kt
@@ -17,7 +17,6 @@
package com.android.launcher3.util
import android.media.AudioAttributes
-import android.os.SystemClock
import android.os.VibrationEffect
import android.os.VibrationEffect.Composition.PRIMITIVE_LOW_TICK
import android.os.VibrationEffect.Composition.PRIMITIVE_TICK
@@ -35,13 +34,11 @@
import org.mockito.Captor
import org.mockito.Mock
import org.mockito.Mockito.any
-import org.mockito.Mockito.reset
import org.mockito.Mockito.verify
import org.mockito.Mockito.`when`
import org.mockito.MockitoAnnotations
import org.mockito.kotlin.never
import org.mockito.kotlin.same
-import org.mockito.kotlin.verifyNoMoreInteractions
@SmallTest
@RunWith(AndroidJUnit4::class)
@@ -118,55 +115,6 @@
}
@Test
- fun vibrate_for_drag_bump() {
- underTest.vibrateForDragBump()
-
- awaitTasksCompleted()
- verify(vibrator).vibrate(vibrationEffectCaptor.capture(), same(VIBRATION_ATTRS))
- val expectedEffect =
- VibrationEffect.startComposition()
- .addPrimitive(PRIMITIVE_LOW_TICK, VibratorWrapper.DRAG_BUMP_SCALE)
- .compose()
- assertThat(vibrationEffectCaptor.value).isEqualTo(expectedEffect)
- }
-
- @Test
- fun vibrate_for_drag_commit() {
- underTest.vibrateForDragCommit()
-
- awaitTasksCompleted()
- verify(vibrator).vibrate(vibrationEffectCaptor.capture(), same(VIBRATION_ATTRS))
- val expectedEffect =
- VibrationEffect.startComposition()
- .addPrimitive(PRIMITIVE_TICK, VibratorWrapper.DRAG_COMMIT_SCALE)
- .compose()
- assertThat(vibrationEffectCaptor.value).isEqualTo(expectedEffect)
- }
-
- @Test
- fun vibrate_for_drag_texture() {
- SystemClock.setCurrentTimeMillis(40000)
-
- underTest.vibrateForDragTexture()
-
- awaitTasksCompleted()
- verify(vibrator).vibrate(vibrationEffectCaptor.capture(), same(VIBRATION_ATTRS))
- assertThat(vibrationEffectCaptor.value).isEqualTo(VibratorWrapper.getDragEffect())
- }
-
- @Test
- fun vibrate_for_drag_texture_within_time_window_noOp() {
- SystemClock.setCurrentTimeMillis(40000)
- underTest.vibrateForDragTexture()
- awaitTasksCompleted()
- reset(vibrator)
-
- underTest.vibrateForDragTexture()
-
- verifyNoMoreInteractions(vibrator)
- }
-
- @Test
fun haptic_feedback_disabled_no_vibrate() {
`when`(vibrator.hasVibrator()).thenReturn(false)
underTest = VibratorWrapper(vibrator, settingsCache)