Cleaning up some enabled features

Flag: EXEMPT LEGACY
		CONTINUOUS_VIEW_TREE_CAPTURE
		ALL_APPS_GONE_VISIBILITY
		ENABLE_BACK_SWIPE_HOME_ANIMATION
		ENABLE_DYNAMIC_TASKBAR_THRESHOLDS
		PREEMPTIVE_UNFOLD_ANIMATION_START
		ENABLE_NEW_GESTURE_NAV_TUTORIAL
		ENABLE_ENFORCED_ROUNDED_CORNERS
		ENABLE_TRACKPAD_GESTURE
		ENABLE_KEYBOARD_QUICK_SWITCH
		ENABLE_KEYBOARD_TASKBAR_TOGGLE
		ENABLE_ALL_APPS_RV_PREINFLATION
Test: Presubmit
Bug: 270395171, 291651514, 270393426, 294252473,
     270397209, 270396257, 270393258, 271010401,
     270396844, 281726846, 288161355

Change-Id: I6ef1e12dfc2203a4cca8e91aa291485f1ff24c42
This commit is contained in:
Sunny Goyal
2024-09-12 15:05:07 -07:00
parent 98af6a906e
commit 5ee3d98641
26 changed files with 224 additions and 585 deletions
@@ -51,7 +51,6 @@ import static com.android.launcher3.LauncherState.BACKGROUND_APP;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.Utilities.mapBoundToRange;
import static com.android.launcher3.config.FeatureFlags.ENABLE_BACK_SWIPE_HOME_ANIMATION;
import static com.android.launcher3.config.FeatureFlags.SEPARATE_RECENTS_ACTIVITY;
import static com.android.launcher3.testing.shared.TestProtocol.WALLPAPER_OPEN_ANIMATION_FINISHED_MESSAGE;
import static com.android.launcher3.util.DisplayController.isTransientTaskbar;
@@ -1599,7 +1598,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
boolean playWorkspaceReveal = !fromPredictiveBack;
boolean skipAllAppsScale = false;
if (ENABLE_BACK_SWIPE_HOME_ANIMATION.get() && !playFallBackAnimation) {
if (!playFallBackAnimation) {
PointF velocity;
if (enableScalingRevealHomeAnimation()) {
velocity = new PointF();
@@ -25,7 +25,6 @@ import androidx.core.content.res.ResourcesCompat;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.config.FeatureFlags;
/**
* Utility class that contains the different taskbar thresholds logic.
@@ -39,10 +38,6 @@ public class TaskbarThresholdUtils {
private static int getThreshold(Resources r, DeviceProfile dp, int thresholdDimen,
int multiplierDimen) {
if (!FeatureFlags.ENABLE_DYNAMIC_TASKBAR_THRESHOLDS.get()) {
return r.getDimensionPixelSize(thresholdDimen);
}
float landscapeScreenHeight = dp.isLandscape ? dp.heightPx : dp.widthPx;
float screenPart = (landscapeScreenHeight * SCREEN_UNITS);
float defaultDp = dpiFromPx(screenPart, DisplayMetrics.DENSITY_DEVICE_STABLE);
@@ -200,6 +200,8 @@ import com.android.systemui.unfold.progress.RemoteUnfoldTransitionReceiver;
import com.android.systemui.unfold.updates.RotationChangeProvider;
import com.android.wm.shell.shared.desktopmode.DesktopModeStatus;
import kotlin.Unit;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -212,8 +214,6 @@ import java.util.function.BiConsumer;
import java.util.function.Predicate;
import java.util.stream.Stream;
import kotlin.Unit;
public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
SystemShortcut.BubbleActivityStarter {
private static final boolean TRACE_LAYOUTS =
@@ -692,9 +692,7 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer,
}
addMultiWindowModeChangedListener(mDepthController);
initUnfoldTransitionProgressProvider();
if (FeatureFlags.CONTINUOUS_VIEW_TREE_CAPTURE.get()) {
mViewCapture = ViewCaptureFactory.getInstance(this).startCapture(getWindow());
}
mViewCapture = ViewCaptureFactory.getInstance(this).startCapture(getWindow());
getWindow().addPrivateFlags(PRIVATE_FLAG_OPTIMIZE_MEASURE);
QuickstepOnboardingPrefs.setup(this);
View.setTraceLayoutSteps(TRACE_LAYOUTS);
@@ -29,7 +29,6 @@ import androidx.annotation.VisibleForTesting
import com.android.internal.jank.Cuj
import com.android.launcher3.Flags.enableOverviewCommandHelperTimeout
import com.android.launcher3.PagedView
import com.android.launcher3.config.FeatureFlags
import com.android.launcher3.logger.LauncherAtom
import com.android.launcher3.logging.StatsLogManager
import com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_OVERVIEW_SHOW_OVERVIEW_FROM_3_BUTTON
@@ -248,7 +247,7 @@ constructor(
recents: RecentsView<*, *>,
taskView: TaskView?,
command: CommandInfo,
onCallbackResult: () -> Unit
onCallbackResult: () -> Unit,
): Boolean {
var callbackList: RunnableList? = null
if (taskView != null) {
@@ -274,15 +273,14 @@ constructor(
private fun executeWhenRecentsIsNotVisible(
command: CommandInfo,
onCallbackResult: () -> Unit
onCallbackResult: () -> Unit,
): Boolean {
val recentsViewContainer = activityInterface.getCreatedContainer() as? RecentsViewContainer
val recentsView: RecentsView<*, *>? = recentsViewContainer?.getOverviewPanel()
val deviceProfile = recentsViewContainer?.getDeviceProfile()
val uiController = activityInterface.getTaskbarController()
val allowQuickSwitch =
FeatureFlags.ENABLE_KEYBOARD_QUICK_SWITCH.get() &&
uiController != null &&
uiController != null &&
deviceProfile != null &&
(deviceProfile.isTablet || deviceProfile.isTwoPanels)
@@ -349,13 +347,13 @@ constructor(
val gestureState =
touchInteractionService.createGestureState(
GestureState.DEFAULT_STATE,
GestureState.TrackpadGestureType.NONE
GestureState.TrackpadGestureType.NONE,
)
gestureState.isHandlingAtomicEvent = true
val interactionHandler =
touchInteractionService.swipeUpHandlerFactory.newHandler(
gestureState,
command.createTime
command.createTime,
)
interactionHandler.setGestureEndCallback {
onTransitionComplete(command, interactionHandler, onCallbackResult)
@@ -366,7 +364,7 @@ constructor(
object : RecentsAnimationCallbacks.RecentsAnimationListener {
override fun onRecentsAnimationStart(
controller: RecentsAnimationController,
targets: RecentsAnimationTargets
targets: RecentsAnimationTargets,
) {
Log.d(TAG, "recents animation started: $command")
updateRecentsViewFocus(command)
@@ -418,7 +416,7 @@ constructor(
private fun onTransitionComplete(
command: CommandInfo,
handler: AbsSwipeUpHandler<*, *, *>,
onCommandResult: () -> Unit
onCommandResult: () -> Unit,
) {
Log.d(TAG, "switching via recents animation - onTransitionComplete: $command")
command.removeListener(handler)
@@ -434,7 +432,7 @@ constructor(
Log.d(
TAG,
"next task not scheduled. First pending command type " +
"is ${commandQueue.firstOrNull()} - command type is: $command"
"is ${commandQueue.firstOrNull()} - command type is: $command",
)
return
}
@@ -527,7 +525,7 @@ constructor(
val type: CommandType,
var status: CommandStatus = CommandStatus.IDLE,
val createTime: Long = SystemClock.elapsedRealtime(),
private var animationCallbacks: RecentsAnimationCallbacks? = null
private var animationCallbacks: RecentsAnimationCallbacks? = null,
) {
fun setAnimationCallbacks(recentsAnimationCallbacks: RecentsAnimationCallbacks) {
this.animationCallbacks = recentsAnimationCallbacks
@@ -545,7 +543,7 @@ constructor(
IDLE,
PROCESSING,
COMPLETED,
CANCELED
CANCELED,
}
}
@@ -30,7 +30,6 @@ import static com.android.launcher3.Launcher.INTENT_ACTION_ALL_APPS_TOGGLE;
import static com.android.launcher3.LauncherPrefs.backedUpItem;
import static com.android.launcher3.MotionEventsUtils.isTrackpadMotionEvent;
import static com.android.launcher3.MotionEventsUtils.isTrackpadMultiFingerSwipe;
import static com.android.launcher3.config.FeatureFlags.ENABLE_TRACKPAD_GESTURE;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import static com.android.launcher3.util.OnboardingPrefs.HOME_BOUNCE_SEEN;
@@ -228,7 +227,6 @@ public class TouchInteractionService extends Service {
@BinderThread
@Override
public void onTaskbarToggled() {
if (!FeatureFlags.ENABLE_KEYBOARD_TASKBAR_TOGGLE.get()) return;
MAIN_EXECUTOR.execute(() -> executeForTouchInteractionService(tis -> {
TaskbarActivityContext activityContext =
tis.mTaskbarManager.getCurrentActivityContext();
@@ -664,13 +662,11 @@ public class TouchInteractionService extends Service {
mAllAppsActionManager = new AllAppsActionManager(
this, UI_HELPER_EXECUTOR, this::createAllAppsPendingIntent);
mInputManager = getSystemService(InputManager.class);
if (ENABLE_TRACKPAD_GESTURE.get()) {
mInputManager.registerInputDeviceListener(mInputDeviceListener,
UI_HELPER_EXECUTOR.getHandler());
int [] inputDevices = mInputManager.getInputDeviceIds();
for (int inputDeviceId : inputDevices) {
mInputDeviceListener.onInputDeviceAdded(inputDeviceId);
}
mInputManager.registerInputDeviceListener(mInputDeviceListener,
UI_HELPER_EXECUTOR.getHandler());
int [] inputDevices = mInputManager.getInputDeviceIds();
for (int inputDeviceId : inputDevices) {
mInputDeviceListener.onInputDeviceAdded(inputDeviceId);
}
mDesktopVisibilityController = new DesktopVisibilityController(this);
mTaskbarManager = new TaskbarManager(
@@ -703,7 +699,7 @@ public class TouchInteractionService extends Service {
if (mDeviceState.isButtonNavMode()
&& !mDeviceState.supportsAssistantGestureInButtonNav()
&& (!ENABLE_TRACKPAD_GESTURE.get() || mTrackpadsConnected.isEmpty())) {
&& (mTrackpadsConnected.isEmpty())) {
return;
}
@@ -1271,7 +1267,7 @@ public class TouchInteractionService extends Service {
getBaseContext(), mDeviceState, mInputMonitorCompat);
}
if (ENABLE_TRACKPAD_GESTURE.get() && mGestureState.isTrackpadGesture()
if (mGestureState.isTrackpadGesture()
&& canStartSystemGesture && !previousGestureState.isRecentsAnimationRunning()) {
reasonString = newCompoundString(reasonPrefix)
.append(SUBSTRING_PREFIX)
@@ -15,8 +15,6 @@
*/
package com.android.quickstep.interaction;
import static com.android.launcher3.config.FeatureFlags.ENABLE_NEW_GESTURE_NAV_TUTORIAL;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
@@ -175,11 +173,8 @@ public class AnimatedTaskView extends ConstraintLayout {
void setFakeTaskViewFillColor(@ColorInt int colorResId) {
mFullTaskView.setBackgroundColor(colorResId);
if (ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()){
mTopTaskView.getBackground().setTint(colorResId);
mBottomTaskView.getBackground().setTint(colorResId);
}
mTopTaskView.getBackground().setTint(colorResId);
mBottomTaskView.getBackground().setTint(colorResId);
}
@Override
@@ -15,7 +15,6 @@
*/
package com.android.quickstep.interaction;
import static com.android.launcher3.config.FeatureFlags.ENABLE_NEW_GESTURE_NAV_TUTORIAL;
import static com.android.quickstep.interaction.TutorialController.TutorialType.BACK_NAVIGATION;
import static com.android.quickstep.interaction.TutorialController.TutorialType.BACK_NAVIGATION_COMPLETE;
@@ -40,35 +39,29 @@ final class BackGestureTutorialController extends TutorialController {
BackGestureTutorialController(BackGestureTutorialFragment fragment, TutorialType tutorialType) {
super(fragment, tutorialType);
// Set the Lottie animation colors specifically for the Back gesture
if (ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
LottieAnimationColorUtils.updateToArgbColors(
mAnimatedGestureDemonstration,
Map.of(".onSurfaceBack", fragment.mRootView.mColorOnSurfaceBack,
".surfaceBack", fragment.mRootView.mColorSurfaceBack,
".secondaryBack", fragment.mRootView.mColorSecondaryBack));
LottieAnimationColorUtils.updateToArgbColors(
mAnimatedGestureDemonstration,
Map.of(".onSurfaceBack", fragment.mRootView.mColorOnSurfaceBack,
".surfaceBack", fragment.mRootView.mColorSurfaceBack,
".secondaryBack", fragment.mRootView.mColorSecondaryBack));
LottieAnimationColorUtils.updateToArgbColors(
mCheckmarkAnimation,
Map.of(".checkmark",
Utilities.isDarkTheme(mContext)
? fragment.mRootView.mColorOnSurfaceBack
: fragment.mRootView.mColorSecondaryBack,
".checkmarkBackground", fragment.mRootView.mColorSurfaceBack));
}
LottieAnimationColorUtils.updateToArgbColors(
mCheckmarkAnimation,
Map.of(".checkmark",
Utilities.isDarkTheme(mContext)
? fragment.mRootView.mColorOnSurfaceBack
: fragment.mRootView.mColorSecondaryBack,
".checkmarkBackground", fragment.mRootView.mColorSurfaceBack));
}
@Override
public int getIntroductionTitle() {
return ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()
? R.string.back_gesture_tutorial_title
: R.string.back_gesture_intro_title;
return R.string.back_gesture_tutorial_title;
}
@Override
public int getIntroductionSubtitle() {
return ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()
? R.string.back_gesture_tutorial_subtitle
: R.string.back_gesture_intro_subtitle;
return R.string.back_gesture_tutorial_subtitle;
}
@Override
@@ -85,9 +78,7 @@ final class BackGestureTutorialController extends TutorialController {
public int getSuccessFeedbackSubtitle() {
return mTutorialFragment.isAtFinalStep()
? R.string.back_gesture_feedback_complete_without_follow_up
: ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()
? R.string.back_gesture_feedback_complete_with_follow_up
: R.string.back_gesture_feedback_complete_with_overview_follow_up;
: R.string.back_gesture_feedback_complete_with_follow_up;
}
@Override
@@ -128,20 +119,12 @@ final class BackGestureTutorialController extends TutorialController {
@LayoutRes
int getMockAppTaskCurrentPageLayoutResId() {
return ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()
? R.layout.back_gesture_tutorial_background
: mTutorialFragment.isLargeScreen()
? R.layout.gesture_tutorial_tablet_mock_conversation
: R.layout.gesture_tutorial_mock_conversation;
return R.layout.back_gesture_tutorial_background;
}
@LayoutRes
int getMockAppTaskPreviousPageLayoutResId() {
return ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()
? R.layout.back_gesture_tutorial_background
: mTutorialFragment.isLargeScreen()
? R.layout.gesture_tutorial_tablet_mock_conversation_list
: R.layout.gesture_tutorial_mock_conversation_list;
return R.layout.back_gesture_tutorial_background;
}
@Override
@@ -214,17 +197,13 @@ final class BackGestureTutorialController extends TutorialController {
}
private void handleBackAttempt(BackGestureResult result) {
if (ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
resetViewsForBackGesture();
}
resetViewsForBackGesture();
switch (result) {
case BACK_COMPLETED_FROM_LEFT:
case BACK_COMPLETED_FROM_RIGHT:
mTutorialFragment.releaseFeedbackAnimation();
if (ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
mExitingAppView.setVisibility(View.GONE);
}
mExitingAppView.setVisibility(View.GONE);
updateFakeAppTaskViewLayout(getMockAppTaskPreviousPageLayoutResId());
showSuccessFeedback();
break;
@@ -15,8 +15,6 @@
*/
package com.android.quickstep.interaction;
import static com.android.launcher3.config.FeatureFlags.ENABLE_NEW_GESTURE_NAV_TUTORIAL;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Point;
@@ -211,10 +209,8 @@ public class EdgeBackGestureHandler implements OnTouchListener {
}
}
if (ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
mGestureCallback.onBackGestureProgress(ev.getX() - mDownPoint.x,
ev.getY() - mDownPoint.y, mEdgeBackPanel.getIsLeftPanel());
}
mGestureCallback.onBackGestureProgress(ev.getX() - mDownPoint.x,
ev.getY() - mDownPoint.y, mEdgeBackPanel.getIsLeftPanel());
// forward touch
mEdgeBackPanel.onMotionEvent(ev);
@@ -37,7 +37,6 @@ import com.android.launcher3.DeviceProfile;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.LauncherPrefs;
import com.android.launcher3.R;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.logging.StatsLogManager;
import com.android.quickstep.TouchInteractionService.TISBinder;
import com.android.quickstep.interaction.TutorialController.TutorialType;
@@ -79,9 +78,7 @@ public class GestureSandboxActivity extends FragmentActivity {
Bundle args = savedInstanceState == null ? getIntent().getExtras() : savedInstanceState;
boolean gestureComplete = args != null && args.getBoolean(KEY_GESTURE_COMPLETE, false);
if (FeatureFlags.ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()
&& args != null
&& args.getBoolean(KEY_USE_TUTORIAL_MENU, false)) {
if (args != null && args.getBoolean(KEY_USE_TUTORIAL_MENU, false)) {
mTutorialSteps = null;
TutorialType tutorialTypeOverride = (TutorialType) args.get(KEY_TUTORIAL_TYPE);
mCurrentFragment = tutorialTypeOverride == null
@@ -101,9 +98,7 @@ public class GestureSandboxActivity extends FragmentActivity {
.add(R.id.gesture_tutorial_fragment_container, mCurrentFragment)
.commit();
if (FeatureFlags.ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
correctUserOrientation();
}
correctUserOrientation();
mTISBindHelper = new TISBindHelper(this, this::onTISConnected);
initWindowInsets();
@@ -115,9 +110,7 @@ public class GestureSandboxActivity extends FragmentActivity {
super.onConfigurationChanged(newConfig);
// Ensure the prompt to rotate the screen is updated
if (FeatureFlags.ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
correctUserOrientation();
}
correctUserOrientation();
}
private void initWindowInsets() {
@@ -15,8 +15,6 @@
*/
package com.android.quickstep.interaction;
import static com.android.launcher3.config.FeatureFlags.ENABLE_NEW_GESTURE_NAV_TUTORIAL;
import android.graphics.PointF;
import com.android.launcher3.R;
@@ -34,35 +32,29 @@ final class HomeGestureTutorialController extends SwipeUpGestureTutorialControll
super(fragment, tutorialType);
// Set the Lottie animation colors specifically for the Home gesture
if (ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
LottieAnimationColorUtils.updateToArgbColors(
mAnimatedGestureDemonstration,
Map.of(".onSurfaceHome", fragment.mRootView.mColorOnSurfaceHome,
".surfaceHome", fragment.mRootView.mColorSurfaceHome,
".secondaryHome", fragment.mRootView.mColorSecondaryHome));
LottieAnimationColorUtils.updateToArgbColors(
mAnimatedGestureDemonstration,
Map.of(".onSurfaceHome", fragment.mRootView.mColorOnSurfaceHome,
".surfaceHome", fragment.mRootView.mColorSurfaceHome,
".secondaryHome", fragment.mRootView.mColorSecondaryHome));
LottieAnimationColorUtils.updateToArgbColors(
mCheckmarkAnimation,
Map.of(".checkmark",
Utilities.isDarkTheme(mContext)
? fragment.mRootView.mColorOnSurfaceHome
: fragment.mRootView.mColorSecondaryHome,
".checkmarkBackground", fragment.mRootView.mColorSurfaceHome));
}
LottieAnimationColorUtils.updateToArgbColors(
mCheckmarkAnimation,
Map.of(".checkmark",
Utilities.isDarkTheme(mContext)
? fragment.mRootView.mColorOnSurfaceHome
: fragment.mRootView.mColorSecondaryHome,
".checkmarkBackground", fragment.mRootView.mColorSurfaceHome));
}
@Override
public int getIntroductionTitle() {
return ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()
? R.string.home_gesture_tutorial_title
: R.string.home_gesture_intro_title;
return R.string.home_gesture_tutorial_title;
}
@Override
public int getIntroductionSubtitle() {
return ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()
? R.string.home_gesture_tutorial_subtitle
: R.string.home_gesture_intro_subtitle;
return R.string.home_gesture_tutorial_subtitle;
}
@Override
@@ -72,9 +64,7 @@ final class HomeGestureTutorialController extends SwipeUpGestureTutorialControll
@Override
public int getSuccessFeedbackTitle() {
return ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()
? R.string.home_gesture_tutorial_success
: R.string.gesture_tutorial_nice;
return R.string.home_gesture_tutorial_success;
}
@Override
@@ -16,7 +16,6 @@
package com.android.quickstep.interaction;
import static com.android.app.animation.Interpolators.ACCELERATE;
import static com.android.launcher3.config.FeatureFlags.ENABLE_NEW_GESTURE_NAV_TUTORIAL;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -49,34 +48,28 @@ final class OverviewGestureTutorialController extends SwipeUpGestureTutorialCont
super(fragment, tutorialType);
// Set the Lottie animation colors specifically for the Overview gesture
if (ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
LottieAnimationColorUtils.updateToArgbColors(
mAnimatedGestureDemonstration,
Map.of(".onSurfaceOverview", fragment.mRootView.mColorOnSurfaceOverview,
".surfaceOverview", fragment.mRootView.mColorSurfaceOverview,
".secondaryOverview", fragment.mRootView.mColorSecondaryOverview));
LottieAnimationColorUtils.updateToArgbColors(
mAnimatedGestureDemonstration,
Map.of(".onSurfaceOverview", fragment.mRootView.mColorOnSurfaceOverview,
".surfaceOverview", fragment.mRootView.mColorSurfaceOverview,
".secondaryOverview", fragment.mRootView.mColorSecondaryOverview));
LottieAnimationColorUtils.updateToArgbColors(
mCheckmarkAnimation,
Map.of(".checkmark",
Utilities.isDarkTheme(mContext)
? fragment.mRootView.mColorOnSurfaceOverview
: fragment.mRootView.mColorSecondaryOverview,
".checkmarkBackground", fragment.mRootView.mColorSurfaceOverview));
}
LottieAnimationColorUtils.updateToArgbColors(
mCheckmarkAnimation,
Map.of(".checkmark",
Utilities.isDarkTheme(mContext)
? fragment.mRootView.mColorOnSurfaceOverview
: fragment.mRootView.mColorSecondaryOverview,
".checkmarkBackground", fragment.mRootView.mColorSurfaceOverview));
}
@Override
public int getIntroductionTitle() {
return ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()
? R.string.overview_gesture_tutorial_title
: R.string.overview_gesture_intro_title;
return R.string.overview_gesture_tutorial_title;
}
@Override
public int getIntroductionSubtitle() {
return ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()
? R.string.overview_gesture_tutorial_subtitle
: R.string.overview_gesture_intro_subtitle;
return R.string.overview_gesture_tutorial_subtitle;
}
@Override
@@ -86,9 +79,7 @@ final class OverviewGestureTutorialController extends SwipeUpGestureTutorialCont
@Override
public int getSuccessFeedbackTitle() {
return ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()
? R.string.overview_gesture_tutorial_success
: R.string.gesture_tutorial_nice;
return R.string.overview_gesture_tutorial_success;
}
@Override
@@ -168,10 +159,7 @@ final class OverviewGestureTutorialController extends SwipeUpGestureTutorialCont
@Override
protected int getMockPreviousAppTaskThumbnailColor() {
return ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()
? mTutorialFragment.mRootView.mColorSurfaceContainer
: mContext.getResources().getColor(
R.color.gesture_tutorial_fake_previous_task_view_color);
return mTutorialFragment.mRootView.mColorSurfaceContainer;
}
@Override
@@ -224,11 +212,8 @@ final class OverviewGestureTutorialController extends SwipeUpGestureTutorialCont
case OVERVIEW_GESTURE_COMPLETED:
setGestureCompleted();
mTutorialFragment.releaseFeedbackAnimation();
animateTaskViewToOverview(ENABLE_NEW_GESTURE_NAV_TUTORIAL.get());
animateTaskViewToOverview(true);
onMotionPaused(true /*arbitrary value*/);
if (!ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
showSuccessFeedback();
}
break;
case HOME_OR_OVERVIEW_NOT_STARTED_WRONG_SWIPE_DIRECTION:
case HOME_OR_OVERVIEW_CANCELLED:
@@ -15,16 +15,12 @@
*/
package com.android.quickstep.interaction;
import static com.android.launcher3.config.FeatureFlags.ENABLE_NEW_GESTURE_NAV_TUTORIAL;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.Insets;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowInsets;
import android.widget.RelativeLayout;
@@ -39,10 +35,6 @@ import com.android.launcher3.Utilities;
/** Root layout that TutorialFragment uses to intercept motion events. */
public class RootSandboxLayout extends RelativeLayout {
private final Rect mTempStepIndicatorBounds = new Rect();
private final Rect mTempInclusionBounds = new Rect();
private final Rect mTempExclusionBounds = new Rect();
@ColorInt final int mColorSurfaceContainer;
@ColorInt final int mColorOnSurfaceHome;
@ColorInt final int mColorSurfaceHome;
@@ -54,11 +46,6 @@ public class RootSandboxLayout extends RelativeLayout {
@ColorInt final int mColorSurfaceOverview;
@ColorInt final int mColorSecondaryOverview;
private View mFeedbackView;
private View mTutorialStepView;
private View mSkipButton;
private View mDoneButton;
public RootSandboxLayout(Context context) {
this(context, null);
}
@@ -123,56 +110,4 @@ public class RootSandboxLayout extends RelativeLayout {
return getHeight() + insets.top + insets.bottom;
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
if (ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
return;
}
mFeedbackView = findViewById(R.id.gesture_tutorial_fragment_feedback_view);
mTutorialStepView =
mFeedbackView.findViewById(R.id.gesture_tutorial_fragment_feedback_tutorial_step);
mSkipButton = mFeedbackView.findViewById(R.id.gesture_tutorial_fragment_close_button);
mDoneButton = mFeedbackView.findViewById(R.id.gesture_tutorial_fragment_action_button);
mFeedbackView.addOnLayoutChangeListener(
(v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> {
if (mSkipButton.getVisibility() != VISIBLE
&& mDoneButton.getVisibility() != VISIBLE) {
return;
}
// Either the skip or the done button is ever shown at once, never both.
boolean showingSkipButton = mSkipButton.getVisibility() == VISIBLE;
boolean isRTL = Utilities.isRtl(getContext().getResources());
updateTutorialStepViewTranslation(
showingSkipButton ? mSkipButton : mDoneButton,
// Translate the step indicator away from whichever button is being
// shown. The skip button in on the left in LTR or on the right in RTL.
// The done button is on the right in LTR or left in RTL.
(showingSkipButton && !isRTL) || (!showingSkipButton && isRTL));
});
}
private void updateTutorialStepViewTranslation(
@NonNull View anchorView, boolean translateToRight) {
mTempStepIndicatorBounds.set(
mTutorialStepView.getLeft(),
mTutorialStepView.getTop(),
mTutorialStepView.getRight(),
mTutorialStepView.getBottom());
mTempInclusionBounds.set(0, 0, mFeedbackView.getWidth(), mFeedbackView.getHeight());
mTempExclusionBounds.set(
anchorView.getLeft(),
anchorView.getTop(),
anchorView.getRight(),
anchorView.getBottom());
Utilities.translateOverlappingView(
mTutorialStepView,
mTempStepIndicatorBounds,
mTempInclusionBounds,
mTempExclusionBounds,
translateToRight ? Utilities.TRANSLATE_RIGHT : Utilities.TRANSLATE_LEFT);
}
}
@@ -48,7 +48,6 @@ import com.android.launcher3.anim.AnimatedFloat;
import com.android.launcher3.anim.AnimatorListeners;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.config.FeatureFlags;
import com.android.quickstep.GestureState;
import com.android.quickstep.OverviewComponentObserver;
import com.android.quickstep.RecentsAnimationDeviceState;
@@ -127,9 +126,7 @@ abstract class SwipeUpGestureTutorialController extends TutorialController {
void resetTaskViews() {
mFakeHotseatView.setVisibility(View.INVISIBLE);
mFakeIconView.setVisibility(View.INVISIBLE);
if (FeatureFlags.ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
mFakeIconView.getBackground().setTint(getFakeTaskViewColor());
}
mFakeIconView.getBackground().setTint(getFakeTaskViewColor());
if (mTutorialFragment.getActivity() != null) {
int height = mTutorialFragment.getRootView().getFullscreenHeight();
int width = mTutorialFragment.getRootView().getWidth();
@@ -138,9 +135,7 @@ abstract class SwipeUpGestureTutorialController extends TutorialController {
mFakeTaskViewRadius = 0;
mFakeTaskView.invalidateOutline();
mFakeTaskView.setVisibility(View.VISIBLE);
if (FeatureFlags.ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
mFakeTaskView.setBackgroundColor(getFakeTaskViewColor());
}
mFakeTaskView.setBackgroundColor(getFakeTaskViewColor());
mFakeTaskView.setAlpha(1);
mFakePreviousTaskView.setVisibility(View.INVISIBLE);
mFakePreviousTaskView.setAlpha(1);
@@ -390,12 +385,10 @@ abstract class SwipeUpGestureTutorialController extends TutorialController {
false, /* isOpening */
mFakeIconView, mDp);
mFakeIconView.setAlpha(1);
if (FeatureFlags.ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
int iconColor = ColorUtils.blendARGB(
getFakeTaskViewColor(), getHotseatIconColor(), progress);
mFakeIconView.getBackground().setTint(iconColor);
mFakeTaskView.setBackgroundColor(iconColor);
}
int iconColor = ColorUtils.blendARGB(
getFakeTaskViewColor(), getHotseatIconColor(), progress);
mFakeIconView.getBackground().setTint(iconColor);
mFakeTaskView.setBackgroundColor(iconColor);
mFakeTaskView.setAlpha(getWindowAlpha(progress));
mFakePreviousTaskView.setAlpha(getWindowAlpha(progress));
}
@@ -19,10 +19,7 @@ import static android.view.View.GONE;
import static android.view.View.NO_ID;
import static android.view.View.inflate;
import static com.android.launcher3.config.FeatureFlags.ENABLE_NEW_GESTURE_NAV_TUTORIAL;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
@@ -33,7 +30,6 @@ import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Outline;
import android.graphics.Rect;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.RippleDrawable;
import android.util.Log;
@@ -52,7 +48,6 @@ import androidx.annotation.CallSuper;
import androidx.annotation.ColorInt;
import androidx.annotation.DrawableRes;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.annotation.StyleRes;
@@ -153,8 +148,7 @@ abstract class TutorialController implements BackGestureAttemptCallback,
mFakeHotseatView = rootView.findViewById(R.id.gesture_tutorial_fake_hotseat_view);
mFakeIconView = rootView.findViewById(R.id.gesture_tutorial_fake_icon_view);
mFakeTaskView = rootView.findViewById(R.id.gesture_tutorial_fake_task_view);
mFakeTaskbarView = ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()
? null : rootView.findViewById(R.id.gesture_tutorial_fake_taskbar_view);
mFakeTaskbarView = null;
mFakePreviousTaskView =
rootView.findViewById(R.id.gesture_tutorial_fake_previous_task_view);
mRippleView = rootView.findViewById(R.id.gesture_tutorial_ripple_view);
@@ -165,32 +159,30 @@ abstract class TutorialController implements BackGestureAttemptCallback,
mFingerDotView = rootView.findViewById(R.id.gesture_tutorial_finger_dot);
mSkipTutorialDialog = createSkipTutorialDialog();
if (ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
mFullGestureDemonstration = rootView.findViewById(R.id.full_gesture_demonstration);
mCheckmarkAnimation = rootView.findViewById(R.id.checkmark_animation);
mAnimatedGestureDemonstration = rootView.findViewById(
R.id.gesture_demonstration_animations);
mExitingAppView = rootView.findViewById(R.id.exiting_app_back);
mScreenWidth = mTutorialFragment.getDeviceProfile().widthPx;
mScreenHeight = mTutorialFragment.getDeviceProfile().heightPx;
mExitingAppMargin = mContext.getResources().getDimensionPixelSize(
R.dimen.gesture_tutorial_back_gesture_exiting_app_margin);
mExitingAppStartingCornerRadius = QuickStepContract.getWindowCornerRadius(mContext);
mExitingAppEndingCornerRadius = mContext.getResources().getDimensionPixelSize(
R.dimen.gesture_tutorial_back_gesture_end_corner_radius);
mAnimatedGestureDemonstration.addLottieOnCompositionLoadedListener(
this::createScalingMatrix);
mFullGestureDemonstration = rootView.findViewById(R.id.full_gesture_demonstration);
mCheckmarkAnimation = rootView.findViewById(R.id.checkmark_animation);
mAnimatedGestureDemonstration = rootView.findViewById(
R.id.gesture_demonstration_animations);
mExitingAppView = rootView.findViewById(R.id.exiting_app_back);
mScreenWidth = mTutorialFragment.getDeviceProfile().widthPx;
mScreenHeight = mTutorialFragment.getDeviceProfile().heightPx;
mExitingAppMargin = mContext.getResources().getDimensionPixelSize(
R.dimen.gesture_tutorial_back_gesture_exiting_app_margin);
mExitingAppStartingCornerRadius = QuickStepContract.getWindowCornerRadius(mContext);
mExitingAppEndingCornerRadius = mContext.getResources().getDimensionPixelSize(
R.dimen.gesture_tutorial_back_gesture_end_corner_radius);
mAnimatedGestureDemonstration.addLottieOnCompositionLoadedListener(
this::createScalingMatrix);
mFeedbackTitleView.setText(getIntroductionTitle());
mFeedbackSubtitleView.setText(getIntroductionSubtitle());
mExitingAppView.setClipToOutline(true);
mExitingAppView.setOutlineProvider(new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
outline.setRoundRect(mExitingAppRect, mExitingAppRadius);
}
});
}
mFeedbackTitleView.setText(getIntroductionTitle());
mFeedbackSubtitleView.setText(getIntroductionSubtitle());
mExitingAppView.setClipToOutline(true);
mExitingAppView.setOutlineProvider(new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
outline.setRoundRect(mExitingAppRect, mExitingAppRadius);
}
});
mTitleViewCallback = () -> mFeedbackTitleView.sendAccessibilityEvent(
AccessibilityEvent.TYPE_VIEW_FOCUSED);
@@ -261,19 +253,11 @@ abstract class TutorialController implements BackGestureAttemptCallback,
@LayoutRes
protected int getMockHotseatResId() {
if (ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
return mTutorialFragment.isLargeScreen()
? mTutorialFragment.isFoldable()
? R.layout.redesigned_gesture_tutorial_foldable_mock_hotseat
: R.layout.redesigned_gesture_tutorial_tablet_mock_hotseat
: R.layout.redesigned_gesture_tutorial_mock_hotseat;
} else {
return mTutorialFragment.isLargeScreen()
? mTutorialFragment.isFoldable()
? R.layout.gesture_tutorial_foldable_mock_hotseat
: R.layout.gesture_tutorial_tablet_mock_hotseat
: R.layout.gesture_tutorial_mock_hotseat;
}
return mTutorialFragment.isLargeScreen()
? mTutorialFragment.isFoldable()
? R.layout.redesigned_gesture_tutorial_foldable_mock_hotseat
: R.layout.redesigned_gesture_tutorial_tablet_mock_hotseat
: R.layout.redesigned_gesture_tutorial_mock_hotseat;
}
@LayoutRes
@@ -312,9 +296,7 @@ abstract class TutorialController implements BackGestureAttemptCallback,
@DrawableRes
public int getMockAppIconResId() {
return ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()
? R.drawable.redesigned_hotseat_icon
: R.drawable.default_sandbox_app_icon;
return R.drawable.redesigned_hotseat_icon;
}
@DrawableRes
@@ -374,11 +356,7 @@ abstract class TutorialController implements BackGestureAttemptCallback,
mFeedbackView.setTranslationY(0);
return;
}
Animator gestureAnimation = mTutorialFragment.getGestureAnimation();
AnimatedVectorDrawable edgeAnimation = mTutorialFragment.getEdgeAnimation();
if (gestureAnimation != null && edgeAnimation != null) {
playFeedbackAnimation(gestureAnimation, edgeAnimation, mShowFeedbackRunnable, true);
}
playFeedbackAnimation();
}
/**
@@ -442,12 +420,7 @@ abstract class TutorialController implements BackGestureAttemptCallback,
}
mFeedbackTitleView.setText(titleResId);
mFeedbackSubtitleView.setText(
ENABLE_NEW_GESTURE_NAV_TUTORIAL.get() || spokenSubtitleResId == NO_ID
? mContext.getText(subtitleResId)
: Utilities.wrapForTts(
mContext.getText(subtitleResId),
mContext.getString(spokenSubtitleResId)));
mFeedbackSubtitleView.setText(subtitleResId);
if (isGestureSuccessful) {
if (mTutorialFragment.isAtFinalStep()) {
showActionButton();
@@ -458,27 +431,16 @@ abstract class TutorialController implements BackGestureAttemptCallback,
mFakeTaskViewCallback = null;
}
if (ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
showSuccessPage();
}
showSuccessPage();
}
mGestureCompleted = isGestureSuccessful;
Animator gestureAnimation = mTutorialFragment.getGestureAnimation();
AnimatedVectorDrawable edgeAnimation = mTutorialFragment.getEdgeAnimation();
if (!isGestureSuccessful && gestureAnimation != null && edgeAnimation != null) {
playFeedbackAnimation(
gestureAnimation,
edgeAnimation,
mShowFeedbackRunnable,
useGestureAnimationDelay);
return;
if (!isGestureSuccessful) {
playFeedbackAnimation();
} else {
mTutorialFragment.releaseFeedbackAnimation();
mFeedbackViewCallback = mShowFeedbackRunnable;
mFeedbackView.post(mFeedbackViewCallback);
}
mFeedbackViewCallback = mShowFeedbackRunnable;
mFeedbackView.post(mFeedbackViewCallback);
}
private void showSuccessPage() {
@@ -517,79 +479,17 @@ abstract class TutorialController implements BackGestureAttemptCallback,
mFeedbackTitleView.removeCallbacks(mTitleViewCallback);
}
private void playFeedbackAnimation(
@NonNull Animator gestureAnimation,
@NonNull AnimatedVectorDrawable edgeAnimation,
@NonNull Runnable onStartRunnable,
boolean useGestureAnimationDelay) {
if (ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
mFeedbackView.setVisibility(View.VISIBLE);
mAnimatedGestureDemonstration.setVisibility(View.VISIBLE);
mFullGestureDemonstration.setVisibility(View.VISIBLE);
mAnimatedGestureDemonstration.playAnimation();
return;
}
if (gestureAnimation.isRunning()) {
gestureAnimation.cancel();
}
if (edgeAnimation.isRunning()) {
edgeAnimation.reset();
}
gestureAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
super.onAnimationStart(animation);
mEdgeGestureVideoView.setVisibility(GONE);
if (edgeAnimation.isRunning()) {
edgeAnimation.stop();
}
if (!useGestureAnimationDelay) {
onStartRunnable.run();
}
}
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
mEdgeGestureVideoView.setVisibility(View.VISIBLE);
edgeAnimation.start();
gestureAnimation.removeListener(this);
}
});
cancelQueuedGestureAnimation();
if (useGestureAnimationDelay) {
mFeedbackViewCallback = onStartRunnable;
mFakeTaskViewCallback = gestureAnimation::start;
mFeedbackView.post(mFeedbackViewCallback);
mFakeTaskView.postDelayed(mFakeTaskViewCallback, GESTURE_ANIMATION_DELAY_MS);
} else {
gestureAnimation.start();
}
private void playFeedbackAnimation() {
mFeedbackView.setVisibility(View.VISIBLE);
mAnimatedGestureDemonstration.setVisibility(View.VISIBLE);
mFullGestureDemonstration.setVisibility(View.VISIBLE);
mAnimatedGestureDemonstration.playAnimation();
}
void setRippleHotspot(float x, float y) {
mRippleDrawable.setHotspot(x, y);
}
void showRippleEffect(@Nullable Runnable onCompleteRunnable) {
mRippleDrawable.setState(
new int[] {android.R.attr.state_pressed, android.R.attr.state_enabled});
mRippleView.postDelayed(() -> {
mRippleDrawable.setState(new int[] {});
if (onCompleteRunnable != null) {
onCompleteRunnable.run();
}
}, RIPPLE_VISIBLE_MS);
}
void onActionButtonClicked(View button) {
mTutorialFragment.continueTutorial();
}
@@ -601,24 +501,19 @@ abstract class TutorialController implements BackGestureAttemptCallback,
updateDrawables();
updateLayout();
if (ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
mFeedbackTitleView.setTextAppearance(mContext, getTitleTextAppearance());
mDoneButton.setTextAppearance(mContext, getDoneButtonTextAppearance());
mDoneButton.getBackground().setTint(getDoneButtonColor());
mCheckmarkAnimation.setAnimation(mTutorialFragment.isAtFinalStep()
? R.raw.checkmark_animation_end
: R.raw.checkmark_animation_in_progress);
if (!isGestureCompleted()) {
mCheckmarkAnimation.setVisibility(GONE);
startGestureAnimation();
if (mTutorialType == TutorialType.BACK_NAVIGATION) {
resetViewsForBackGesture();
}
mFeedbackTitleView.setTextAppearance(mContext, getTitleTextAppearance());
mDoneButton.setTextAppearance(mContext, getDoneButtonTextAppearance());
mDoneButton.getBackground().setTint(getDoneButtonColor());
mCheckmarkAnimation.setAnimation(mTutorialFragment.isAtFinalStep()
? R.raw.checkmark_animation_end
: R.raw.checkmark_animation_in_progress);
if (!isGestureCompleted()) {
mCheckmarkAnimation.setVisibility(GONE);
startGestureAnimation();
if (mTutorialType == TutorialType.BACK_NAVIGATION) {
resetViewsForBackGesture();
}
} else {
hideFeedback();
hideActionButton();
}
mGestureCompleted = false;
@@ -654,13 +549,6 @@ abstract class TutorialController implements BackGestureAttemptCallback,
: R.style.TextAppearance_GestureTutorial_Feedback_Subtext_Dark);
}
void hideActionButton() {
mSkipButton.setVisibility(View.VISIBLE);
// Invisible to maintain the layout.
mDoneButton.setVisibility(View.INVISIBLE);
mDoneButton.setOnClickListener(null);
}
void showActionButton() {
mSkipButton.setVisibility(GONE);
mDoneButton.setVisibility(View.VISIBLE);
@@ -711,10 +599,8 @@ abstract class TutorialController implements BackGestureAttemptCallback,
}
private void updateSubtext() {
if (!ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
mTutorialStepView.setTutorialProgress(
mTutorialFragment.getCurrentStep(), mTutorialFragment.getNumSteps());
}
mTutorialStepView.setTutorialProgress(
mTutorialFragment.getCurrentStep(), mTutorialFragment.getNumSteps());
}
private void updateHotseatChildViewColor(@Nullable View child) {
@@ -727,9 +613,7 @@ abstract class TutorialController implements BackGestureAttemptCallback,
mTutorialFragment.getRootView().setBackground(AppCompatResources.getDrawable(
mContext, getMockWallpaperResId()));
mTutorialFragment.updateFeedbackAnimation();
mFakeLauncherView.setBackgroundColor(ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()
? getFakeLauncherColor()
: mContext.getColor(R.color.gesture_tutorial_fake_wallpaper_color));
mFakeLauncherView.setBackgroundColor(getFakeLauncherColor());
updateFakeViewLayout(mFakeHotseatView, getMockHotseatResId());
mHotseatIconView = mFakeHotseatView.findViewById(R.id.hotseat_icon_1);
mFakeTaskView.animate().alpha(1).setListener(
@@ -738,19 +622,15 @@ abstract class TutorialController implements BackGestureAttemptCallback,
mFakeIconView.setBackground(AppCompatResources.getDrawable(
mContext, getMockAppIconResId()));
if (ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
mExitingAppView.setBackgroundColor(getExitingAppColor());
mFakeTaskView.setBackgroundColor(getFakeTaskViewColor());
updateHotseatChildViewColor(mHotseatIconView);
updateHotseatChildViewColor(mFakeHotseatView.findViewById(R.id.hotseat_icon_2));
updateHotseatChildViewColor(mFakeHotseatView.findViewById(R.id.hotseat_icon_3));
updateHotseatChildViewColor(mFakeHotseatView.findViewById(R.id.hotseat_icon_4));
updateHotseatChildViewColor(mFakeHotseatView.findViewById(R.id.hotseat_icon_5));
updateHotseatChildViewColor(mFakeHotseatView.findViewById(R.id.hotseat_icon_6));
updateHotseatChildViewColor(mFakeHotseatView.findViewById(R.id.hotseat_search_bar));
} else {
updateFakeViewLayout(mFakeTaskView, getMockAppTaskLayoutResId());
}
mExitingAppView.setBackgroundColor(getExitingAppColor());
mFakeTaskView.setBackgroundColor(getFakeTaskViewColor());
updateHotseatChildViewColor(mHotseatIconView);
updateHotseatChildViewColor(mFakeHotseatView.findViewById(R.id.hotseat_icon_2));
updateHotseatChildViewColor(mFakeHotseatView.findViewById(R.id.hotseat_icon_3));
updateHotseatChildViewColor(mFakeHotseatView.findViewById(R.id.hotseat_icon_4));
updateHotseatChildViewColor(mFakeHotseatView.findViewById(R.id.hotseat_icon_5));
updateHotseatChildViewColor(mFakeHotseatView.findViewById(R.id.hotseat_icon_6));
updateHotseatChildViewColor(mFakeHotseatView.findViewById(R.id.hotseat_search_bar));
}
}
@@ -17,7 +17,6 @@ package com.android.quickstep.interaction;
import static android.view.View.NO_ID;
import static com.android.launcher3.config.FeatureFlags.ENABLE_NEW_GESTURE_NAV_TUTORIAL;
import static com.android.quickstep.interaction.GestureSandboxActivity.KEY_GESTURE_COMPLETE;
import static com.android.quickstep.interaction.GestureSandboxActivity.KEY_TUTORIAL_TYPE;
import static com.android.quickstep.interaction.GestureSandboxActivity.KEY_USE_TUTORIAL_MENU;
@@ -215,9 +214,7 @@ abstract class TutorialFragment extends GestureSandboxFragment implements OnTouc
super.onCreateView(inflater, container, savedInstanceState);
mRootView = (RootSandboxLayout) inflater.inflate(
ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()
? R.layout.redesigned_gesture_tutorial_fragment
: R.layout.gesture_tutorial_fragment,
R.layout.redesigned_gesture_tutorial_fragment,
container,
false);
@@ -383,10 +380,7 @@ abstract class TutorialFragment extends GestureSandboxFragment implements OnTouc
if (mTutorialController != null && !isGestureComplete()) {
mTutorialController.hideFeedback();
}
if (ENABLE_NEW_GESTURE_NAV_TUTORIAL.get()) {
mTutorialController.pauseAndHideLottieAnimation();
}
mTutorialController.pauseAndHideLottieAnimation();
// Note: Using logical-or to ensure both functions get called.
return mEdgeBackGestureHandler.onTouch(view, motionEvent)
@@ -31,7 +31,6 @@ import com.android.launcher3.DeviceProfile;
import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
import com.android.launcher3.Hotseat;
import com.android.launcher3.Workspace;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.uioverrides.QuickstepLauncher;
import com.android.launcher3.util.HorizontalInsettableView;
import com.android.quickstep.SystemUiProxy;
@@ -80,17 +79,12 @@ public class LauncherUnfoldAnimationController implements OnDeviceProfileChangeL
@UnfoldMain RotationChangeProvider rotationChangeProvider) {
mLauncher = launcher;
if (FeatureFlags.PREEMPTIVE_UNFOLD_ANIMATION_START.get()) {
mPreemptiveProgressProvider = new PreemptiveUnfoldTransitionProgressProvider(
unfoldTransitionProgressProvider, launcher.getMainThreadHandler());
mPreemptiveProgressProvider.init();
mPreemptiveProgressProvider = new PreemptiveUnfoldTransitionProgressProvider(
unfoldTransitionProgressProvider, launcher.getMainThreadHandler());
mPreemptiveProgressProvider.init();
mProgressProvider = new ScopedUnfoldTransitionProgressProvider(
mPreemptiveProgressProvider);
} else {
mProgressProvider = new ScopedUnfoldTransitionProgressProvider(
unfoldTransitionProgressProvider);
}
mProgressProvider = new ScopedUnfoldTransitionProgressProvider(
mPreemptiveProgressProvider);
unfoldTransitionProgressProvider.addCallback(mExternalTransitionStatusProvider);
unfoldTransitionProgressProvider.addCallback(
@@ -169,10 +163,6 @@ public class LauncherUnfoldAnimationController implements OnDeviceProfileChangeL
@Override
public void onDeviceProfileChanged(DeviceProfile dp) {
if (!FeatureFlags.PREEMPTIVE_UNFOLD_ANIMATION_START.get()) {
return;
}
if (mIsTablet != null && dp.isTablet != mIsTablet) {
// We should preemptively start the animation only if:
// - We changed to the unfolded screen
@@ -22,7 +22,6 @@ import com.android.launcher3.Alarm
import com.android.launcher3.DeviceProfile
import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener
import com.android.launcher3.anim.PendingAnimation
import com.android.launcher3.config.FeatureFlags
import com.android.launcher3.uioverrides.QuickstepLauncher
import com.android.launcher3.util.ActivityLifecycleCallbacksAdapter
import com.android.systemui.unfold.UnfoldTransitionProgressProvider.TransitionProgressListener
@@ -30,7 +29,7 @@ import com.android.systemui.unfold.UnfoldTransitionProgressProvider.TransitionPr
/** Controls animations that are happening during unfolding foldable devices */
class LauncherUnfoldTransitionController(
private val launcher: QuickstepLauncher,
private val progressProvider: ProxyUnfoldTransitionProvider
private val progressProvider: ProxyUnfoldTransitionProvider,
) : OnDeviceProfileChangeListener, ActivityLifecycleCallbacksAdapter, TransitionProgressListener {
private var isTablet: Boolean? = null
@@ -57,10 +56,6 @@ class LauncherUnfoldTransitionController(
}
override fun onDeviceProfileChanged(dp: DeviceProfile) {
if (!FeatureFlags.PREEMPTIVE_UNFOLD_ANIMATION_START.get()) {
return
}
if (isTablet != null && dp.isTablet != isTablet) {
// We should preemptively start the animation only if:
// - We changed to the unfolded screen
@@ -93,7 +88,7 @@ class LauncherUnfoldTransitionController(
provider = this,
factory = this::onPrepareUnfoldAnimation,
duration =
1000L // The expected duration for the animation. Then only comes to play if we have
1000L, // The expected duration for the animation. Then only comes to play if we have
// to run the animation ourselves in case sysui misses the end signal
)
timeoutAlarm.cancelAlarm()
@@ -119,7 +114,7 @@ class LauncherUnfoldTransitionController(
launcher,
isVertical,
dp.displayInfo.currentSize,
anim
anim,
)
}
@@ -46,7 +46,6 @@ import androidx.annotation.VisibleForTesting
import androidx.core.view.updateLayoutParams
import com.android.app.animation.Interpolators
import com.android.launcher3.Flags.enableCursorHoverStates
import com.android.launcher3.Flags.enableFocusOutline
import com.android.launcher3.Flags.enableGridOnlyOverview
import com.android.launcher3.Flags.enableHoverOfChildElementsInTaskview
import com.android.launcher3.Flags.enableLargeDesktopWindowingTile
@@ -55,7 +54,6 @@ import com.android.launcher3.Flags.enableRefactorTaskThumbnail
import com.android.launcher3.R
import com.android.launcher3.Utilities
import com.android.launcher3.anim.AnimatedFloat
import com.android.launcher3.config.FeatureFlags.ENABLE_KEYBOARD_QUICK_SWITCH
import com.android.launcher3.logging.StatsLogManager.LauncherEvent
import com.android.launcher3.model.data.ItemInfo
import com.android.launcher3.testing.TestLogging
@@ -201,14 +199,14 @@ constructor(
get() =
pagedOrientationHandler.getPrimaryValue(
SPLIT_SELECT_TRANSLATION_X,
SPLIT_SELECT_TRANSLATION_Y
SPLIT_SELECT_TRANSLATION_Y,
)
protected val secondarySplitTranslationProperty: FloatProperty<TaskView>
get() =
pagedOrientationHandler.getSecondaryValue(
SPLIT_SELECT_TRANSLATION_X,
SPLIT_SELECT_TRANSLATION_Y
SPLIT_SELECT_TRANSLATION_Y,
)
protected val primaryDismissTranslationProperty: FloatProperty<TaskView>
@@ -223,21 +221,21 @@ constructor(
get() =
pagedOrientationHandler.getPrimaryValue(
TASK_OFFSET_TRANSLATION_X,
TASK_OFFSET_TRANSLATION_Y
TASK_OFFSET_TRANSLATION_Y,
)
protected val secondaryTaskOffsetTranslationProperty: FloatProperty<TaskView>
get() =
pagedOrientationHandler.getSecondaryValue(
TASK_OFFSET_TRANSLATION_X,
TASK_OFFSET_TRANSLATION_Y
TASK_OFFSET_TRANSLATION_Y,
)
protected val taskResistanceTranslationProperty: FloatProperty<TaskView>
get() =
pagedOrientationHandler.getSecondaryValue(
TASK_RESISTANCE_TRANSLATION_X,
TASK_RESISTANCE_TRANSLATION_Y
TASK_RESISTANCE_TRANSLATION_Y,
)
private val tempCoordinates = FloatArray(2)
@@ -435,7 +433,7 @@ constructor(
field = value
Log.d(
TAG,
"${taskIds.contentToString()} - setting border animator visibility to: $field"
"${taskIds.contentToString()} - setting border animator visibility to: $field",
)
hoverBorderAnimator?.setBorderVisibility(visible = field, animated = true)
}
@@ -455,7 +453,7 @@ constructor(
FOCUS_TRANSITION,
FOCUS_TRANSITION_INDEX_COUNT,
{ x: Float, y: Float -> x * y },
1f
1f,
)
private val focusTransitionFullscreen =
focusTransitionPropertyFactory.get(FOCUS_TRANSITION_INDEX_FULLSCREEN)
@@ -486,27 +484,23 @@ constructor(
taskViewModel = RecentsDependencies.get(this, "TaskViewType" to type)
}
val keyboardFocusHighlightEnabled =
(ENABLE_KEYBOARD_QUICK_SWITCH.get() || enableFocusOutline())
val cursorHoverStatesEnabled = enableCursorHoverStates()
setWillNotDraw(!keyboardFocusHighlightEnabled && !cursorHoverStatesEnabled)
setWillNotDraw(!cursorHoverStatesEnabled)
context.obtainStyledAttributes(attrs, R.styleable.TaskView, defStyleAttr, defStyleRes).use {
this.focusBorderAnimator =
focusBorderAnimator
?: if (keyboardFocusHighlightEnabled)
createSimpleBorderAnimator(
currentFullscreenParams.cornerRadius.toInt(),
context.resources.getDimensionPixelSize(
R.dimen.keyboard_quick_switch_border_width
),
{ bounds: Rect -> getThumbnailBounds(bounds) },
this,
it.getColor(
R.styleable.TaskView_focusBorderColor,
BorderAnimator.DEFAULT_BORDER_COLOR
)
)
else null
?: createSimpleBorderAnimator(
currentFullscreenParams.cornerRadius.toInt(),
context.resources.getDimensionPixelSize(
R.dimen.keyboard_quick_switch_border_width
),
{ bounds: Rect -> getThumbnailBounds(bounds) },
this,
it.getColor(
R.styleable.TaskView_focusBorderColor,
BorderAnimator.DEFAULT_BORDER_COLOR,
),
)
this.hoverBorderAnimator =
hoverBorderAnimator
?: if (cursorHoverStatesEnabled)
@@ -519,8 +513,8 @@ constructor(
this,
it.getColor(
R.styleable.TaskView_hoverBorderColor,
BorderAnimator.DEFAULT_BORDER_COLOR
)
BorderAnimator.DEFAULT_BORDER_COLOR,
),
)
else null
}
@@ -634,7 +628,7 @@ constructor(
addAction(
AccessibilityAction(
R.id.action_close,
context.getText(R.string.accessibility_close)
context.getText(R.string.accessibility_close),
)
)
@@ -658,7 +652,7 @@ constructor(
1,
it.taskViewCount - it.indexOfChild(this@TaskView) - 1,
1,
false
false,
)
}
}
@@ -704,7 +698,7 @@ constructor(
R.id.show_windows,
R.id.digital_wellbeing_toast,
STAGE_POSITION_UNDEFINED,
taskOverlayFactory
taskOverlayFactory,
)
)
taskContainers.forEach { it.bind() }
@@ -742,7 +736,7 @@ constructor(
stagePosition,
digitalWellBeingToast,
findViewById(showWindowViewId)!!,
taskOverlayFactory
taskOverlayFactory,
)
}
@@ -860,7 +854,7 @@ constructor(
if (relativeToDragLayer) {
container.dragLayer.getDescendantRectRelativeToSelf(
it.snapshotView,
thumbnailBounds
thumbnailBounds,
)
} else {
thumbnailBounds.set(it.snapshotView)
@@ -979,7 +973,7 @@ constructor(
@JvmOverloads
open fun setShouldShowScreenshot(
shouldShowScreenshot: Boolean,
thumbnailDatas: Map<Int, ThumbnailData?>? = null
thumbnailDatas: Map<Int, ThumbnailData?>? = null,
) {
if (this.shouldShowScreenshot == shouldShowScreenshot) return
this.shouldShowScreenshot = shouldShowScreenshot
@@ -1030,7 +1024,7 @@ constructor(
if (!isClickableAsLiveTile) {
Log.e(
TAG,
"launchAsLiveTile - TaskView is not clickable as a live tile; returning to home: ${taskIds.contentToString()}"
"launchAsLiveTile - TaskView is not clickable as a live tile; returning to home: ${taskIds.contentToString()}",
)
return null
}
@@ -1049,7 +1043,7 @@ constructor(
apps.toTypedArray(),
wallpapers.toTypedArray(),
remoteTargetHandles[0].transformParams.targetSet.nonApps,
remoteTargetHandles[0].transformParams.targetSet.targetMode
remoteTargetHandles[0].transformParams.targetSet.targetMode,
)
}
if (targets == null) {
@@ -1059,7 +1053,7 @@ constructor(
if (runnableList == null) {
Log.e(
TAG,
"launchAsLiveTile - Recents animation cancelled and cannot launch task as non-live tile; returning to home: ${taskIds.contentToString()}"
"launchAsLiveTile - Recents animation cancelled and cannot launch task as non-live tile; returning to home: ${taskIds.contentToString()}",
)
}
isClickableAsLiveTile = true
@@ -1068,7 +1062,7 @@ constructor(
TestLogging.recordEvent(
TestProtocol.SEQUENCE_MAIN,
"composeRecentsLaunchAnimator",
taskIds.contentToString()
taskIds.contentToString(),
)
val runnableList = RunnableList()
with(AnimatorSet()) {
@@ -1081,7 +1075,7 @@ constructor(
true /* launcherClosing */,
recentsView.stateManager,
recentsView,
recentsView.depthController
recentsView.depthController,
)
addListener(
object : AnimatorListenerAdapter() {
@@ -1118,7 +1112,7 @@ constructor(
TestLogging.recordEvent(
TestProtocol.SEQUENCE_MAIN,
"startActivityFromRecentsAsync",
taskIds.contentToString()
taskIds.contentToString(),
)
val opts =
container.getActivityLaunchOptions(this, null).apply {
@@ -1130,7 +1124,7 @@ constructor(
) {
Log.d(
TAG,
"launchAsStaticTile - startActivityFromRecents: ${taskIds.contentToString()}"
"launchAsStaticTile - startActivityFromRecents: ${taskIds.contentToString()}",
)
ActiveGestureLog.INSTANCE.trackEvent(
ActiveGestureErrorDetector.GestureEvent.EXPECTING_TASK_APPEARED
@@ -1163,12 +1157,12 @@ constructor(
@JvmOverloads
open fun launchWithoutAnimation(
isQuickSwitch: Boolean = false,
callback: (launched: Boolean) -> Unit
callback: (launched: Boolean) -> Unit,
) {
TestLogging.recordEvent(
TestProtocol.SEQUENCE_MAIN,
"startActivityFromRecentsAsync",
taskIds.contentToString()
taskIds.contentToString(),
)
val firstContainer = taskContainers[0]
val failureListener = TaskRemovedDuringLaunchListener(context.applicationContext)
@@ -1199,7 +1193,7 @@ constructor(
0,
0,
Executors.MAIN_EXECUTOR.handler,
{ callback(true) }
{ callback(true) },
) {
failureListener.onTransitionFinished()
}
@@ -1227,7 +1221,7 @@ constructor(
}
Log.d(
TAG,
"launchWithoutAnimation - startActivityFromRecents: ${taskIds.contentToString()}"
"launchWithoutAnimation - startActivityFromRecents: ${taskIds.contentToString()}",
)
}
}
@@ -1246,7 +1240,7 @@ constructor(
recentsView?.initiateSplitSelect(
this,
splitPositionOption.stagePosition,
SplitConfigurationOptions.getLogEventForPosition(splitPositionOption.stagePosition)
SplitConfigurationOptions.getLogEventForPosition(splitPositionOption.stagePosition),
)
}
@@ -1269,7 +1263,7 @@ constructor(
container.splitAnimationThumbnail,
/* intent */ null,
/* user */ null,
container.itemInfo
container.itemInfo,
)
}
@@ -1374,13 +1368,13 @@ constructor(
this[0] = viewHalfWidth
this[1] = viewHalfHeight
},
false
false,
)
transformingTouchDelegate.setBounds(
(tempCenterCoordinates[0] - viewHalfWidth).toInt(),
(tempCenterCoordinates[1] - viewHalfHeight).toInt(),
(tempCenterCoordinates[0] + viewHalfWidth).toInt(),
(tempCenterCoordinates[1] + viewHalfHeight).toInt()
(tempCenterCoordinates[1] + viewHalfHeight).toInt(),
)
}
@@ -1390,7 +1384,7 @@ constructor(
it.showWindowsView?.let { showWindowsView ->
updateFilterCallback(
showWindowsView,
getFilterUpdateCallback(it.task.key.packageName)
getFilterUpdateCallback(it.task.key.packageName),
)
}
}
@@ -1710,7 +1704,7 @@ constructor(
Interpolators.clampToProgress(
Interpolators.FAST_OUT_SLOW_IN,
1f - FOCUS_TRANSITION_THRESHOLD,
1f
1f,
)!!
private val SYSTEM_GESTURE_EXCLUSION_RECT = listOf(Rect())
@@ -18,8 +18,6 @@ package com.android.launcher3;
import static android.view.MotionEvent.CLASSIFICATION_TWO_FINGER_SWIPE;
import static com.android.launcher3.config.FeatureFlags.ENABLE_TRACKPAD_GESTURE;
import android.annotation.TargetApi;
import android.os.Build;
import android.view.MotionEvent;
@@ -35,14 +33,12 @@ public class MotionEventsUtils {
@TargetApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
public static boolean isTrackpadScroll(MotionEvent event) {
return ENABLE_TRACKPAD_GESTURE.get()
&& event.getClassification() == CLASSIFICATION_TWO_FINGER_SWIPE;
return event.getClassification() == CLASSIFICATION_TWO_FINGER_SWIPE;
}
@TargetApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
public static boolean isTrackpadMultiFingerSwipe(MotionEvent event) {
return ENABLE_TRACKPAD_GESTURE.get()
&& event.getClassification() == CLASSIFICATION_MULTI_FINGER_SWIPE;
return event.getClassification() == CLASSIFICATION_MULTI_FINGER_SWIPE;
}
public static boolean isTrackpadThreeFingerSwipe(MotionEvent event) {
@@ -22,8 +22,6 @@ import static com.android.launcher3.allapps.ActivityAllAppsContainerView.Adapter
import static com.android.launcher3.allapps.BaseAllAppsAdapter.VIEW_TYPE_PRIVATE_SPACE_HEADER;
import static com.android.launcher3.allapps.BaseAllAppsAdapter.VIEW_TYPE_WORK_DISABLED_CARD;
import static com.android.launcher3.allapps.BaseAllAppsAdapter.VIEW_TYPE_WORK_EDU_CARD;
import static com.android.launcher3.config.FeatureFlags.ALL_APPS_GONE_VISIBILITY;
import static com.android.launcher3.config.FeatureFlags.ENABLE_ALL_APPS_RV_PREINFLATION;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_COUNT;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_TAP_ON_PERSONAL_TAB;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_TAP_ON_WORK_TAB;
@@ -679,18 +677,13 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
@NonNull AllAppsRecyclerView mainRecyclerView,
@Nullable AllAppsRecyclerView workRecyclerView,
@NonNull AllAppsRecyclerViewPool recycledViewPool) {
if (!ENABLE_ALL_APPS_RV_PREINFLATION.get()) {
return;
}
final boolean hasWorkProfile = workRecyclerView != null;
recycledViewPool.setHasWorkProfile(hasWorkProfile);
mainRecyclerView.setRecycledViewPool(recycledViewPool);
if (workRecyclerView != null) {
workRecyclerView.setRecycledViewPool(recycledViewPool);
}
if (ALL_APPS_GONE_VISIBILITY.get()) {
mainRecyclerView.updatePoolSize(hasWorkProfile);
}
mainRecyclerView.updatePoolSize(hasWorkProfile);
}
private void replaceAppsRVContainer(boolean showTabs) {
@@ -18,8 +18,6 @@ package com.android.launcher3.allapps;
import static androidx.constraintlayout.widget.ConstraintSet.MATCH_CONSTRAINT;
import static androidx.constraintlayout.widget.ConstraintSet.WRAP_CONTENT;
import static com.android.launcher3.config.FeatureFlags.ALL_APPS_GONE_VISIBILITY;
import static com.android.launcher3.config.FeatureFlags.ENABLE_ALL_APPS_RV_PREINFLATION;
import static com.android.launcher3.logger.LauncherAtom.ContainerInfo;
import static com.android.launcher3.logger.LauncherAtom.SearchResultContainer;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_PERSONAL_SCROLLED_DOWN;
@@ -124,13 +122,11 @@ public class AllAppsRecyclerView extends FastScrollRecyclerView {
// all apps.
int maxPoolSizeForAppIcons = grid.getMaxAllAppsRowCount()
* grid.numShownAllAppsColumns;
if (ALL_APPS_GONE_VISIBILITY.get() && ENABLE_ALL_APPS_RV_PREINFLATION.get()) {
// If we set all apps' hidden visibility to GONE and enable pre-inflation, we want to
// preinflate one page of all apps icons plus [PREINFLATE_ICONS_ROW_COUNT] rows +
// [EXTRA_ICONS_COUNT]. Thus we need to bump the max pool size of app icons accordingly.
maxPoolSizeForAppIcons +=
PREINFLATE_ICONS_ROW_COUNT * grid.numShownAllAppsColumns + EXTRA_ICONS_COUNT;
}
// If we set all apps' hidden visibility to GONE and enable pre-inflation, we want to
// preinflate one page of all apps icons plus [PREINFLATE_ICONS_ROW_COUNT] rows +
// [EXTRA_ICONS_COUNT]. Thus we need to bump the max pool size of app icons accordingly.
maxPoolSizeForAppIcons +=
PREINFLATE_ICONS_ROW_COUNT * grid.numShownAllAppsColumns + EXTRA_ICONS_COUNT;
if (hasWorkProfile) {
maxPoolSizeForAppIcons *= 2;
}
@@ -15,7 +15,6 @@
*/
package com.android.launcher3.allapps;
import static com.android.launcher3.config.FeatureFlags.ENABLE_ALL_APPS_RV_PREINFLATION;
import static com.android.launcher3.model.data.AppInfo.COMPONENT_KEY_COMPARATOR;
import static com.android.launcher3.model.data.AppInfo.EMPTY_ARRAY;
import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_SHOW_DOWNLOAD_PROGRESS_MASK;
@@ -109,7 +108,7 @@ public class AllAppsStore<T extends Context & ActivityContext> {
mPackageUserKeytoUidMap = map;
// Preinflate all apps RV when apps has changed, which can happen after unlocking screen,
// rotating screen, or downloading/upgrading apps.
if (shouldPreinflate && ENABLE_ALL_APPS_RV_PREINFLATION.get()) {
if (shouldPreinflate) {
mAllAppsRecyclerViewPool.preInflateAllAppsViewHolders(mContext);
}
}
@@ -54,7 +54,6 @@ import com.android.launcher3.R;
import com.android.launcher3.anim.AnimatedFloat;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.anim.PropertySetter;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.statemanager.StateManager.StateHandler;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.touch.AllAppsSwipeController;
@@ -413,8 +412,7 @@ public class AllAppsTransitionController
mAppsView = appsView;
mAppsView.setScrimView(scrimView);
mAppsViewAlpha = new MultiValueAlpha(mAppsView, APPS_VIEW_INDEX_COUNT,
FeatureFlags.ALL_APPS_GONE_VISIBILITY.get() ? View.GONE : View.INVISIBLE);
mAppsViewAlpha = new MultiValueAlpha(mAppsView, APPS_VIEW_INDEX_COUNT, View.GONE);
mAppsViewAlpha.setUpdateVisibility(true);
mAppsViewTranslationY = new MultiPropertyFactory<>(
mAppsView, VIEW_TRANSLATE_Y, APPS_VIEW_INDEX_COUNT, Float::sum);
@@ -66,8 +66,6 @@ public final class FeatureFlags {
public static final BooleanFlag ENABLE_DISMISS_PREDICTION_UNDO = getDebugFlag(270394476,
"ENABLE_DISMISS_PREDICTION_UNDO", DISABLED,
"Show an 'Undo' snackbar when users dismiss a predicted hotseat item");
public static final BooleanFlag CONTINUOUS_VIEW_TREE_CAPTURE = getDebugFlag(270395171,
"CONTINUOUS_VIEW_TREE_CAPTURE", ENABLED, "Capture View tree every frame");
public static final BooleanFlag ENABLE_WORKSPACE_LOADING_OPTIMIZATION = getDebugFlag(251502424,
"ENABLE_WORKSPACE_LOADING_OPTIMIZATION", DISABLED,
@@ -206,14 +204,6 @@ public final class FeatureFlags {
"ENABLE_SEARCH_UNINSTALLED_APPS", ENABLED, "Search uninstalled app results.");
// TODO(Block 20): Clean up flags
public static final BooleanFlag ENABLE_BACK_SWIPE_HOME_ANIMATION = getDebugFlag(270393426,
"ENABLE_BACK_SWIPE_HOME_ANIMATION", ENABLED,
"Enables home animation to icon when user swipes back.");
public static final BooleanFlag ENABLE_DYNAMIC_TASKBAR_THRESHOLDS = getDebugFlag(294252473,
"ENABLE_DYNAMIC_TASKBAR_THRESHOLDS", ENABLED,
"Enables taskbar thresholds that scale based on screen size.");
// Aconfig migration complete for ENABLE_HOME_TRANSITION_LISTENER.
public static final BooleanFlag ENABLE_HOME_TRANSITION_LISTENER = getDebugFlag(306053414,
"ENABLE_HOME_TRANSITION_LISTENER", DISABLED,
@@ -232,18 +222,7 @@ public final class FeatureFlags {
"ENABLE_WIDGET_TRANSITION_FOR_RESIZING", DISABLED,
"Enable widget transition animation when resizing the widgets");
public static final BooleanFlag PREEMPTIVE_UNFOLD_ANIMATION_START = getDebugFlag(270397209,
"PREEMPTIVE_UNFOLD_ANIMATION_START", ENABLED,
"Enables starting the unfold animation preemptively when unfolding, without"
+ "waiting for SystemUI and then merging the SystemUI progress whenever we "
+ "start receiving the events");
// TODO(Block 25): Clean up flags
public static final BooleanFlag ENABLE_NEW_GESTURE_NAV_TUTORIAL = getDebugFlag(270396257,
"ENABLE_NEW_GESTURE_NAV_TUTORIAL", ENABLED,
"Enable the redesigned gesture navigation tutorial");
// TODO(Block 26): Clean up flags
public static final BooleanFlag ENABLE_WIDGET_HOST_IN_BACKGROUND = getDebugFlag(270394384,
"ENABLE_WIDGET_HOST_IN_BACKGROUND", ENABLED,
"Enable background widget updates listening for widget holder");
@@ -268,10 +247,6 @@ public final class FeatureFlags {
"SEPARATE_RECENTS_ACTIVITY", DISABLED,
"Uses a separate recents activity instead of using the integrated recents+Launcher UI");
public static final BooleanFlag ENABLE_ENFORCED_ROUNDED_CORNERS = getReleaseFlag(270393258,
"ENABLE_ENFORCED_ROUNDED_CORNERS", ENABLED,
"Enforce rounded corners on all App Widgets");
public static final BooleanFlag USE_LOCAL_ICON_OVERRIDES = getDebugFlag(270394973,
"USE_LOCAL_ICON_OVERRIDES", ENABLED,
"Use inbuilt monochrome icons if app doesn't provide one");
@@ -285,21 +260,11 @@ public final class FeatureFlags {
com.android.wm.shell.Flags.enableSplitContextual();
}
public static final BooleanFlag ENABLE_TRACKPAD_GESTURE = getDebugFlag(271010401,
"ENABLE_TRACKPAD_GESTURE", ENABLED, "Enables trackpad gesture.");
// TODO(Block 29): Clean up flags
public static final BooleanFlag ENABLE_ALL_APPS_BUTTON_IN_HOTSEAT = getDebugFlag(270393897,
"ENABLE_ALL_APPS_BUTTON_IN_HOTSEAT", DISABLED,
"Enables displaying the all apps button in the hotseat.");
public static final BooleanFlag ENABLE_KEYBOARD_QUICK_SWITCH = getDebugFlag(270396844,
"ENABLE_KEYBOARD_QUICK_SWITCH", ENABLED, "Enables keyboard quick switching");
public static final BooleanFlag ENABLE_KEYBOARD_TASKBAR_TOGGLE = getDebugFlag(281726846,
"ENABLE_KEYBOARD_TASKBAR_TOGGLE", ENABLED,
"Enables keyboard taskbar stash toggling");
// TODO(Block 30): Clean up flags
public static final BooleanFlag USE_SEARCH_REQUEST_TIMEOUT_OVERRIDES = getDebugFlag(270395010,
"USE_SEARCH_REQUEST_TIMEOUT_OVERRIDES", DISABLED,
@@ -317,14 +282,6 @@ public final class FeatureFlags {
return ENABLE_RESPONSIVE_WORKSPACE.get() || Flags.enableResponsiveWorkspace();
}
// TODO(Block 33): Clean up flags
public static final BooleanFlag ENABLE_ALL_APPS_RV_PREINFLATION = getDebugFlag(288161355,
"ENABLE_ALL_APPS_RV_PREINFLATION", ENABLED,
"Enables preinflating all apps icons to avoid scrolling jank.");
public static final BooleanFlag ALL_APPS_GONE_VISIBILITY = getDebugFlag(291651514,
"ALL_APPS_GONE_VISIBILITY", ENABLED,
"Set all apps container view's hidden visibility to GONE instead of INVISIBLE.");
public static BooleanFlag getDebugFlag(
int bugId, String key, BooleanFlag flagState, String description) {
return flagState;
@@ -24,7 +24,6 @@ import androidx.recyclerview.widget.RecyclerView.ViewHolder
import com.android.launcher3.BubbleTextView
import com.android.launcher3.BuildConfig
import com.android.launcher3.allapps.BaseAllAppsAdapter
import com.android.launcher3.config.FeatureFlags
import com.android.launcher3.util.CancellableTask
import com.android.launcher3.util.Executors.MAIN_EXECUTOR
import com.android.launcher3.util.Executors.VIEW_PREINFLATION_EXECUTOR
@@ -78,7 +77,7 @@ class AllAppsRecyclerViewPool<T> : RecycledViewPool() {
ActivityContextDelegate(
context.createConfigurationContext(context.resources.configuration),
Themes.getActivityThemeRes(context),
context
context,
)
// Because we perform onCreateViewHolder() on worker thread, we need a separate
@@ -91,7 +90,7 @@ class AllAppsRecyclerViewPool<T> : RecycledViewPool() {
context,
context.appsView.layoutInflater.cloneInContext(allAppsPreInflationContext),
null,
null
null,
) {
override fun setAppsPerRow(appsPerRow: Int) = Unit
@@ -124,7 +123,7 @@ class AllAppsRecyclerViewPool<T> : RecycledViewPool() {
for (i in 0 until minOf(viewHolders.size, getPreinflateCount(context))) {
putRecycledView(viewHolders[i])
}
}
},
)
mCancellableTask = task
VIEW_PREINFLATION_EXECUTOR.submit(mCancellableTask)
@@ -144,18 +143,15 @@ class AllAppsRecyclerViewPool<T> : RecycledViewPool() {
* app icons plus [EXTRA_ICONS_COUNT] is the magic minimal count of app icons to preinflate to
* suffice fast scrolling.
*
* Note that if [FeatureFlags.ALL_APPS_GONE_VISIBILITY] is enabled, we need to preinfate extra
* app icons in size of one all apps pages, so that opening all apps don't need to inflate app
* icons.
* Note that we need to preinfate extra app icons in size of one all apps pages, so that opening
* all apps don't need to inflate app icons.
*/
fun <T> getPreinflateCount(context: T): Int where T : Context, T : ActivityContext {
var targetPreinflateCount =
PREINFLATE_ICONS_ROW_COUNT * context.deviceProfile.numShownAllAppsColumns +
EXTRA_ICONS_COUNT
if (FeatureFlags.ALL_APPS_GONE_VISIBILITY.get()) {
val grid = ActivityContext.lookupContext<T>(context).deviceProfile
targetPreinflateCount += grid.maxAllAppsRowCount * grid.numShownAllAppsColumns
}
val grid = ActivityContext.lookupContext<T>(context).deviceProfile
targetPreinflateCount += grid.maxAllAppsRowCount * grid.numShownAllAppsColumns
if (hasWorkProfile) {
targetPreinflateCount *= 2
}
@@ -29,7 +29,6 @@ import androidx.annotation.Nullable;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
import java.util.ArrayList;
import java.util.List;
@@ -73,7 +72,7 @@ public class RoundedCornerEnforcement {
/** Check if the app widget is in the deny list. */
public static boolean isRoundedCornerEnabled() {
return Utilities.ATLEAST_S && FeatureFlags.ENABLE_ENFORCED_ROUNDED_CORNERS.get();
return Utilities.ATLEAST_S;
}
/**