diff --git a/Android.mk b/Android.mk index 7805b32e8e..752b530ab0 100644 --- a/Android.mk +++ b/Android.mk @@ -48,7 +48,7 @@ LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/protos/ --proto_path=$(LOCAL_PA LOCAL_PROTO_JAVA_OUTPUT_PARAMS := enum_style=java LOCAL_SDK_VERSION := current -LOCAL_MIN_SDK_VERSION := 21 +LOCAL_MIN_SDK_VERSION := 26 LOCAL_MODULE := Launcher3CommonDepsLib LOCAL_PRIVILEGED_MODULE := true LOCAL_MANIFEST_FILE := AndroidManifest-common.xml @@ -77,7 +77,7 @@ LOCAL_PROGUARD_FLAG_FILES := proguard.flags LOCAL_PROGUARD_ENABLED := disabled LOCAL_SDK_VERSION := current -LOCAL_MIN_SDK_VERSION := 21 +LOCAL_MIN_SDK_VERSION := 26 LOCAL_PACKAGE_NAME := Launcher3 LOCAL_PRIVILEGED_MODULE := true LOCAL_SYSTEM_EXT_MODULE := true @@ -108,7 +108,7 @@ LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/go/res LOCAL_PROGUARD_FLAG_FILES := proguard.flags LOCAL_SDK_VERSION := current -LOCAL_MIN_SDK_VERSION := 21 +LOCAL_MIN_SDK_VERSION := 26 LOCAL_PACKAGE_NAME := Launcher3Go LOCAL_PRIVILEGED_MODULE := true LOCAL_SYSTEM_EXT_MODULE := true @@ -149,12 +149,9 @@ LOCAL_STATIC_ANDROID_LIBRARIES := Launcher3CommonDepsLib LOCAL_SRC_FILES := \ $(call all-java-files-under, src) \ $(call all-java-files-under, quickstep/src) \ - $(call all-java-files-under, quickstep/recents_ui_overrides/src) \ $(call all-java-files-under, src_shortcuts_overrides) -LOCAL_RESOURCE_DIR := \ - $(LOCAL_PATH)/quickstep/res \ - $(LOCAL_PATH)/quickstep/recents_ui_overrides/res +LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/quickstep/res LOCAL_PROGUARD_ENABLED := disabled @@ -183,9 +180,7 @@ LOCAL_SYSTEM_EXT_MODULE := true LOCAL_OVERRIDES_PACKAGES := Home Launcher2 Launcher3 LOCAL_REQUIRED_MODULES := privapp_whitelist_com.android.launcher3 -LOCAL_RESOURCE_DIR := \ - $(LOCAL_PATH)/quickstep/res \ - $(LOCAL_PATH)/quickstep/recents_ui_overrides/res +LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/quickstep/res LOCAL_FULL_LIBS_MANIFEST_FILES := \ $(LOCAL_PATH)/quickstep/AndroidManifest-launcher.xml \ @@ -220,12 +215,10 @@ LOCAL_STATIC_ANDROID_LIBRARIES := Launcher3CommonDepsLib LOCAL_SRC_FILES := \ $(call all-java-files-under, src) \ $(call all-java-files-under, quickstep/src) \ - $(call all-java-files-under, quickstep/recents_ui_overrides/src) \ $(call all-java-files-under, go/src) LOCAL_RESOURCE_DIR := \ $(LOCAL_PATH)/quickstep/res \ - $(LOCAL_PATH)/quickstep/recents_ui_overrides/res \ $(LOCAL_PATH)/go/res LOCAL_PROGUARD_FLAG_FILES := proguard.flags diff --git a/AndroidManifest-common.xml b/AndroidManifest-common.xml index 19a16e341a..97e3786a36 100644 --- a/AndroidManifest-common.xml +++ b/AndroidManifest-common.xml @@ -29,12 +29,6 @@ at compile time. Note that the components defined in AndroidManifest.xml are also required, with some minor changed based on the derivative app. --> - @@ -79,17 +73,6 @@ android:restoreAnyVersion="true" android:supportsRtl="true" > - - - - - - - diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 4664c9315a..97bce9c1d7 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -20,7 +20,7 @@ - + - - - - 60dp - \ No newline at end of file diff --git a/go/src/com/android/launcher3/model/LoaderResults.java b/go/src/com/android/launcher3/model/LoaderResults.java index 713053191d..5f71061a6e 100644 --- a/go/src/com/android/launcher3/model/LoaderResults.java +++ b/go/src/com/android/launcher3/model/LoaderResults.java @@ -20,7 +20,6 @@ import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import com.android.launcher3.LauncherAppState; import com.android.launcher3.model.BgDataModel.Callbacks; -import com.android.launcher3.util.LooperExecutor; /** * Helper class to handle results of {@link com.android.launcher3.model.LoaderTask}. @@ -29,12 +28,7 @@ public class LoaderResults extends BaseLoaderResults { public LoaderResults(LauncherAppState app, BgDataModel dataModel, AllAppsList allAppsList, Callbacks[] callbacks) { - this(app, dataModel, allAppsList, callbacks, MAIN_EXECUTOR); - } - - public LoaderResults(LauncherAppState app, BgDataModel dataModel, - AllAppsList allAppsList, Callbacks[] callbacks, LooperExecutor executor) { - super(app, dataModel, allAppsList, callbacks, executor); + super(app, dataModel, allAppsList, callbacks, MAIN_EXECUTOR); } @Override diff --git a/quickstep/recents_ui_overrides/res/values/colors.xml b/quickstep/recents_ui_overrides/res/values/colors.xml deleted file mode 100644 index f03f118f38..0000000000 --- a/quickstep/recents_ui_overrides/res/values/colors.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - #fff - #39000000 - - #61000000 - #61FFFFFF - #3c000000 - #3cffffff - \ No newline at end of file diff --git a/quickstep/recents_ui_overrides/res/values/config.xml b/quickstep/recents_ui_overrides/res/values/config.xml deleted file mode 100644 index 120e03456f..0000000000 --- a/quickstep/recents_ui_overrides/res/values/config.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - 150 - \ No newline at end of file diff --git a/quickstep/recents_ui_overrides/res/values/dimens.xml b/quickstep/recents_ui_overrides/res/values/dimens.xml deleted file mode 100644 index 9266b0652b..0000000000 --- a/quickstep/recents_ui_overrides/res/values/dimens.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - 1dp - 20dp - 20dp - 10dp - 12dp - 20dp - 16dp - 2dp - 16dp - 26dp - 4dp - 10dp - 14sp - - 17dp - 16dp - 8dp - 14sp - - - 80dp - \ No newline at end of file diff --git a/quickstep/recents_ui_overrides/src/REMOVED.txt b/quickstep/recents_ui_overrides/src/REMOVED.txt new file mode 100644 index 0000000000..c3a3eaf692 --- /dev/null +++ b/quickstep/recents_ui_overrides/src/REMOVED.txt @@ -0,0 +1,2 @@ +Temp file to prevent build breakage. +Will be removed in followup cl. \ No newline at end of file diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/model/QuickstepModelDelegate.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/model/QuickstepModelDelegate.java deleted file mode 100644 index b5164695d5..0000000000 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/model/QuickstepModelDelegate.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (C) 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.launcher3.model; - -import static com.android.launcher3.InvariantDeviceProfile.CHANGE_FLAG_GRID; -import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_PREDICTION; - -import android.app.prediction.AppPredictionContext; -import android.app.prediction.AppPredictionManager; -import android.app.prediction.AppPredictor; -import android.app.prediction.AppTarget; -import android.app.prediction.AppTargetEvent; -import android.content.Context; - -import androidx.annotation.WorkerThread; - -import com.android.launcher3.InvariantDeviceProfile; -import com.android.launcher3.InvariantDeviceProfile.OnIDPChangeListener; -import com.android.launcher3.model.BgDataModel.FixedContainerItems; -import com.android.launcher3.util.Executors; -import com.android.quickstep.logging.StatsLogCompatManager; - -import java.util.List; - -/** - * Model delegate which loads prediction items - */ -public class QuickstepModelDelegate extends ModelDelegate implements OnIDPChangeListener { - - public static final String LAST_PREDICTION_ENABLED_STATE = "last_prediction_enabled_state"; - - private final InvariantDeviceProfile mIDP; - private final AppEventProducer mAppEventProducer; - - private AppPredictor mAllAppsPredictor; - private boolean mActive = false; - - public QuickstepModelDelegate(Context context) { - mAppEventProducer = new AppEventProducer(context, this::onAppTargetEvent); - - mIDP = InvariantDeviceProfile.INSTANCE.get(context); - mIDP.addOnChangeListener(this); - StatsLogCompatManager.LOGS_CONSUMER.add(mAppEventProducer); - } - - @Override - public void loadItems() { - // TODO: Implement caching and preloading - super.loadItems(); - mDataModel.extraItems.put( - CONTAINER_PREDICTION, new FixedContainerItems(CONTAINER_PREDICTION)); - - mActive = true; - recreatePredictors(); - } - - @Override - public void validateData() { - super.validateData(); - if (mAllAppsPredictor != null) { - mAllAppsPredictor.requestPredictionUpdate(); - } - } - - @Override - public void destroy() { - super.destroy(); - mActive = false; - StatsLogCompatManager.LOGS_CONSUMER.remove(mAppEventProducer); - - destroyPredictors(); - mIDP.removeOnChangeListener(this); - } - - private void destroyPredictors() { - if (mAllAppsPredictor != null) { - mAllAppsPredictor.destroy(); - mAllAppsPredictor = null; - } - } - - @WorkerThread - private void recreatePredictors() { - destroyPredictors(); - if (!mActive) { - return; - } - - Context context = mApp.getContext(); - AppPredictionManager apm = context.getSystemService(AppPredictionManager.class); - if (apm == null) { - return; - } - - int count = mIDP.numAllAppsColumns; - - mAllAppsPredictor = apm.createAppPredictionSession( - new AppPredictionContext.Builder(context) - .setUiSurface("home") - .setPredictedTargetCount(count) - .build()); - mAllAppsPredictor.registerPredictionUpdates( - Executors.MODEL_EXECUTOR, this::onAllAppsPredictionChanged); - mAllAppsPredictor.requestPredictionUpdate(); - } - - private void onAllAppsPredictionChanged(List targets) { - mApp.getModel().enqueueModelUpdateTask( - new PredictionUpdateTask(CONTAINER_PREDICTION, targets)); - } - - @Override - public void onIdpChanged(int changeFlags, InvariantDeviceProfile profile) { - if ((changeFlags & CHANGE_FLAG_GRID) != 0) { - // Reinitialize everything - Executors.MODEL_EXECUTOR.execute(this::recreatePredictors); - } - } - - private void onAppTargetEvent(AppTargetEvent event) { - if (mAllAppsPredictor != null) { - mAllAppsPredictor.notifyAppTargetEvent(event); - } - } -} diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewPeekState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewPeekState.java deleted file mode 100644 index fc9a11bf66..0000000000 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewPeekState.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.launcher3.uioverrides.states; - -import com.android.launcher3.Launcher; - -public class OverviewPeekState extends OverviewState { - private static final float OVERVIEW_OFFSET = 0.7f; - - public OverviewPeekState(int id) { - super(id); - } - - @Override - public float[] getOverviewScaleAndOffset(Launcher launcher) { - return new float[] {NO_SCALE, OVERVIEW_OFFSET}; - } -} diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java deleted file mode 100644 index fac478e777..0000000000 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.launcher3.uioverrides.touchcontrollers; - -import static com.android.launcher3.LauncherState.ALL_APPS; -import static com.android.launcher3.LauncherState.NORMAL; -import static com.android.launcher3.LauncherState.OVERVIEW; -import static com.android.launcher3.LauncherState.OVERVIEW_PEEK; -import static com.android.launcher3.anim.Interpolators.ACCEL; -import static com.android.launcher3.anim.Interpolators.DEACCEL; -import static com.android.launcher3.anim.Interpolators.DEACCEL_3; -import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE; -import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_HEADER_FADE; -import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE; -import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCALE; -import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE; -import static com.android.launcher3.states.StateAnimationConfig.PLAY_ATOMIC_OVERVIEW_PEEK; -import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW; -import static com.android.launcher3.uioverrides.states.QuickstepAtomicAnimationFactory.INDEX_PAUSE_TO_OVERVIEW_ANIM; -import static com.android.launcher3.util.VibratorWrapper.OVERVIEW_HAPTIC; -import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED; - -import android.animation.Animator; -import android.animation.AnimatorListenerAdapter; -import android.animation.AnimatorSet; -import android.util.Log; -import android.view.MotionEvent; -import android.view.View; -import android.view.ViewConfiguration; - -import com.android.launcher3.Launcher; -import com.android.launcher3.LauncherState; -import com.android.launcher3.anim.AnimationSuccessListener; -import com.android.launcher3.anim.Interpolators; -import com.android.launcher3.states.StateAnimationConfig; -import com.android.launcher3.states.StateAnimationConfig.AnimationFlags; -import com.android.launcher3.testing.TestProtocol; -import com.android.launcher3.uioverrides.states.QuickstepAtomicAnimationFactory; -import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; -import com.android.launcher3.util.VibratorWrapper; -import com.android.quickstep.SystemUiProxy; -import com.android.quickstep.util.MotionPauseDetector; -import com.android.quickstep.views.RecentsView; - -/** - * Touch controller which handles swipe and hold to go to Overview - */ -public class FlingAndHoldTouchController extends PortraitStatesTouchController { - - private static final long PEEK_IN_ANIM_DURATION = 240; - private static final long PEEK_OUT_ANIM_DURATION = 100; - private static final float MAX_DISPLACEMENT_PERCENT = 0.75f; - - protected final MotionPauseDetector mMotionPauseDetector; - private final float mMotionPauseMinDisplacement; - private final float mMotionPauseMaxDisplacement; - - private AnimatorSet mPeekAnim; - - public FlingAndHoldTouchController(Launcher l) { - super(l, false /* allowDragToOverview */); - mMotionPauseDetector = new MotionPauseDetector(l); - mMotionPauseMinDisplacement = ViewConfiguration.get(l).getScaledTouchSlop(); - mMotionPauseMaxDisplacement = getMotionPauseMaxDisplacement(); - } - - protected float getMotionPauseMaxDisplacement() { - return getShiftRange() * MAX_DISPLACEMENT_PERCENT; - } - - @Override - protected long getAtomicDuration() { - return QuickstepAtomicAnimationFactory.ATOMIC_DURATION_FROM_PAUSED_TO_OVERVIEW; - } - - @Override - public void onDragStart(boolean start, float startDisplacement) { - mMotionPauseDetector.clear(); - - super.onDragStart(start, startDisplacement); - - if (handlingOverviewAnim()) { - mMotionPauseDetector.setOnMotionPauseListener(this::onMotionPauseChanged); - } - - if (mAtomicAnim != null) { - mAtomicAnim.cancel(); - } - } - - protected void onMotionPauseChanged(boolean isPaused) { - RecentsView recentsView = mLauncher.getOverviewPanel(); - recentsView.setOverviewStateEnabled(isPaused); - if (mPeekAnim != null) { - mPeekAnim.cancel(); - } - LauncherState fromState = isPaused ? NORMAL : OVERVIEW_PEEK; - LauncherState toState = isPaused ? OVERVIEW_PEEK : NORMAL; - long peekDuration = isPaused ? PEEK_IN_ANIM_DURATION : PEEK_OUT_ANIM_DURATION; - - StateAnimationConfig config = new StateAnimationConfig(); - config.duration = peekDuration; - config.animFlags = PLAY_ATOMIC_OVERVIEW_PEEK; - mPeekAnim = mLauncher.getStateManager().createAtomicAnimation( - fromState, toState, config); - mPeekAnim.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationEnd(Animator animation) { - mPeekAnim = null; - } - }); - mPeekAnim.start(); - VibratorWrapper.INSTANCE.get(mLauncher).vibrate(OVERVIEW_HAPTIC); - - mLauncher.getDragLayer().getScrim().createSysuiMultiplierAnim(isPaused ? 0 : 1) - .setDuration(peekDuration).start(); - } - - /** - * @return Whether we are handling the overview animation, rather than - * having it as part of the existing animation to the target state. - */ - protected boolean handlingOverviewAnim() { - int stateFlags = SystemUiProxy.INSTANCE.get(mLauncher).getLastSystemUiStateFlags(); - return mStartState == NORMAL && (stateFlags & SYSUI_STATE_OVERVIEW_DISABLED) == 0; - } - - @Override - protected StateAnimationConfig getConfigForStates( - LauncherState fromState, LauncherState toState) { - if (fromState == NORMAL && toState == ALL_APPS) { - StateAnimationConfig builder = new StateAnimationConfig(); - // Fade in prediction icons quickly, then rest of all apps after reaching overview. - float progressToReachOverview = NORMAL.getVerticalProgress(mLauncher) - - OVERVIEW.getVerticalProgress(mLauncher); - builder.setInterpolator(ANIM_ALL_APPS_HEADER_FADE, Interpolators.clampToProgress( - ACCEL, - 0, - ALL_APPS_CONTENT_FADE_THRESHOLD)); - builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress( - ACCEL, - progressToReachOverview, - progressToReachOverview + ALL_APPS_CONTENT_FADE_THRESHOLD)); - - // Get workspace out of the way quickly, to prepare for potential pause. - builder.setInterpolator(ANIM_WORKSPACE_SCALE, DEACCEL_3); - builder.setInterpolator(ANIM_WORKSPACE_TRANSLATE, DEACCEL_3); - builder.setInterpolator(ANIM_WORKSPACE_FADE, DEACCEL_3); - return builder; - } else if (fromState == ALL_APPS && toState == NORMAL) { - StateAnimationConfig builder = new StateAnimationConfig(); - // Keep all apps/predictions opaque until the very end of the transition. - float progressToReachOverview = OVERVIEW.getVerticalProgress(mLauncher); - builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress( - DEACCEL, - progressToReachOverview - ALL_APPS_CONTENT_FADE_THRESHOLD, - progressToReachOverview)); - builder.setInterpolator(ANIM_ALL_APPS_HEADER_FADE, Interpolators.clampToProgress( - DEACCEL, - 1 - ALL_APPS_CONTENT_FADE_THRESHOLD, - 1)); - return builder; - } - return super.getConfigForStates(fromState, toState); - } - - @Override - public boolean onDrag(float displacement, MotionEvent event) { - if (TestProtocol.sDebugTracing) { - Log.d(TestProtocol.PAUSE_NOT_DETECTED, "FlingAndHoldTouchController"); - } - float upDisplacement = -displacement; - mMotionPauseDetector.setDisallowPause(!handlingOverviewAnim() - || upDisplacement < mMotionPauseMinDisplacement - || upDisplacement > mMotionPauseMaxDisplacement); - mMotionPauseDetector.addPosition(event); - return super.onDrag(displacement, event); - } - - @Override - public void onDragEnd(float velocity) { - if (mMotionPauseDetector.isPaused() && handlingOverviewAnim()) { - goToOverviewOnDragEnd(velocity); - } else { - super.onDragEnd(velocity); - } - - View searchView = mLauncher.getAppsView().getSearchView(); - if (searchView instanceof FeedbackHandler) { - ((FeedbackHandler) searchView).resetFeedback(); - } - mMotionPauseDetector.clear(); - } - - protected void goToOverviewOnDragEnd(float velocity) { - if (mPeekAnim != null) { - mPeekAnim.cancel(); - } - - Animator overviewAnim = mLauncher.createAtomicAnimationFactory() - .createStateElementAnimation(INDEX_PAUSE_TO_OVERVIEW_ANIM); - mAtomicAnim = new AnimatorSet(); - mAtomicAnim.addListener(new AnimationSuccessListener() { - @Override - public void onAnimationSuccess(Animator animator) { - onSwipeInteractionCompleted(OVERVIEW, Touch.SWIPE); - } - - @Override - public void onAnimationEnd(Animator animation) { - super.onAnimationEnd(animation); - if (mCancelled) { - StateAnimationConfig config = new StateAnimationConfig(); - config.animFlags = PLAY_ATOMIC_OVERVIEW_PEEK; - config.duration = PEEK_OUT_ANIM_DURATION; - mPeekAnim = mLauncher.getStateManager().createAtomicAnimation( - mFromState, mToState, config); - mPeekAnim.start(); - } - mAtomicAnim = null; - } - }); - mAtomicAnim.play(overviewAnim); - mAtomicAnim.start(); - } - - @Override - protected void goToTargetState(LauncherState targetState, int logAction) { - if (mPeekAnim != null && mPeekAnim.isStarted()) { - // Don't jump to the target state until overview is no longer peeking. - mPeekAnim.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationEnd(Animator animation) { - FlingAndHoldTouchController.super.goToTargetState(targetState, logAction); - } - }); - } else { - super.goToTargetState(targetState, logAction); - } - } - - @Override - @AnimationFlags - protected int updateAnimComponentsOnReinit(@AnimationFlags int animComponents) { - if (handlingOverviewAnim()) { - // We don't want the state transition to all apps to animate overview, - // as that will cause a jump after our atomic animation. - return animComponents | SKIP_OVERVIEW; - } else { - return animComponents; - } - } - - /** - * Interface for views with feedback animation requiring reset - */ - public interface FeedbackHandler { - - /** - * reset searchWidget feedback - */ - void resetFeedback(); - } - -} diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ShelfPeekAnim.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ShelfPeekAnim.java deleted file mode 100644 index 85006da109..0000000000 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ShelfPeekAnim.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.quickstep.util; - -import static com.android.launcher3.LauncherState.BACKGROUND_APP; -import static com.android.launcher3.LauncherState.OVERVIEW; -import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_2; -import static com.android.launcher3.uioverrides.states.QuickstepAtomicAnimationFactory.INDEX_SHELF_ANIM; - -import android.animation.Animator; -import android.animation.AnimatorListenerAdapter; -import android.view.animation.Interpolator; - -import com.android.launcher3.Launcher; -import com.android.launcher3.config.FeatureFlags; -import com.android.launcher3.uioverrides.states.OverviewState; - -/** - * Animates the shelf between states HIDE, PEEK, and OVERVIEW. - */ -public class ShelfPeekAnim { - - public static final Interpolator INTERPOLATOR = OVERSHOOT_1_2; - public static final long DURATION = 240; - - private final Launcher mLauncher; - - private ShelfAnimState mShelfState; - private boolean mIsPeeking; - - public ShelfPeekAnim(Launcher launcher) { - mLauncher = launcher; - } - - /** - * Animates to the given state, canceling the previous animation if it was still running. - */ - public void setShelfState(ShelfAnimState shelfState, Interpolator interpolator, long duration) { - if (mShelfState == shelfState || FeatureFlags.ENABLE_OVERVIEW_ACTIONS.get()) { - return; - } - mLauncher.getStateManager().cancelStateElementAnimation(INDEX_SHELF_ANIM); - mShelfState = shelfState; - mIsPeeking = mShelfState == ShelfAnimState.PEEK || mShelfState == ShelfAnimState.HIDE; - if (mShelfState == ShelfAnimState.CANCEL) { - return; - } - float shelfHiddenProgress = BACKGROUND_APP.getVerticalProgress(mLauncher); - float shelfOverviewProgress = OVERVIEW.getVerticalProgress(mLauncher); - // Peek based on default overview progress so we can see hotseat if we're showing - // that instead of predictions in overview. - float defaultOverviewProgress = OverviewState.getDefaultVerticalProgress(mLauncher); - float shelfPeekingProgress = shelfHiddenProgress - - (shelfHiddenProgress - defaultOverviewProgress) * 0.25f; - float toProgress = mShelfState == ShelfAnimState.HIDE - ? shelfHiddenProgress - : mShelfState == ShelfAnimState.PEEK - ? shelfPeekingProgress - : shelfOverviewProgress; - Animator shelfAnim = mLauncher.getStateManager() - .createStateElementAnimation(INDEX_SHELF_ANIM, toProgress); - shelfAnim.setInterpolator(interpolator); - shelfAnim.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationCancel(Animator animation) { - mShelfState = ShelfAnimState.CANCEL; - } - - @Override - public void onAnimationEnd(Animator animator) { - mIsPeeking = mShelfState == ShelfAnimState.PEEK; - } - }); - shelfAnim.setDuration(duration).start(); - } - - /** @return Whether the shelf is currently peeking or animating to or from peeking. */ - public boolean isPeeking() { - return mIsPeeking; - } - - /** The various shelf states we can animate to. */ - public enum ShelfAnimState { - HIDE(true), PEEK(true), OVERVIEW(false), CANCEL(false); - - ShelfAnimState(boolean shouldPreformHaptic) { - this.shouldPreformHaptic = shouldPreformHaptic; - } - - public final boolean shouldPreformHaptic; - } -} diff --git a/quickstep/recents_ui_overrides/res/drawable/all_apps_edu_circle.xml b/quickstep/res/drawable/all_apps_edu_circle.xml similarity index 100% rename from quickstep/recents_ui_overrides/res/drawable/all_apps_edu_circle.xml rename to quickstep/res/drawable/all_apps_edu_circle.xml diff --git a/quickstep/recents_ui_overrides/res/drawable/chip_hint_background_light.xml b/quickstep/res/drawable/chip_hint_background_light.xml similarity index 100% rename from quickstep/recents_ui_overrides/res/drawable/chip_hint_background_light.xml rename to quickstep/res/drawable/chip_hint_background_light.xml diff --git a/quickstep/recents_ui_overrides/res/drawable/chip_scrim_gradient.xml b/quickstep/res/drawable/chip_scrim_gradient.xml similarity index 100% rename from quickstep/recents_ui_overrides/res/drawable/chip_scrim_gradient.xml rename to quickstep/res/drawable/chip_scrim_gradient.xml diff --git a/quickstep/recents_ui_overrides/res/drawable/hotseat_edu_notification_icon.xml b/quickstep/res/drawable/hotseat_edu_notification_icon.xml similarity index 100% rename from quickstep/recents_ui_overrides/res/drawable/hotseat_edu_notification_icon.xml rename to quickstep/res/drawable/hotseat_edu_notification_icon.xml diff --git a/quickstep/recents_ui_overrides/res/layout/all_apps_edu_view.xml b/quickstep/res/layout/all_apps_edu_view.xml similarity index 100% rename from quickstep/recents_ui_overrides/res/layout/all_apps_edu_view.xml rename to quickstep/res/layout/all_apps_edu_view.xml diff --git a/quickstep/recents_ui_overrides/res/layout/fallback_recents_activity.xml b/quickstep/res/layout/fallback_recents_activity.xml similarity index 100% rename from quickstep/recents_ui_overrides/res/layout/fallback_recents_activity.xml rename to quickstep/res/layout/fallback_recents_activity.xml diff --git a/quickstep/recents_ui_overrides/res/layout/floating_header_content.xml b/quickstep/res/layout/floating_header_content.xml similarity index 100% rename from quickstep/recents_ui_overrides/res/layout/floating_header_content.xml rename to quickstep/res/layout/floating_header_content.xml diff --git a/quickstep/res/layout/overview_clear_all_button.xml b/quickstep/res/layout/overview_clear_all_button.xml index fc06ba057f..34ff91df9a 100644 --- a/quickstep/res/layout/overview_clear_all_button.xml +++ b/quickstep/res/layout/overview_clear_all_button.xml @@ -23,5 +23,4 @@ android:text="@string/recents_clear_all" android:textColor="?attr/workspaceTextColor" android:textSize="14sp" - android:translationY="@dimen/task_thumbnail_half_top_margin" - /> \ No newline at end of file + android:translationY="@dimen/task_thumbnail_half_top_margin" /> \ No newline at end of file diff --git a/quickstep/recents_ui_overrides/res/layout/overview_panel.xml b/quickstep/res/layout/overview_panel.xml similarity index 100% rename from quickstep/recents_ui_overrides/res/layout/overview_panel.xml rename to quickstep/res/layout/overview_panel.xml diff --git a/quickstep/recents_ui_overrides/res/layout/predicted_app_icon.xml b/quickstep/res/layout/predicted_app_icon.xml similarity index 100% rename from quickstep/recents_ui_overrides/res/layout/predicted_app_icon.xml rename to quickstep/res/layout/predicted_app_icon.xml diff --git a/quickstep/recents_ui_overrides/res/layout/predicted_hotseat_edu.xml b/quickstep/res/layout/predicted_hotseat_edu.xml similarity index 100% rename from quickstep/recents_ui_overrides/res/layout/predicted_hotseat_edu.xml rename to quickstep/res/layout/predicted_hotseat_edu.xml diff --git a/quickstep/res/values/colors.xml b/quickstep/res/values/colors.xml index 40da136ff0..449fe108ef 100644 --- a/quickstep/res/values/colors.xml +++ b/quickstep/res/values/colors.xml @@ -16,4 +16,12 @@ #FFFFFFFF #99000000 + + #fff + #39000000 + + #61000000 + #61FFFFFF + #3c000000 + #3cffffff \ No newline at end of file diff --git a/quickstep/res/values/config.xml b/quickstep/res/values/config.xml index 0f2955bfcf..9ec303a48c 100644 --- a/quickstep/res/values/config.xml +++ b/quickstep/res/values/config.xml @@ -16,6 +16,8 @@ + + com.android.launcher3/com.android.quickstep.interaction.GestureSandboxActivity @@ -35,4 +37,6 @@ 20 + + 150 diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index 6737c5f61d..313db8ccaf 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -30,7 +30,6 @@ 10dp 70dp - 96dp @@ -102,4 +101,26 @@ 64dp 80dp 184dp + + 1dp + 20dp + 20dp + 10dp + 12dp + 20dp + 16dp + 2dp + 16dp + 26dp + 4dp + 10dp + 14sp + + 17dp + 16dp + 8dp + 14sp + + + 80dp diff --git a/quickstep/recents_ui_overrides/res/values/override.xml b/quickstep/res/values/override.xml similarity index 99% rename from quickstep/recents_ui_overrides/res/values/override.xml rename to quickstep/res/values/override.xml index 1937164b7d..397ea82489 100644 --- a/quickstep/recents_ui_overrides/res/values/override.xml +++ b/quickstep/res/values/override.xml @@ -32,4 +32,3 @@ com.android.launcher3.model.QuickstepModelDelegate - diff --git a/quickstep/robolectric_tests/src/com/android/quickstep/OrientationTouchTransformerTest.java b/quickstep/robolectric_tests/src/com/android/quickstep/OrientationTouchTransformerTest.java index 22d205a7cd..5cb55ec2d0 100644 --- a/quickstep/robolectric_tests/src/com/android/quickstep/OrientationTouchTransformerTest.java +++ b/quickstep/robolectric_tests/src/com/android/quickstep/OrientationTouchTransformerTest.java @@ -32,7 +32,7 @@ import android.view.MotionEvent; import android.view.Surface; import com.android.launcher3.ResourceUtils; -import com.android.launcher3.util.DefaultDisplay; +import com.android.launcher3.util.DisplayController; import org.junit.Before; import org.junit.Ignore; @@ -50,7 +50,7 @@ public class OrientationTouchTransformerTest { private OrientationTouchTransformer mTouchTransformer; Resources mResources; - private DefaultDisplay.Info mInfo; + private DisplayController.Info mInfo; @Before @@ -231,12 +231,12 @@ public class OrientationTouchTransformerTest { assertTrue(mTouchTransformer.touchInValidSwipeRegions(inRegion2.getX(), inRegion2.getY())); } - private DefaultDisplay.Info createDisplayInfo(int rotation) { + private DisplayController.Info createDisplayInfo(int rotation) { Point p = new Point(SIZE_WIDTH, SIZE_HEIGHT); if (rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270) { p = new Point(SIZE_HEIGHT, SIZE_WIDTH); } - return new DefaultDisplay.Info(0, rotation, 0, p, p, p, null); + return new DisplayController.Info(0, rotation, 0, p, p, p, null); } private float generateTouchRegionHeight(int rotation) { diff --git a/quickstep/robolectric_tests/src/com/android/quickstep/RecentsActivityTest.java b/quickstep/robolectric_tests/src/com/android/quickstep/RecentsActivityTest.java index c148a4b6fe..7049af0eb7 100644 --- a/quickstep/robolectric_tests/src/com/android/quickstep/RecentsActivityTest.java +++ b/quickstep/robolectric_tests/src/com/android/quickstep/RecentsActivityTest.java @@ -60,9 +60,9 @@ public class RecentsActivityTest { FallbackRecentsView frv = activity.getOverviewPanel(); - RunningTaskInfo dummyTask = new RunningTaskInfo(); - dummyTask.taskId = 22; - frv.showCurrentTask(dummyTask); + RunningTaskInfo placeholderTask = new RunningTaskInfo(); + placeholderTask.taskId = 22; + frv.showCurrentTask(placeholderTask); doLayout(activity); ThumbnailData thumbnailData = new ThumbnailData(); diff --git a/quickstep/robolectric_tests/src/com/android/quickstep/util/TaskViewSimulatorTest.java b/quickstep/robolectric_tests/src/com/android/quickstep/util/TaskViewSimulatorTest.java index a31ba2177b..5491daae7b 100644 --- a/quickstep/robolectric_tests/src/com/android/quickstep/util/TaskViewSimulatorTest.java +++ b/quickstep/robolectric_tests/src/com/android/quickstep/util/TaskViewSimulatorTest.java @@ -27,7 +27,7 @@ import android.view.SurfaceControl; import com.android.launcher3.DeviceProfile; import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.shadows.LShadowDisplay; -import com.android.launcher3.util.DefaultDisplay; +import com.android.launcher3.util.DisplayController; import com.android.quickstep.LauncherActivityInterface; import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams; @@ -144,7 +144,7 @@ public class TaskViewSimulatorTest { LauncherActivityInterface.INSTANCE); tvs.setDp(mDeviceProfile); - int launcherRotation = DefaultDisplay.INSTANCE.get(mContext).getInfo().rotation; + int launcherRotation = DisplayController.INSTANCE.get(mContext).getInfo().rotation; if (mAppRotation < 0) { mAppRotation = launcherRotation; } diff --git a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java index 235df425b4..a0016cb905 100644 --- a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java @@ -50,7 +50,6 @@ import com.android.quickstep.SystemUiProxy; import com.android.quickstep.util.QuickstepOnboardingPrefs; import com.android.quickstep.util.RemoteAnimationProvider; import com.android.quickstep.util.RemoteFadeOutAnimationListener; -import com.android.quickstep.util.ShelfPeekAnim; import com.android.quickstep.views.OverviewActionsView; import com.android.quickstep.views.RecentsView; import com.android.systemui.shared.system.ActivityManagerWrapper; @@ -73,8 +72,6 @@ public abstract class BaseQuickstepLauncher extends Launcher (context, arg1, arg2) -> SystemUiProxy.INSTANCE.get(context).setBackButtonAlpha( Float.intBitsToFloat(arg1), arg2 != 0); - private final ShelfPeekAnim mShelfPeekAnim = new ShelfPeekAnim(this); - private OverviewActionsView mActionsView; protected HotseatPredictionController mHotseatPredictionController; @@ -196,7 +193,7 @@ public abstract class BaseQuickstepLauncher extends Launcher } private boolean isOverviewActionsEnabled() { - return FeatureFlags.ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(this); + return removeShelfFromOverview(this); } public T getActionsView() { @@ -317,10 +314,6 @@ public abstract class BaseQuickstepLauncher extends Launcher Stream.of(WellbeingModel.SHORTCUT_FACTORY)); } - public ShelfPeekAnim getShelfPeekAnim() { - return mShelfPeekAnim; - } - /** * Returns Prediction controller for hybrid hotseat */ diff --git a/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java b/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java index 02769c6e23..b35b33c418 100644 --- a/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java +++ b/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java @@ -16,7 +16,7 @@ package com.android.launcher3; import static com.android.launcher3.Utilities.postAsyncCallback; -import static com.android.launcher3.util.DefaultDisplay.getSingleFrameMs; +import static com.android.launcher3.util.DisplayController.getSingleFrameMs; import static com.android.systemui.shared.recents.utilities.Utilities.postAtFrontOfQueueAsynchronously; import android.animation.Animator; diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java b/quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java similarity index 100% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java rename to quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java diff --git a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java index 2d096d1dfe..2543148099 100644 --- a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java +++ b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java @@ -45,7 +45,6 @@ import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; -import android.annotation.TargetApi; import android.app.ActivityOptions; import android.content.Context; import android.content.pm.PackageManager; @@ -55,7 +54,6 @@ import android.graphics.Point; import android.graphics.Rect; import android.graphics.RectF; import android.graphics.drawable.Drawable; -import android.os.Build; import android.os.CancellationSignal; import android.os.Handler; import android.os.Looper; @@ -94,7 +92,6 @@ import com.android.systemui.shared.system.WindowManagerWrapper; * {@link LauncherAppTransitionManager} with Quickstep-specific app transitions for launching from * home and/or all-apps. Not used for 3p launchers. */ -@TargetApi(Build.VERSION_CODES.O) @SuppressWarnings("unused") public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTransitionManager implements OnDeviceProfileChangeListener { diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/AllAppsTipView.java b/quickstep/src/com/android/launcher3/appprediction/AllAppsTipView.java similarity index 100% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/AllAppsTipView.java rename to quickstep/src/com/android/launcher3/appprediction/AllAppsTipView.java diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/AppsDividerView.java b/quickstep/src/com/android/launcher3/appprediction/AppsDividerView.java similarity index 95% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/AppsDividerView.java rename to quickstep/src/com/android/launcher3/appprediction/AppsDividerView.java index 914d9e9774..b891120378 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/AppsDividerView.java +++ b/quickstep/src/com/android/launcher3/appprediction/AppsDividerView.java @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -42,6 +42,7 @@ import com.android.launcher3.R; import com.android.launcher3.allapps.FloatingHeaderRow; import com.android.launcher3.allapps.FloatingHeaderView; import com.android.launcher3.anim.PropertySetter; +import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.statemanager.StateManager.StateListener; import com.android.launcher3.util.Themes; @@ -90,7 +91,8 @@ public class AppsDividerView extends View implements StateListener getTypeClass() { return AppsDividerView.class; } + + @Override + public View getFocusedChild() { + return null; + } } diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/ComponentKeyMapper.java b/quickstep/src/com/android/launcher3/appprediction/ComponentKeyMapper.java similarity index 100% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/ComponentKeyMapper.java rename to quickstep/src/com/android/launcher3/appprediction/ComponentKeyMapper.java diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/DynamicItemCache.java b/quickstep/src/com/android/launcher3/appprediction/DynamicItemCache.java similarity index 100% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/DynamicItemCache.java rename to quickstep/src/com/android/launcher3/appprediction/DynamicItemCache.java diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/InstantAppItemInfo.java b/quickstep/src/com/android/launcher3/appprediction/InstantAppItemInfo.java similarity index 100% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/InstantAppItemInfo.java rename to quickstep/src/com/android/launcher3/appprediction/InstantAppItemInfo.java diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java b/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java similarity index 93% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java rename to quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java index 55384af96b..d3c4c3d62d 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java +++ b/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java @@ -45,10 +45,12 @@ import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherState; import com.android.launcher3.R; +import com.android.launcher3.allapps.AllAppsSectionDecorator; import com.android.launcher3.allapps.FloatingHeaderRow; import com.android.launcher3.allapps.FloatingHeaderView; import com.android.launcher3.anim.AlphaUpdateListener; import com.android.launcher3.anim.PropertySetter; +import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.keyboard.FocusIndicatorHelper; import com.android.launcher3.keyboard.FocusIndicatorHelper.SimpleFocusIndicatorHelper; import com.android.launcher3.logging.StatsLogUtils.LogContainerProvider; @@ -110,6 +112,8 @@ public class PredictionRowView extends LinearLayout implements private boolean mPredictionsEnabled = false; + AllAppsSectionDecorator.SectionDecorationHandler mDecorationHandler; + public PredictionRowView(@NonNull Context context) { this(context, null); } @@ -128,6 +132,11 @@ public class PredictionRowView extends LinearLayout implements mIconFullTextAlpha = Color.alpha(mIconTextColor); mIconCurrentTextAlpha = mIconFullTextAlpha; + if (FeatureFlags.ENABLE_DEVICE_SEARCH.get()) { + mDecorationHandler = new AllAppsSectionDecorator.SectionDecorationHandler(getContext(), + false); + } + updateVisibility(); } @@ -153,6 +162,15 @@ public class PredictionRowView extends LinearLayout implements @Override protected void dispatchDraw(Canvas canvas) { + if (mDecorationHandler != null) { + mDecorationHandler.reset(); + int childrenCount = getChildCount(); + for (int i = 0; i < childrenCount; i++) { + mDecorationHandler.extendBounds(getChildAt(i)); + } + mDecorationHandler.onDraw(canvas); + mDecorationHandler.onFocusDraw(canvas, getFocusedChild()); + } mFocusHelper.draw(canvas); super.dispatchDraw(canvas); } @@ -166,7 +184,7 @@ public class PredictionRowView extends LinearLayout implements @Override public boolean shouldDraw() { - return getVisibility() != GONE; + return getVisibility() == VISIBLE; } @Override @@ -347,4 +365,9 @@ public class PredictionRowView extends LinearLayout implements public Class getTypeClass() { return PredictionRowView.class; } + + @Override + public View getFocusedChild() { + return getChildAt(0); + } } diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduActivity.java b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduActivity.java similarity index 100% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduActivity.java rename to quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduActivity.java diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduController.java b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduController.java similarity index 99% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduController.java rename to quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduController.java index 4f95254a72..8ebf1251ec 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduController.java +++ b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduController.java @@ -284,4 +284,3 @@ public class HotseatEduController { return new Intent(SETTINGS_ACTION).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); } } - diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduDialog.java b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduDialog.java similarity index 100% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduDialog.java rename to quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduDialog.java diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatFileLog.java b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatFileLog.java similarity index 100% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatFileLog.java rename to quickstep/src/com/android/launcher3/hybridhotseat/HotseatFileLog.java diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java similarity index 100% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java rename to quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionModel.java b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionModel.java similarity index 100% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionModel.java rename to quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionModel.java diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatRestoreHelper.java b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatRestoreHelper.java similarity index 100% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatRestoreHelper.java rename to quickstep/src/com/android/launcher3/hybridhotseat/HotseatRestoreHelper.java diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/model/AppEventProducer.java b/quickstep/src/com/android/launcher3/model/AppEventProducer.java similarity index 100% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/model/AppEventProducer.java rename to quickstep/src/com/android/launcher3/model/AppEventProducer.java diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/model/PredictionUpdateTask.java b/quickstep/src/com/android/launcher3/model/PredictionUpdateTask.java similarity index 78% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/model/PredictionUpdateTask.java rename to quickstep/src/com/android/launcher3/model/PredictionUpdateTask.java index 721e2bebd5..b0fba3d5ae 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/model/PredictionUpdateTask.java +++ b/quickstep/src/com/android/launcher3/model/PredictionUpdateTask.java @@ -21,6 +21,7 @@ import static com.android.quickstep.InstantAppResolverImpl.COMPONENT_CLASS_MARKE import android.app.prediction.AppTarget; import android.content.ComponentName; +import android.content.Context; import android.content.pm.LauncherActivityInfo; import android.content.pm.LauncherApps; import android.content.pm.ShortcutInfo; @@ -29,6 +30,7 @@ import android.os.UserHandle; import com.android.launcher3.LauncherAppState; import com.android.launcher3.Utilities; import com.android.launcher3.model.BgDataModel.FixedContainerItems; +import com.android.launcher3.model.QuickstepModelDelegate.PredictorState; import com.android.launcher3.model.data.AppInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; @@ -43,27 +45,22 @@ import java.util.stream.Collectors; public class PredictionUpdateTask extends BaseModelUpdateTask { private final List mTargets; - private final int mContainerId; + private final PredictorState mPredictorState; - PredictionUpdateTask(int containerId, List targets) { - mContainerId = containerId; + PredictionUpdateTask(PredictorState predictorState, List targets) { + mPredictorState = predictorState; mTargets = targets; } @Override public void execute(LauncherAppState app, BgDataModel dataModel, AllAppsList apps) { - // TODO: persist the whole list - Utilities.getDevicePrefs(app.getContext()).edit() + Context context = app.getContext(); + + // TODO: remove this + Utilities.getDevicePrefs(context).edit() .putBoolean(LAST_PREDICTION_ENABLED_STATE, !mTargets.isEmpty()).apply(); - FixedContainerItems fci; - synchronized (dataModel) { - fci = dataModel.extraItems.get(mContainerId); - if (fci == null) { - return; - } - } - + FixedContainerItems fci = mPredictorState.items; Set usersForChangedShortcuts = new HashSet<>(fci.items.stream() .filter(info -> info.itemType == ITEM_TYPE_DEEP_SHORTCUT) .map(info -> info.user) @@ -75,7 +72,7 @@ public class PredictionUpdateTask extends BaseModelUpdateTask { ShortcutInfo si = target.getShortcutInfo(); if (si != null) { usersForChangedShortcuts.add(si.getUserHandle()); - itemInfo = new WorkspaceItemInfo(si, app.getContext()); + itemInfo = new WorkspaceItemInfo(si, context); app.getIconCache().getShortcutIcon(itemInfo, si); } else { String className = target.getClassName(); @@ -87,16 +84,18 @@ public class PredictionUpdateTask extends BaseModelUpdateTask { UserHandle user = target.getUser(); itemInfo = apps.data.stream() .filter(info -> user.equals(info.user) && cn.equals(info.componentName)) - .map(AppInfo::makeWorkspaceItem) + .map(ai -> { + app.getIconCache().getTitleAndIcon(ai, false); + return ai.makeWorkspaceItem(); + }) .findAny() .orElseGet(() -> { - LauncherActivityInfo lai = app.getContext() - .getSystemService(LauncherApps.class) + LauncherActivityInfo lai = context.getSystemService(LauncherApps.class) .resolveActivity(AppInfo.makeLaunchIntent(cn), user); if (lai == null) { return null; } - AppInfo ai = new AppInfo(app.getContext(), lai, user); + AppInfo ai = new AppInfo(context, lai, user); app.getIconCache().getTitleAndIcon(ai, lai, false); return ai.makeWorkspaceItem(); }); @@ -106,12 +105,15 @@ public class PredictionUpdateTask extends BaseModelUpdateTask { } } - itemInfo.container = mContainerId; + itemInfo.container = fci.containerId; fci.items.add(itemInfo); } bindExtraContainerItems(fci); usersForChangedShortcuts.forEach( u -> dataModel.updateShortcutPinnedState(app.getContext(), u)); + + // Save to disk + mPredictorState.storage.write(context, fci.items); } } diff --git a/quickstep/src/com/android/launcher3/model/QuickstepModelDelegate.java b/quickstep/src/com/android/launcher3/model/QuickstepModelDelegate.java new file mode 100644 index 0000000000..166cb6cc4d --- /dev/null +++ b/quickstep/src/com/android/launcher3/model/QuickstepModelDelegate.java @@ -0,0 +1,273 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.launcher3.model; + +import static com.android.launcher3.InvariantDeviceProfile.CHANGE_FLAG_GRID; +import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_PREDICTION; +import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION; +import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT; + +import android.app.prediction.AppPredictionContext; +import android.app.prediction.AppPredictionManager; +import android.app.prediction.AppPredictor; +import android.app.prediction.AppTarget; +import android.app.prediction.AppTargetEvent; +import android.content.Context; +import android.content.Intent; +import android.content.pm.LauncherActivityInfo; +import android.content.pm.LauncherApps; +import android.content.pm.ShortcutInfo; +import android.os.UserHandle; + +import androidx.annotation.Nullable; +import androidx.annotation.WorkerThread; + +import com.android.launcher3.InvariantDeviceProfile; +import com.android.launcher3.InvariantDeviceProfile.OnIDPChangeListener; +import com.android.launcher3.LauncherAppState; +import com.android.launcher3.model.BgDataModel.FixedContainerItems; +import com.android.launcher3.model.data.AppInfo; +import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.model.data.WorkspaceItemInfo; +import com.android.launcher3.shortcuts.ShortcutKey; +import com.android.launcher3.util.Executors; +import com.android.launcher3.util.PersistedItemArray; +import com.android.quickstep.logging.StatsLogCompatManager; + +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.IntStream; + +/** + * Model delegate which loads prediction items + */ +public class QuickstepModelDelegate extends ModelDelegate implements OnIDPChangeListener { + + public static final String LAST_PREDICTION_ENABLED_STATE = "last_prediction_enabled_state"; + + private final PredictorState mAllAppsState = + new PredictorState(CONTAINER_PREDICTION, "all_apps_predictions"); + + private final InvariantDeviceProfile mIDP; + private final AppEventProducer mAppEventProducer; + + private boolean mActive = false; + + public QuickstepModelDelegate(Context context) { + mAppEventProducer = new AppEventProducer(context, this::onAppTargetEvent); + + mIDP = InvariantDeviceProfile.INSTANCE.get(context); + mIDP.addOnChangeListener(this); + StatsLogCompatManager.LOGS_CONSUMER.add(mAppEventProducer); + } + + @Override + public void loadItems(UserManagerState ums, Map pinnedShortcuts) { + // TODO: Implement caching and preloading + super.loadItems(ums, pinnedShortcuts); + + WorkspaceItemFactory factory = + new WorkspaceItemFactory(mApp, ums, pinnedShortcuts, mIDP.numAllAppsColumns); + mAllAppsState.items.setItems( + mAllAppsState.storage.read(mApp.getContext(), factory, ums.allUsers::get)); + mDataModel.extraItems.put(CONTAINER_PREDICTION, mAllAppsState.items); + + mActive = true; + recreatePredictors(); + } + + @Override + public void validateData() { + super.validateData(); + if (mAllAppsState.predictor != null) { + mAllAppsState.predictor.requestPredictionUpdate(); + } + } + + @Override + public void destroy() { + super.destroy(); + mActive = false; + StatsLogCompatManager.LOGS_CONSUMER.remove(mAppEventProducer); + + destroyPredictors(); + mIDP.removeOnChangeListener(this); + } + + private void destroyPredictors() { + mAllAppsState.destroyPredictor(); + } + + @WorkerThread + private void recreatePredictors() { + destroyPredictors(); + if (!mActive) { + return; + } + Context context = mApp.getContext(); + AppPredictionManager apm = context.getSystemService(AppPredictionManager.class); + if (apm == null) { + return; + } + + int count = mIDP.numAllAppsColumns; + + mAllAppsState.predictor = apm.createAppPredictionSession( + new AppPredictionContext.Builder(context) + .setUiSurface("home") + .setPredictedTargetCount(count) + .build()); + mAllAppsState.predictor.registerPredictionUpdates( + Executors.MODEL_EXECUTOR, t -> handleUpdate(mAllAppsState, t)); + mAllAppsState.predictor.requestPredictionUpdate(); + } + + + private void handleUpdate(PredictorState state, List targets) { + if (state.setTargets(targets)) { + // No diff, skip + return; + } + mApp.getModel().enqueueModelUpdateTask(new PredictionUpdateTask(state, targets)); + } + + @Override + public void onIdpChanged(int changeFlags, InvariantDeviceProfile profile) { + if ((changeFlags & CHANGE_FLAG_GRID) != 0) { + // Reinitialize everything + Executors.MODEL_EXECUTOR.execute(this::recreatePredictors); + } + } + + private void onAppTargetEvent(AppTargetEvent event) { + if (mAllAppsState.predictor != null) { + mAllAppsState.predictor.notifyAppTargetEvent(event); + } + } + + static class PredictorState { + + public final FixedContainerItems items; + public final PersistedItemArray storage; + public AppPredictor predictor; + + private List mLastTargets; + + PredictorState(int container, String storageName) { + items = new FixedContainerItems(container); + storage = new PersistedItemArray(storageName); + mLastTargets = Collections.emptyList(); + } + + public void destroyPredictor() { + if (predictor != null) { + predictor.destroy(); + predictor = null; + } + } + + /** + * Sets the new targets and returns true if it was different than before. + */ + boolean setTargets(List newTargets) { + List oldTargets = mLastTargets; + mLastTargets = newTargets; + + int size = oldTargets.size(); + return size == newTargets.size() && IntStream.range(0, size) + .allMatch(i -> areAppTargetsSame(oldTargets.get(i), newTargets.get(i))); + } + } + + /** + * Compares two targets for the properties which we care about + */ + private static boolean areAppTargetsSame(AppTarget t1, AppTarget t2) { + if (!Objects.equals(t1.getPackageName(), t2.getPackageName()) + || !Objects.equals(t1.getUser(), t2.getUser()) + || !Objects.equals(t1.getClassName(), t2.getClassName())) { + return false; + } + + ShortcutInfo s1 = t1.getShortcutInfo(); + ShortcutInfo s2 = t2.getShortcutInfo(); + if (s1 != null) { + if (s2 == null || !Objects.equals(s1.getId(), s2.getId())) { + return false; + } + } else if (s2 != null) { + return false; + } + return true; + } + + private static class WorkspaceItemFactory implements PersistedItemArray.ItemFactory { + + private final LauncherAppState mAppState; + private final UserManagerState mUMS; + private final Map mPinnedShortcuts; + private final int mMaxCount; + + private int mReadCount = 0; + + protected WorkspaceItemFactory(LauncherAppState appState, UserManagerState ums, + Map pinnedShortcuts, int maxCount) { + mAppState = appState; + mUMS = ums; + mPinnedShortcuts = pinnedShortcuts; + mMaxCount = maxCount; + } + + @Nullable + @Override + public ItemInfo createInfo(int itemType, UserHandle user, Intent intent) { + if (mReadCount >= mMaxCount) { + return null; + } + switch (itemType) { + case ITEM_TYPE_APPLICATION: { + LauncherActivityInfo lai = mAppState.getContext() + .getSystemService(LauncherApps.class) + .resolveActivity(intent, user); + if (lai == null) { + return null; + } + AppInfo info = new AppInfo(lai, user, mUMS.isUserQuiet(user)); + mAppState.getIconCache().getTitleAndIcon(info, lai, false); + mReadCount++; + return info.makeWorkspaceItem(); + } + case ITEM_TYPE_DEEP_SHORTCUT: { + ShortcutKey key = ShortcutKey.fromIntent(intent, user); + if (key == null) { + return null; + } + ShortcutInfo si = mPinnedShortcuts.get(key); + if (si == null) { + return null; + } + WorkspaceItemInfo wii = new WorkspaceItemInfo(si, mAppState.getContext()); + mAppState.getIconCache().getShortcutIcon(wii, si); + mReadCount++; + return wii; + } + } + return null; + } + } +} diff --git a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java index 6e120e8bd8..1b8e244ac1 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java @@ -24,11 +24,13 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_MO import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCRIM_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_X; +import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_Y; import static com.android.launcher3.states.StateAnimationConfig.PLAY_ATOMIC_OVERVIEW_PEEK; import static com.android.launcher3.states.StateAnimationConfig.PLAY_ATOMIC_OVERVIEW_SCALE; import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW; import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET; import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY; +import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION; import android.util.FloatProperty; @@ -63,6 +65,7 @@ public abstract class BaseRecentsViewStateController float[] scaleAndOffset = state.getOverviewScaleAndOffset(mLauncher); RECENTS_SCALE_PROPERTY.set(mRecentsView, scaleAndOffset[0]); ADJACENT_PAGE_OFFSET.set(mRecentsView, scaleAndOffset[1]); + TASK_SECONDARY_TRANSLATION.set(mRecentsView, 0f); getContentAlphaProperty().set(mRecentsView, state.overviewUi ? 1f : 0); OverviewScrim scrim = mLauncher.getDragLayer().getOverviewScrim(); @@ -97,6 +100,8 @@ public abstract class BaseRecentsViewStateController config.getInterpolator(ANIM_OVERVIEW_SCALE, LINEAR)); setter.setFloat(mRecentsView, ADJACENT_PAGE_OFFSET, scaleAndOffset[1], config.getInterpolator(ANIM_OVERVIEW_TRANSLATE_X, LINEAR)); + setter.setFloat(mRecentsView, TASK_SECONDARY_TRANSLATION, 0f, + config.getInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, LINEAR)); setter.setFloat(mRecentsView, getContentAlphaProperty(), toState.overviewUi ? 1 : 0, config.getInterpolator(ANIM_OVERVIEW_FADE, AGGRESSIVE_EASE_IN_OUT)); diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIcon.java b/quickstep/src/com/android/launcher3/uioverrides/PredictedAppIcon.java similarity index 100% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIcon.java rename to quickstep/src/com/android/launcher3/uioverrides/PredictedAppIcon.java diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIconInflater.java b/quickstep/src/com/android/launcher3/uioverrides/PredictedAppIconInflater.java similarity index 100% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIconInflater.java rename to quickstep/src/com/android/launcher3/uioverrides/PredictedAppIconInflater.java diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java similarity index 96% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java rename to quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index cf86cd5324..d5d6fddc94 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -30,6 +30,7 @@ import static com.android.launcher3.testing.TestProtocol.OVERVIEW_STATE_ORDINAL; import static com.android.launcher3.testing.TestProtocol.QUICK_SWITCH_STATE_ORDINAL; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON; +import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_HOME_KEY; import android.content.Intent; import android.content.res.Configuration; @@ -59,7 +60,6 @@ import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.statemanager.StateManager.AtomicAnimationFactory; import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.uioverrides.states.QuickstepAtomicAnimationFactory; -import com.android.launcher3.uioverrides.touchcontrollers.FlingAndHoldTouchController; import com.android.launcher3.uioverrides.touchcontrollers.LandscapeEdgeSwipeController; import com.android.launcher3.uioverrides.touchcontrollers.NavBarToHomeTouchController; import com.android.launcher3.uioverrides.touchcontrollers.NoButtonNavbarToOverviewTouchController; @@ -79,6 +79,7 @@ import com.android.quickstep.SysUINavigationMode.Mode; import com.android.quickstep.SystemUiProxy; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.TaskView; +import com.android.systemui.shared.system.ActivityManagerWrapper; import java.io.FileDescriptor; import java.io.PrintWriter; @@ -170,6 +171,13 @@ public class QuickstepLauncher extends BaseQuickstepLauncher { } } + @Override + protected void showAllAppsFromIntent(boolean alreadyOnHome) { + ActivityManagerWrapper.getInstance().closeSystemWindows( + CLOSE_SYSTEM_WINDOWS_REASON_HOME_KEY); + super.showAllAppsFromIntent(alreadyOnHome); + } + @Override public void folderCreatedFromItem(Folder folder, WorkspaceItemInfo itemInfo) { super.folderCreatedFromItem(folder, itemInfo); @@ -298,14 +306,7 @@ public class QuickstepLauncher extends BaseQuickstepLauncher { if (TestProtocol.sDebugTracing) { Log.d(TestProtocol.PAUSE_NOT_DETECTED, "createTouchControllers.2"); } - if (FeatureFlags.ENABLE_OVERVIEW_ACTIONS.get()) { - if (TestProtocol.sDebugTracing) { - Log.d(TestProtocol.PAUSE_NOT_DETECTED, "createTouchControllers.3"); - } - list.add(new NoButtonNavbarToOverviewTouchController(this)); - } else { - list.add(new FlingAndHoldTouchController(this)); - } + list.add(new NoButtonNavbarToOverviewTouchController(this)); } else { if (getDeviceProfile().isVerticalBarLayout()) { list.add(new OverviewToAllAppsTouchController(this)); diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java similarity index 88% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsViewStateController.java rename to quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java index 085b9b3af9..5ccc1e8681 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsViewStateController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java @@ -17,6 +17,7 @@ package com.android.launcher3.uioverrides; import static com.android.launcher3.LauncherState.OVERVIEW_BUTTONS; import static com.android.launcher3.anim.Interpolators.LINEAR; +import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_ACTIONS_FADE; import static com.android.quickstep.views.RecentsView.CONTENT_ALPHA; import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS; import static com.android.quickstep.views.RecentsView.TASK_MODALNESS; @@ -57,7 +58,7 @@ public final class RecentsViewStateController extends mRecentsView.updateEmptyMessage(); mRecentsView.resetTaskVisuals(); } - setAlphas(PropertySetter.NO_ANIM_PROPERTY_SETTER, state); + setAlphas(PropertySetter.NO_ANIM_PROPERTY_SETTER, new StateAnimationConfig(), state); mRecentsView.setFullscreenProgress(state.getOverviewFullscreenProgress()); } @@ -75,17 +76,19 @@ public final class RecentsViewStateController extends AnimationSuccessListener.forRunnable(mRecentsView::resetTaskVisuals)); } - setAlphas(builder, toState); + setAlphas(builder, config, toState); builder.setFloat(mRecentsView, FULLSCREEN_PROGRESS, toState.getOverviewFullscreenProgress(), LINEAR); } - private void setAlphas(PropertySetter propertySetter, LauncherState state) { + private void setAlphas(PropertySetter propertySetter, StateAnimationConfig config, + LauncherState state) { float buttonAlpha = (state.getVisibleElements(mLauncher) & OVERVIEW_BUTTONS) != 0 ? 1 : 0; propertySetter.setFloat(mRecentsView.getClearAllButton(), ClearAllButton.VISIBILITY_ALPHA, buttonAlpha, LINEAR); propertySetter.setFloat(mLauncher.getActionsView().getVisibilityAlpha(), - MultiValueAlpha.VALUE, buttonAlpha, LINEAR); + MultiValueAlpha.VALUE, buttonAlpha, config.getInterpolator( + ANIM_OVERVIEW_ACTIONS_FADE, LINEAR)); } @Override diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java index e7cd39381d..bce73cd4e4 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java @@ -16,8 +16,7 @@ package com.android.launcher3.uioverrides.states; import static com.android.launcher3.anim.Interpolators.DEACCEL_2; -import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS; -import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON; +import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview; import android.content.Context; @@ -25,7 +24,6 @@ import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.allapps.AllAppsContainerView; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; -import com.android.quickstep.SysUINavigationMode; /** * Definition for AllApps state @@ -65,13 +63,7 @@ public class AllAppsState extends LauncherState { public ScaleAndTranslation getWorkspaceScaleAndTranslation(Launcher launcher) { ScaleAndTranslation scaleAndTranslation = LauncherState.OVERVIEW .getWorkspaceScaleAndTranslation(launcher); - if (SysUINavigationMode.getMode(launcher) == NO_BUTTON && !ENABLE_OVERVIEW_ACTIONS.get()) { - float normalScale = 1; - // Scale down halfway to where we'd be in overview, to prepare for a potential pause. - scaleAndTranslation.scale = (scaleAndTranslation.scale + normalScale) / 2; - } else { - scaleAndTranslation.scale = 1; - } + scaleAndTranslation.scale = 1; return scaleAndTranslation; } @@ -92,7 +84,8 @@ public class AllAppsState extends LauncherState { @Override public float[] getOverviewScaleAndOffset(Launcher launcher) { - return new float[] {0.9f, 0}; + float offset = removeShelfFromOverview(launcher) ? 1 : 0; + return new float[] {0.9f, offset}; } @Override diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java b/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java similarity index 100% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java rename to quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java similarity index 100% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java rename to quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java similarity index 94% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java rename to quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java index d174bfd2d9..6ec114e216 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java @@ -16,7 +16,6 @@ package com.android.launcher3.uioverrides.states; import static com.android.launcher3.anim.Interpolators.DEACCEL_2; -import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS; import static com.android.launcher3.logging.LoggerUtils.newContainerTarget; import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON; import static com.android.quickstep.SysUINavigationMode.hideShelfInTwoButtonLandscape; @@ -65,7 +64,7 @@ public class OverviewState extends LauncherState { public int getTransitionDuration(Context context) { // In no-button mode, overview comes in all the way from the left, so give it more time. boolean isNoButtonMode = SysUINavigationMode.INSTANCE.get(context).getMode() == NO_BUTTON; - return isNoButtonMode && ENABLE_OVERVIEW_ACTIONS.get() ? 380 : 250; + return isNoButtonMode ? 380 : 250; } @Override @@ -108,8 +107,7 @@ public class OverviewState extends LauncherState { @Override public ScaleAndTranslation getQsbScaleAndTranslation(Launcher launcher) { - if (this == OVERVIEW && ENABLE_OVERVIEW_ACTIONS.get() - && removeShelfFromOverview(launcher)) { + if (this == OVERVIEW && removeShelfFromOverview(launcher)) { // Treat the QSB as part of the hotseat so they move together. return getHotseatScaleAndTranslation(launcher); } @@ -129,7 +127,7 @@ public class OverviewState extends LauncherState { @Override public int getVisibleElements(Launcher launcher) { RecentsView recentsView = launcher.getOverviewPanel(); - if (ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(launcher) || + if (removeShelfFromOverview(launcher) || hideShelfInTwoButtonLandscape(launcher, recentsView.getPagedOrientationHandler())) { return OVERVIEW_BUTTONS; } else if (launcher.getDeviceProfile().isVerticalBarLayout()) { @@ -191,10 +189,6 @@ public class OverviewState extends LauncherState { return new BackgroundAppState(id); } - public static OverviewState newPeekState(int id) { - return new OverviewPeekState(id); - } - public static OverviewState newSwitchState(int id) { return new QuickSwitchState(id); } diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java b/quickstep/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java similarity index 100% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java rename to quickstep/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java b/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java similarity index 87% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java rename to quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java index 131fcbfbf1..94af134de5 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java @@ -22,27 +22,24 @@ import static com.android.launcher3.LauncherState.HINT_STATE; import static com.android.launcher3.LauncherState.HOTSEAT_ICONS; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.OVERVIEW; -import static com.android.launcher3.LauncherState.OVERVIEW_PEEK; import static com.android.launcher3.WorkspaceStateTransitionAnimation.getSpringScaleAnimator; import static com.android.launcher3.anim.Interpolators.ACCEL; +import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL; import static com.android.launcher3.anim.Interpolators.DEACCEL; import static com.android.launcher3.anim.Interpolators.DEACCEL_1_7; import static com.android.launcher3.anim.Interpolators.DEACCEL_3; -import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN; import static com.android.launcher3.anim.Interpolators.FINAL_FRAME; import static com.android.launcher3.anim.Interpolators.INSTANT; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_2; import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_7; import static com.android.launcher3.anim.Interpolators.clampToProgress; -import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS; import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_DEPTH; import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_SCALE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_TRANSLATE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE; -import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCRIM_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_X; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_Y; import static com.android.launcher3.states.StateAnimationConfig.ANIM_VERTICAL_PROGRESS; @@ -163,10 +160,15 @@ public class QuickstepAtomicAnimationFactory extends config.setInterpolator(ANIM_WORKSPACE_FADE, ACCEL); config.setInterpolator(ANIM_ALL_APPS_FADE, ACCEL); config.setInterpolator(ANIM_OVERVIEW_SCALE, clampToProgress(ACCEL, 0, 0.9f)); - config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, ACCEL); - config.setInterpolator(ANIM_OVERVIEW_FADE, DEACCEL_1_7); - Workspace workspace = mActivity.getWorkspace(); + config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, ACCEL_DEACCEL); + if (SysUINavigationMode.getMode(mActivity) == NO_BUTTON) { + config.setInterpolator(ANIM_OVERVIEW_FADE, FINAL_FRAME); + } else { + config.setInterpolator(ANIM_OVERVIEW_FADE, DEACCEL_1_7); + } + + Workspace workspace = mActivity.getWorkspace(); // Start from a higher workspace scale, but only if we're invisible so we don't jump. boolean isWorkspaceVisible = workspace.getVisibility() == VISIBLE; if (isWorkspaceVisible) { @@ -184,30 +186,23 @@ public class QuickstepAtomicAnimationFactory extends if (!isHotseatVisible) { hotseat.setScaleX(0.92f); hotseat.setScaleY(0.92f); - if (ENABLE_OVERVIEW_ACTIONS.get()) { - AllAppsContainerView qsbContainer = mActivity.getAppsView(); - View qsb = qsbContainer.getSearchView(); - boolean qsbVisible = qsb.getVisibility() == VISIBLE && qsb.getAlpha() > 0; - if (!qsbVisible) { - qsbContainer.setScaleX(0.92f); - qsbContainer.setScaleY(0.92f); - } + AllAppsContainerView qsbContainer = mActivity.getAppsView(); + View qsb = qsbContainer.getSearchView(); + boolean qsbVisible = qsb.getVisibility() == VISIBLE && qsb.getAlpha() > 0; + if (!qsbVisible) { + qsbContainer.setScaleX(0.92f); + qsbContainer.setScaleY(0.92f); } } - } else if (toState == NORMAL && fromState == OVERVIEW_PEEK) { - // Keep fully visible until the very end (when overview is offscreen) to make invisible. - config.setInterpolator(ANIM_OVERVIEW_FADE, FINAL_FRAME); - } else if (toState == OVERVIEW_PEEK && fromState == NORMAL) { - config.setInterpolator(ANIM_OVERVIEW_FADE, INSTANT); - config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, OVERSHOOT_1_7); - config.setInterpolator(ANIM_OVERVIEW_SCRIM_FADE, FAST_OUT_SLOW_IN); } else if ((fromState == NORMAL || fromState == HINT_STATE) && toState == OVERVIEW) { if (SysUINavigationMode.getMode(mActivity) == NO_BUTTON) { config.setInterpolator(ANIM_WORKSPACE_SCALE, fromState == NORMAL ? ACCEL : OVERSHOOT_1_2); config.setInterpolator(ANIM_WORKSPACE_TRANSLATE, ACCEL); + config.setInterpolator(ANIM_OVERVIEW_FADE, INSTANT); } else { config.setInterpolator(ANIM_WORKSPACE_SCALE, OVERSHOOT_1_2); + config.setInterpolator(ANIM_OVERVIEW_FADE, OVERSHOOT_1_2); // Scale up the recents, if it is not coming from the side RecentsView overview = mActivity.getOverviewPanel(); @@ -219,13 +214,11 @@ public class QuickstepAtomicAnimationFactory extends config.setInterpolator(ANIM_ALL_APPS_FADE, OVERSHOOT_1_2); config.setInterpolator(ANIM_OVERVIEW_SCALE, OVERSHOOT_1_2); config.setInterpolator(ANIM_DEPTH, OVERSHOOT_1_2); - Interpolator translationInterpolator = ENABLE_OVERVIEW_ACTIONS.get() - && removeShelfFromOverview(mActivity) + Interpolator translationInterpolator = removeShelfFromOverview(mActivity) ? OVERSHOOT_1_2 : OVERSHOOT_1_7; config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, translationInterpolator); config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, translationInterpolator); - config.setInterpolator(ANIM_OVERVIEW_FADE, OVERSHOOT_1_2); } else if (fromState == HINT_STATE && toState == NORMAL) { config.setInterpolator(ANIM_DEPTH, DEACCEL_3); if (mHintToNormalDuration == -1) { diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java similarity index 89% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java rename to quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java index e45fa9d513..57fd11a174 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java @@ -19,13 +19,13 @@ import static com.android.launcher3.AbstractFloatingView.TYPE_ALL; import static com.android.launcher3.AbstractFloatingView.TYPE_ALL_APPS_EDU; import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.LauncherState.NORMAL; +import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.allapps.AllAppsTransitionController.ALL_APPS_PROGRESS; import static com.android.launcher3.anim.Interpolators.DEACCEL_3; import static com.android.launcher3.config.FeatureFlags.ENABLE_ALL_APPS_EDU; import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_HOME_GESTURE; import static com.android.launcher3.touch.AbstractStateChangeTouchController.SUCCESS_TRANSITION_PROGRESS; -import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET; import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS; import android.animation.ValueAnimator; @@ -45,6 +45,7 @@ import com.android.launcher3.anim.Interpolators; import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.compat.AccessibilityManagerCompat; import com.android.launcher3.config.FeatureFlags; +import com.android.launcher3.graphics.OverviewScrim; import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.states.StateAnimationConfig; import com.android.launcher3.testing.TestProtocol; @@ -52,7 +53,9 @@ import com.android.launcher3.touch.SingleAxisSwipeDetector; import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; import com.android.launcher3.util.TouchController; +import com.android.quickstep.util.AnimatorControllerWithResistance; import com.android.quickstep.util.AssistantUtilities; +import com.android.quickstep.util.OverviewToHomeAnim; import com.android.quickstep.views.RecentsView; import com.android.systemui.shared.system.ActivityManagerWrapper; @@ -63,6 +66,8 @@ public class NavBarToHomeTouchController implements TouchController, SingleAxisSwipeDetector.Listener { private static final Interpolator PULLBACK_INTERPOLATOR = DEACCEL_3; + // How much of the overview scrim we can remove during the transition. + private static final float OVERVIEW_TO_HOME_SCRIM_PROGRESS = 0.5f; private final Launcher mLauncher; private final SingleAxisSwipeDetector mSwipeDetector; @@ -156,8 +161,13 @@ public class NavBarToHomeTouchController implements TouchController, final PendingAnimation builder = new PendingAnimation(accuracy); if (mStartState.overviewUi) { RecentsView recentsView = mLauncher.getOverviewPanel(); - builder.setFloat(recentsView, ADJACENT_PAGE_OFFSET, - -mPullbackDistance / recentsView.getPageOffsetScale(), PULLBACK_INTERPOLATOR); + AnimatorControllerWithResistance.createRecentsResistanceFromOverviewAnim(mLauncher, + builder); + float endScrimAlpha = Utilities.mapRange(OVERVIEW_TO_HOME_SCRIM_PROGRESS, + mStartState.getOverviewScrimAlpha(mLauncher), + mEndState.getOverviewScrimAlpha(mLauncher)); + builder.setFloat(mLauncher.getDragLayer().getOverviewScrim(), + OverviewScrim.SCRIM_PROGRESS, endScrimAlpha, PULLBACK_INTERPOLATOR); if (ENABLE_QUICKSTEP_LIVE_TILE.get()) { builder.addOnFrameCallback(recentsView::redrawLiveTile); } @@ -211,8 +221,13 @@ public class NavBarToHomeTouchController implements TouchController, recentsView.switchToScreenshot(null, () -> recentsView.finishRecentsAnimation(true /* toRecents */, null)); } - mLauncher.getStateManager().goToState(mEndState, true, - () -> onSwipeInteractionCompleted(mEndState)); + if (mStartState == OVERVIEW) { + new OverviewToHomeAnim(mLauncher, () -> onSwipeInteractionCompleted(mEndState)) + .animateWithVelocity(velocity); + } else { + mLauncher.getStateManager().goToState(mEndState, true, + () -> onSwipeInteractionCompleted(mEndState)); + } if (mStartState != mEndState) { logStateChange(mStartState.containerType, logAction); } diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java similarity index 55% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java rename to quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java index 9316938c45..591d3ca1f9 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java @@ -16,33 +16,45 @@ package com.android.launcher3.uioverrides.touchcontrollers; +import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.LauncherState.HINT_STATE; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.Utilities.EDGE_NAV_BAR; +import static com.android.launcher3.anim.Interpolators.ACCEL; import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL; -import static com.android.launcher3.states.StateAnimationConfig.PLAY_ATOMIC_OVERVIEW_PEEK; +import static com.android.launcher3.anim.Interpolators.DEACCEL; +import static com.android.launcher3.anim.Interpolators.DEACCEL_3; +import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE; +import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_HEADER_FADE; +import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE; +import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCALE; +import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE; import static com.android.launcher3.util.VibratorWrapper.OVERVIEW_HAPTIC; +import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED; -import android.animation.Animator; -import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.graphics.PointF; import android.util.Log; import android.view.MotionEvent; +import android.view.View; +import android.view.ViewConfiguration; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.Utilities; -import com.android.launcher3.anim.AnimationSuccessListener; +import com.android.launcher3.anim.AnimatorPlaybackController; +import com.android.launcher3.anim.Interpolators; import com.android.launcher3.graphics.OverviewScrim; -import com.android.launcher3.statemanager.StateManager; import com.android.launcher3.states.StateAnimationConfig; import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; import com.android.launcher3.util.VibratorWrapper; -import com.android.quickstep.util.StaggeredWorkspaceAnim; +import com.android.quickstep.SystemUiProxy; +import com.android.quickstep.util.AnimatorControllerWithResistance; +import com.android.quickstep.util.MotionPauseDetector; +import com.android.quickstep.util.OverviewToHomeAnim; import com.android.quickstep.views.RecentsView; /** @@ -50,7 +62,7 @@ import com.android.quickstep.views.RecentsView; * the nav bar falls back to go to All Apps. Swiping from the nav bar without holding goes to the * first home screen instead of to Overview. */ -public class NoButtonNavbarToOverviewTouchController extends FlingAndHoldTouchController { +public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouchController { // How much of the movement to use for translating overview after swipe and hold. @@ -59,32 +71,29 @@ public class NoButtonNavbarToOverviewTouchController extends FlingAndHoldTouchCo private static final float TRANSLATION_ANIM_VELOCITY_DP_PER_MS = 0.8f; private final RecentsView mRecentsView; + private final MotionPauseDetector mMotionPauseDetector; + private final float mMotionPauseMinDisplacement; private boolean mDidTouchStartInNavBar; private boolean mReachedOverview; - private boolean mIsOverviewRehidden; - private boolean mIsHomeStaggeredAnimFinished; // The last recorded displacement before we reached overview. private PointF mStartDisplacement = new PointF(); + private float mStartY; + private AnimatorPlaybackController mOverviewResistYAnim; // Normal to Hint animation has flag SKIP_OVERVIEW, so we update this scrim with this animator. private ObjectAnimator mNormalToHintOverviewScrimAnimator; public NoButtonNavbarToOverviewTouchController(Launcher l) { - super(l); + super(l, false /* allowDragToOverview */); mRecentsView = l.getOverviewPanel(); + mMotionPauseDetector = new MotionPauseDetector(l); + mMotionPauseMinDisplacement = ViewConfiguration.get(l).getScaledTouchSlop(); if (TestProtocol.sDebugTracing) { Log.d(TestProtocol.PAUSE_NOT_DETECTED, "NoButtonNavbarToOverviewTouchController.ctor"); } } - @Override - protected float getMotionPauseMaxDisplacement() { - // No need to disallow pause when swiping up all the way up the screen (unlike - // FlingAndHoldTouchController where user is probably intending to go to all apps). - return Float.MAX_VALUE; - } - @Override protected boolean canInterceptTouch(MotionEvent ev) { mDidTouchStartInNavBar = (ev.getEdgeFlags() & EDGE_NAV_BAR) != 0; @@ -115,6 +124,13 @@ public class NoButtonNavbarToOverviewTouchController extends FlingAndHoldTouchCo @Override public void onDragStart(boolean start, float startDisplacement) { super.onDragStart(start, startDisplacement); + + mMotionPauseDetector.clear(); + + if (handlingOverviewAnim()) { + mMotionPauseDetector.setOnMotionPauseListener(this::onMotionPauseChanged); + } + if (mFromState == NORMAL && mToState == HINT_STATE) { mNormalToHintOverviewScrimAnimator = ObjectAnimator.ofFloat( mLauncher.getDragLayer().getOverviewScrim(), @@ -123,6 +139,7 @@ public class NoButtonNavbarToOverviewTouchController extends FlingAndHoldTouchCo mToState.getOverviewScrimAlpha(mLauncher)); } mReachedOverview = false; + mOverviewResistYAnim = null; } @Override @@ -135,8 +152,24 @@ public class NoButtonNavbarToOverviewTouchController extends FlingAndHoldTouchCo @Override public void onDragEnd(float velocity) { - super.onDragEnd(velocity); + if (mMotionPauseDetector.isPaused() && handlingOverviewAnim()) { + goToOverviewOrHomeOnDragEnd(velocity); + } else { + super.onDragEnd(velocity); + } + + View searchView = mLauncher.getAppsView().getSearchView(); + if (searchView instanceof FeedbackHandler) { + ((FeedbackHandler) searchView).resetFeedback(); + } + + mMotionPauseDetector.clear(); mNormalToHintOverviewScrimAnimator = null; + if (mLauncher.isInState(OVERVIEW)) { + // Normally we would cleanup the state based on mCurrentAnimation, but since we stop + // using that when we pause to go to Overview, we need to clean up ourselves. + clearState(); + } } @Override @@ -152,14 +185,16 @@ public class NoButtonNavbarToOverviewTouchController extends FlingAndHoldTouchCo } } - @Override - protected void onMotionPauseChanged(boolean isPaused) { + private void onMotionPauseChanged(boolean isPaused) { if (mCurrentAnimation == null) { return; } mNormalToHintOverviewScrimAnimator = null; mCurrentAnimation.dispatchOnCancelWithoutCancelRunnable(() -> { mLauncher.getStateManager().goToState(OVERVIEW, true, () -> { + mOverviewResistYAnim = AnimatorControllerWithResistance + .createRecentsResistanceFromOverviewAnim(mLauncher, null) + .createPlaybackController(); mReachedOverview = true; maybeSwipeInteractionToOverviewComplete(); }); @@ -173,16 +208,10 @@ public class NoButtonNavbarToOverviewTouchController extends FlingAndHoldTouchCo } } - // Used if flinging back to home after reaching overview - private void maybeSwipeInteractionToHomeComplete() { - if (mIsHomeStaggeredAnimFinished && mIsOverviewRehidden) { - onSwipeInteractionCompleted(NORMAL, Touch.FLING); - } - } - - @Override - protected boolean handlingOverviewAnim() { - return mDidTouchStartInNavBar && super.handlingOverviewAnim(); + private boolean handlingOverviewAnim() { + int stateFlags = SystemUiProxy.INSTANCE.get(mLauncher).getLastSystemUiStateFlags(); + return mDidTouchStartInNavBar && mStartState == NORMAL + && (stateFlags & SYSUI_STATE_OVERVIEW_DISABLED) == 0; } @Override @@ -193,54 +222,37 @@ public class NoButtonNavbarToOverviewTouchController extends FlingAndHoldTouchCo if (mMotionPauseDetector.isPaused()) { if (!mReachedOverview) { mStartDisplacement.set(xDisplacement, yDisplacement); + mStartY = event.getY(); } else { mRecentsView.setTranslationX((xDisplacement - mStartDisplacement.x) * OVERVIEW_MOVEMENT_FACTOR); - mRecentsView.setTranslationY((yDisplacement - mStartDisplacement.y) - * OVERVIEW_MOVEMENT_FACTOR); + float yProgress = (mStartDisplacement.y - yDisplacement) / mStartY; + if (yProgress > 0 && mOverviewResistYAnim != null) { + mOverviewResistYAnim.setPlayFraction(yProgress); + } else { + mRecentsView.setTranslationY((yDisplacement - mStartDisplacement.y) + * OVERVIEW_MOVEMENT_FACTOR); + } } // Stay in Overview. return true; } + + float upDisplacement = -yDisplacement; + mMotionPauseDetector.setDisallowPause(!handlingOverviewAnim() + || upDisplacement < mMotionPauseMinDisplacement); + mMotionPauseDetector.addPosition(event); + return super.onDrag(yDisplacement, xDisplacement, event); } - @Override - protected void goToOverviewOnDragEnd(float velocity) { + private void goToOverviewOrHomeOnDragEnd(float velocity) { float velocityDp = dpiFromPx(velocity); boolean isFling = Math.abs(velocityDp) > 1; - StateManager stateManager = mLauncher.getStateManager(); boolean goToHomeInsteadOfOverview = isFling; if (goToHomeInsteadOfOverview) { - if (velocity > 0) { - stateManager.goToState(NORMAL, true, - () -> onSwipeInteractionCompleted(NORMAL, Touch.FLING)); - } else { - mIsHomeStaggeredAnimFinished = mIsOverviewRehidden = false; - - StaggeredWorkspaceAnim staggeredWorkspaceAnim = new StaggeredWorkspaceAnim( - mLauncher, velocity, false /* animateOverviewScrim */); - staggeredWorkspaceAnim.addAnimatorListener(new AnimationSuccessListener() { - @Override - public void onAnimationSuccess(Animator animator) { - mIsHomeStaggeredAnimFinished = true; - maybeSwipeInteractionToHomeComplete(); - } - }).start(); - - // StaggeredWorkspaceAnim doesn't animate overview, so we handle it here. - stateManager.cancelAnimation(); - StateAnimationConfig config = new StateAnimationConfig(); - config.duration = OVERVIEW.getTransitionDuration(mLauncher); - config.animFlags = PLAY_ATOMIC_OVERVIEW_PEEK; - AnimatorSet anim = stateManager.createAtomicAnimation( - stateManager.getState(), NORMAL, config); - anim.addListener(AnimationSuccessListener.forRunnable(() -> { - mIsOverviewRehidden = true; - maybeSwipeInteractionToHomeComplete(); - })); - anim.start(); - } + new OverviewToHomeAnim(mLauncher, ()-> onSwipeInteractionCompleted(NORMAL, Touch.FLING)) + .animateWithVelocity(velocity); } if (mReachedOverview) { float distanceDp = dpiFromPx(Math.max( @@ -256,10 +268,67 @@ public class NoButtonNavbarToOverviewTouchController extends FlingAndHoldTouchCo .withEndAction(goToHomeInsteadOfOverview ? null : this::maybeSwipeInteractionToOverviewComplete); + if (!goToHomeInsteadOfOverview) { + // Return to normal properties for the overview state. + StateAnimationConfig config = new StateAnimationConfig(); + config.duration = duration; + LauncherState state = mLauncher.getStateManager().getState(); + mLauncher.getStateManager().createAtomicAnimation(state, state, config).start(); + } } } private float dpiFromPx(float pixels) { return Utilities.dpiFromPx(pixels, mLauncher.getResources().getDisplayMetrics()); } + + @Override + protected StateAnimationConfig getConfigForStates( + LauncherState fromState, LauncherState toState) { + if (fromState == NORMAL && toState == ALL_APPS) { + StateAnimationConfig builder = new StateAnimationConfig(); + // Fade in prediction icons quickly, then rest of all apps after reaching overview. + float progressToReachOverview = NORMAL.getVerticalProgress(mLauncher) + - OVERVIEW.getVerticalProgress(mLauncher); + builder.setInterpolator(ANIM_ALL_APPS_HEADER_FADE, Interpolators.clampToProgress( + ACCEL, + 0, + ALL_APPS_CONTENT_FADE_THRESHOLD)); + builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress( + ACCEL, + progressToReachOverview, + progressToReachOverview + ALL_APPS_CONTENT_FADE_THRESHOLD)); + + // Get workspace out of the way quickly, to prepare for potential pause. + builder.setInterpolator(ANIM_WORKSPACE_SCALE, DEACCEL_3); + builder.setInterpolator(ANIM_WORKSPACE_TRANSLATE, DEACCEL_3); + builder.setInterpolator(ANIM_WORKSPACE_FADE, DEACCEL_3); + return builder; + } else if (fromState == ALL_APPS && toState == NORMAL) { + StateAnimationConfig builder = new StateAnimationConfig(); + // Keep all apps/predictions opaque until the very end of the transition. + float progressToReachOverview = OVERVIEW.getVerticalProgress(mLauncher); + builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress( + DEACCEL, + progressToReachOverview - ALL_APPS_CONTENT_FADE_THRESHOLD, + progressToReachOverview)); + builder.setInterpolator(ANIM_ALL_APPS_HEADER_FADE, Interpolators.clampToProgress( + DEACCEL, + 1 - ALL_APPS_CONTENT_FADE_THRESHOLD, + 1)); + return builder; + } + return super.getConfigForStates(fromState, toState); + } + + /** + * Interface for views with feedback animation requiring reset + */ + public interface FeedbackHandler { + + /** + * reset searchWidget feedback + */ + void resetFeedback(); + } } diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java similarity index 86% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java rename to quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java index 821ada400e..4b0642fab7 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java @@ -15,18 +15,15 @@ */ package com.android.launcher3.uioverrides.touchcontrollers; -import static com.android.launcher3.LauncherState.HOTSEAT_ICONS; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.LauncherState.OVERVIEW_BUTTONS; import static com.android.launcher3.LauncherState.QUICK_SWITCH; import static com.android.launcher3.anim.AlphaUpdateListener.ALPHA_CUTOFF_THRESHOLD; import static com.android.launcher3.anim.Interpolators.ACCEL_0_75; -import static com.android.launcher3.anim.Interpolators.DEACCEL; import static com.android.launcher3.anim.Interpolators.DEACCEL_5; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.anim.Interpolators.scrollInterpolatorForVelocity; -import static com.android.launcher3.anim.PropertySetter.NO_ANIM_PROPERTY_SETTER; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_UNKNOWN_SWIPEDOWN; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_UNKNOWN_SWIPEUP; @@ -39,14 +36,12 @@ import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW; import static com.android.launcher3.touch.BothAxesSwipeDetector.DIRECTION_RIGHT; import static com.android.launcher3.touch.BothAxesSwipeDetector.DIRECTION_UP; import static com.android.launcher3.uioverrides.states.QuickstepAtomicAnimationFactory.INDEX_PAUSE_TO_OVERVIEW_ANIM; -import static com.android.launcher3.util.DefaultDisplay.getSingleFrameMs; +import static com.android.launcher3.util.DisplayController.getSingleFrameMs; import static com.android.launcher3.util.VibratorWrapper.OVERVIEW_HAPTIC; -import static com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState.CANCEL; -import static com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState.HIDE; -import static com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState.PEEK; import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET; import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS; import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY; +import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED; import android.animation.Animator; @@ -60,10 +55,8 @@ import com.android.launcher3.BaseQuickstepLauncher; import com.android.launcher3.LauncherState; import com.android.launcher3.R; import com.android.launcher3.Utilities; -import com.android.launcher3.allapps.AllAppsTransitionController; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.PendingAnimation; -import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.graphics.OverviewScrim; import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.states.StateAnimationConfig; @@ -74,11 +67,11 @@ import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction; import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; import com.android.launcher3.util.TouchController; import com.android.launcher3.util.VibratorWrapper; +import com.android.quickstep.AnimatedFloat; import com.android.quickstep.SystemUiProxy; +import com.android.quickstep.util.AnimatorControllerWithResistance; import com.android.quickstep.util.LayoutUtils; import com.android.quickstep.util.MotionPauseDetector; -import com.android.quickstep.util.ShelfPeekAnim; -import com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState; import com.android.quickstep.util.StaggeredWorkspaceAnim; import com.android.quickstep.views.LauncherRecentsView; @@ -90,16 +83,16 @@ public class NoButtonQuickSwitchTouchController implements TouchController, BothAxesSwipeDetector.Listener, MotionPauseDetector.OnMotionPauseListener { /** The minimum progress of the scale/translationY animation until drag end. */ - private static final float Y_ANIM_MIN_PROGRESS = 0.15f; + private static final float Y_ANIM_MIN_PROGRESS = 0.25f; private static final Interpolator FADE_OUT_INTERPOLATOR = DEACCEL_5; private static final Interpolator TRANSLATE_OUT_INTERPOLATOR = ACCEL_0_75; - private static final Interpolator SCALE_DOWN_INTERPOLATOR = DEACCEL; + private static final Interpolator SCALE_DOWN_INTERPOLATOR = LINEAR; private final BaseQuickstepLauncher mLauncher; private final BothAxesSwipeDetector mSwipeDetector; - private final ShelfPeekAnim mShelfPeekAnim; private final float mXRange; private final float mYRange; + private final float mMaxYProgress; private final MotionPauseDetector mMotionPauseDetector; private final float mMotionPauseMinDisplacement; private final LauncherRecentsView mRecentsView; @@ -113,16 +106,16 @@ public class NoButtonQuickSwitchTouchController implements TouchController, // and the other two to set overview properties based on x and y progress. private AnimatorPlaybackController mNonOverviewAnim; private AnimatorPlaybackController mXOverviewAnim; - private AnimatorPlaybackController mYOverviewAnim; + private AnimatedFloat mYOverviewAnim; public NoButtonQuickSwitchTouchController(BaseQuickstepLauncher launcher) { mLauncher = launcher; mSwipeDetector = new BothAxesSwipeDetector(mLauncher, this); - mShelfPeekAnim = mLauncher.getShelfPeekAnim(); mRecentsView = mLauncher.getOverviewPanel(); mXRange = mLauncher.getDeviceProfile().widthPx / 2f; mYRange = LayoutUtils.getShelfTrackingDistance( mLauncher, mLauncher.getDeviceProfile(), mRecentsView.getPagedOrientationHandler()); + mMaxYProgress = mLauncher.getDeviceProfile().heightPx / mYRange; mMotionPauseDetector = new MotionPauseDetector(mLauncher); mMotionPauseMinDisplacement = mLauncher.getResources().getDimension( R.dimen.motion_pause_detector_min_displacement_from_app); @@ -187,25 +180,6 @@ public class NoButtonQuickSwitchTouchController implements TouchController, @Override public void onMotionPauseChanged(boolean isPaused) { VibratorWrapper.INSTANCE.get(mLauncher).vibrate(OVERVIEW_HAPTIC); - - if (FeatureFlags.ENABLE_OVERVIEW_ACTIONS.get()) { - return; - } - - ShelfAnimState shelfState = isPaused ? PEEK : HIDE; - if (shelfState == PEEK) { - // Some shelf elements (e.g. qsb) were hidden, but we need them visible when peeking. - AllAppsTransitionController allAppsController = mLauncher.getAllAppsController(); - allAppsController.setAlphas( - NORMAL, new StateAnimationConfig(), NO_ANIM_PROPERTY_SETTER); - - if ((OVERVIEW.getVisibleElements(mLauncher) & HOTSEAT_ICONS) != 0) { - // Hotseat was hidden, but we need it visible when peeking. - mLauncher.getHotseat().setAlpha(1); - } - } - mShelfPeekAnim.setShelfState(shelfState, ShelfPeekAnim.INTERPOLATOR, - ShelfPeekAnim.DURATION); } private void setupAnimators() { @@ -270,8 +244,18 @@ public class NoButtonQuickSwitchTouchController implements TouchController, SCALE_DOWN_INTERPOLATOR); yAnim.setFloat(mRecentsView, FULLSCREEN_PROGRESS, toState.getOverviewFullscreenProgress(), SCALE_DOWN_INTERPOLATOR); - mYOverviewAnim = yAnim.createPlaybackController(); - mYOverviewAnim.dispatchOnStart(); + AnimatorPlaybackController yNormalController = yAnim.createPlaybackController(); + AnimatorControllerWithResistance yAnimWithResistance = AnimatorControllerWithResistance + .createForRecents(yNormalController, mLauncher, + mRecentsView.getPagedViewOrientedState(), mLauncher.getDeviceProfile(), + mRecentsView, RECENTS_SCALE_PROPERTY, mRecentsView, + TASK_SECONDARY_TRANSLATION); + mYOverviewAnim = new AnimatedFloat(() -> { + if (mYOverviewAnim != null) { + yAnimWithResistance.setProgress(mYOverviewAnim.value, mMaxYProgress); + } + }); + yNormalController.dispatchOnStart(); } @Override @@ -287,10 +271,6 @@ public class NoButtonQuickSwitchTouchController implements TouchController, mIsHomeScreenVisible = FADE_OUT_INTERPOLATOR.getInterpolation(xProgress) <= 1 - ALPHA_CUTOFF_THRESHOLD; - if (wasHomeScreenVisible && !mIsHomeScreenVisible) { - // Get the shelf all the way offscreen so it pops up when we decide to peek it. - mShelfPeekAnim.setShelfState(HIDE, LINEAR, 0); - } // Only allow motion pause if the home screen is invisible, since some // home screen elements will appear in the shelf on motion pause. @@ -298,16 +278,11 @@ public class NoButtonQuickSwitchTouchController implements TouchController, || -displacement.y < mMotionPauseMinDisplacement); mMotionPauseDetector.addPosition(ev); - if (mIsHomeScreenVisible) { - // Cancel the shelf anim so it doesn't clobber mNonOverviewAnim. - mShelfPeekAnim.setShelfState(CANCEL, LINEAR, 0); - } - if (mXOverviewAnim != null) { mXOverviewAnim.setPlayFraction(xProgress); } if (mYOverviewAnim != null) { - mYOverviewAnim.setPlayFraction(yProgress); + mYOverviewAnim.updateValue(yProgress); } return true; } @@ -354,9 +329,11 @@ public class NoButtonQuickSwitchTouchController implements TouchController, } else if (verticalFling) { targetState = velocity.y > 0 ? QUICK_SWITCH : NORMAL; } else { - // If user isn't flinging, just snap to the closest state based on x progress. + // If user isn't flinging, just snap to the closest state. boolean passedHorizontalThreshold = mXOverviewAnim.getInterpolatedProgress() > 0.5f; - targetState = passedHorizontalThreshold ? QUICK_SWITCH : NORMAL; + boolean passedVerticalThreshold = mYOverviewAnim.value > 1f; + targetState = passedHorizontalThreshold && !passedVerticalThreshold + ? QUICK_SWITCH : NORMAL; } // Animate the various components to the target state. @@ -375,9 +352,9 @@ public class NoButtonQuickSwitchTouchController implements TouchController, boolean flingUpToNormal = verticalFling && velocity.y < 0 && targetState == NORMAL; - float yProgress = mYOverviewAnim.getProgressFraction(); + float yProgress = mYOverviewAnim.value; float startYProgress = Utilities.boundToRange(yProgress - - velocity.y * getSingleFrameMs(mLauncher) / mYRange, 0f, 1f); + - velocity.y * getSingleFrameMs(mLauncher) / mYRange, 0f, mMaxYProgress); final float endYProgress; if (flingUpToNormal) { endYProgress = 1; @@ -387,12 +364,11 @@ public class NoButtonQuickSwitchTouchController implements TouchController, } else { endYProgress = 0; } - long yDuration = BaseSwipeDetector.calculateDuration(velocity.y, - Math.abs(endYProgress - startYProgress)); - ValueAnimator yOverviewAnim = mYOverviewAnim.getAnimationPlayer(); - yOverviewAnim.setFloatValues(startYProgress, endYProgress); + float yDistanceToCover = Math.abs(endYProgress - startYProgress) * mYRange; + long yDuration = (long) (yDistanceToCover / Math.max(1f, Math.abs(velocity.y))); + ValueAnimator yOverviewAnim = mYOverviewAnim.animateToValue(startYProgress, endYProgress); yOverviewAnim.setDuration(yDuration); - mYOverviewAnim.dispatchOnStart(); + mYOverviewAnim.updateValue(startYProgress); ValueAnimator nonOverviewAnim = mNonOverviewAnim.getAnimationPlayer(); if (flingUpToNormal && !mIsHomeScreenVisible) { @@ -457,9 +433,8 @@ public class NoButtonQuickSwitchTouchController implements TouchController, mXOverviewAnim.getAnimationPlayer().cancel(); } if (mYOverviewAnim != null) { - mYOverviewAnim.getAnimationPlayer().cancel(); + mYOverviewAnim.cancelAnimation(); } - mShelfPeekAnim.setShelfState(ShelfAnimState.CANCEL, LINEAR, 0); mMotionPauseDetector.clear(); } diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/OverviewToAllAppsTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/OverviewToAllAppsTouchController.java similarity index 100% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/OverviewToAllAppsTouchController.java rename to quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/OverviewToAllAppsTouchController.java diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitOverviewStateTouchHelper.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitOverviewStateTouchHelper.java similarity index 100% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitOverviewStateTouchHelper.java rename to quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitOverviewStateTouchHelper.java diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java index 20ee61db9b..1208c6c79b 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java @@ -24,7 +24,6 @@ import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.anim.Interpolators.ACCEL; import static com.android.launcher3.anim.Interpolators.DEACCEL; import static com.android.launcher3.anim.Interpolators.LINEAR; -import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS; import static com.android.launcher3.config.FeatureFlags.UNSTABLE_SPRINGS; import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_FADE; @@ -142,6 +141,10 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr Log.d(TestProtocol.OVERIEW_NOT_ALLAPPS, "PortraitStatesTouchController.getTargetState 1"); } + if (removeShelfFromOverview(mLauncher)) { + // Don't allow swiping down to overview. + return NORMAL; + } return TouchInteractionService.isConnected() ? mLauncher.getStateManager().getLastState() : NORMAL; } else if (fromState == OVERVIEW) { @@ -150,7 +153,7 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr "PortraitStatesTouchController.getTargetState 2"); } LauncherState positiveDragTarget = ALL_APPS; - if (ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(mLauncher)) { + if (removeShelfFromOverview(mLauncher)) { // Don't allow swiping up to all apps. positiveDragTarget = OVERVIEW; } @@ -245,7 +248,7 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr final StateAnimationConfig config = totalShift == 0 ? new StateAnimationConfig() : getConfigForStates(mFromState, mToState); - config.animFlags = updateAnimComponentsOnReinit(animFlags); + config.animFlags = animFlags; config.duration = maxAccuracy; cancelPendingAnim(); @@ -279,14 +282,6 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr return 1 / totalShift; } - /** - * Give subclasses the chance to update the animation when we re-initialize towards a new state. - */ - @AnimationFlags - protected int updateAnimComponentsOnReinit(@AnimationFlags int animComponents) { - return animComponents; - } - private void cancelPendingAnim() { if (mPendingAnimation != null) { mPendingAnimation.finish(false, Touch.SWIPE); diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java similarity index 100% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java rename to quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java similarity index 95% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java rename to quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java index fce019b3e4..3586b4f183 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java @@ -24,6 +24,7 @@ import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.view.MotionEvent; import android.view.View; +import android.view.animation.Interpolator; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.BaseDraggingActivity; @@ -205,14 +206,19 @@ public abstract class TaskViewTouchController long maxDuration = 2 * secondaryLayerDimension; int verticalFactor = orientationHandler.getTaskDragDisplacementFactor(mIsRtl); int secondaryTaskDimension = orientationHandler.getSecondaryDimension(mTaskBeingDragged); + // The interpolator controlling the most prominent visual movement. We use this to determine + // whether we passed SUCCESS_TRANSITION_PROGRESS. + final Interpolator currentInterpolator; if (goingUp) { + currentInterpolator = Interpolators.LINEAR; mPendingAnimation = mRecentsView.createTaskDismissAnimation(mTaskBeingDragged, true /* animateTaskView */, true /* removeTask */, maxDuration); mEndDisplacement = -secondaryTaskDimension; } else { + currentInterpolator = Interpolators.ZOOM_IN; mPendingAnimation = mRecentsView.createTaskLaunchAnimation( - mTaskBeingDragged, maxDuration, Interpolators.ZOOM_IN); + mTaskBeingDragged, maxDuration, currentInterpolator); // Since the thumbnail is what is filling the screen, based the end displacement on it. View thumbnailView = mTaskBeingDragged.getThumbnail(); @@ -227,6 +233,9 @@ public abstract class TaskViewTouchController } mCurrentAnimation = mPendingAnimation.createPlaybackController() .setOnCancelRunnable(this::clearState); + // Setting this interpolator doesn't affect the visual motion, but is used to determine + // whether we successfully reached the target state in onDragEnd(). + mCurrentAnimation.getTarget().setInterpolator(currentInterpolator); onUserControlledAnimationCreated(mCurrentAnimation); mCurrentAnimation.getTarget().addListener(this); mCurrentAnimation.dispatchOnStart(); diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TransposedQuickSwitchTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TransposedQuickSwitchTouchController.java similarity index 100% rename from quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TransposedQuickSwitchTouchController.java rename to quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TransposedQuickSwitchTouchController.java diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java similarity index 94% rename from quickstep/recents_ui_overrides/src/com/android/quickstep/AbsSwipeUpHandler.java rename to quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 3a5c027698..aaa2720047 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -20,17 +20,15 @@ import static android.widget.Toast.LENGTH_SHORT; import static com.android.launcher3.BaseActivity.INVISIBLE_BY_STATE_HANDLER; import static com.android.launcher3.BaseActivity.STATE_HANDLER_INVISIBILITY_FLAGS; import static com.android.launcher3.anim.Interpolators.DEACCEL; -import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_2; import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; -import static com.android.launcher3.config.FeatureFlags.UNSTABLE_SPRINGS; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.IGNORE; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_HOME_GESTURE; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_OVERVIEW_GESTURE; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_QUICKSWITCH_LEFT; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_QUICKSWITCH_RIGHT; -import static com.android.launcher3.util.DefaultDisplay.getSingleFrameMs; +import static com.android.launcher3.util.DisplayController.getSingleFrameMs; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.launcher3.util.SystemUiController.UI_STATE_OVERVIEW; import static com.android.launcher3.util.VibratorWrapper.OVERVIEW_HAPTIC; @@ -42,13 +40,10 @@ import static com.android.quickstep.GestureState.STATE_END_TARGET_ANIMATION_FINI import static com.android.quickstep.GestureState.STATE_END_TARGET_SET; import static com.android.quickstep.GestureState.STATE_RECENTS_SCROLLING_FINISHED; import static com.android.quickstep.MultiStateCallback.DEBUG_STATES; -import static com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState.HIDE; -import static com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState.PEEK; import static com.android.quickstep.views.RecentsView.UPDATE_SYSUI_FLAGS_THRESHOLD; import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.ACTIVITY_TYPE_HOME; import android.animation.Animator; -import android.animation.TimeInterpolator; import android.animation.ValueAnimator; import android.annotation.TargetApi; import android.app.ActivityManager; @@ -75,7 +70,6 @@ import com.android.launcher3.DeviceProfile; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimationSuccessListener; -import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.Interpolators; import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.logging.StatsLogManager.StatsLogger; @@ -93,10 +87,9 @@ import com.android.quickstep.GestureState.GestureEndTarget; import com.android.quickstep.inputconsumers.OverviewInputConsumer; import com.android.quickstep.util.ActiveGestureLog; import com.android.quickstep.util.ActivityInitListener; +import com.android.quickstep.util.AnimatorControllerWithResistance; import com.android.quickstep.util.InputConsumerProxy; import com.android.quickstep.util.RectFSpringAnim; -import com.android.quickstep.util.ShelfPeekAnim; -import com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState; import com.android.quickstep.util.SurfaceTransactionApplier; import com.android.quickstep.util.TransformParams; import com.android.quickstep.views.LiveTileOverlay; @@ -207,15 +200,14 @@ public abstract class AbsSwipeUpHandler, Q extends // Either RectFSpringAnim (if animating home) or ObjectAnimator (from mCurrentShift) otherwise private RunningWindowAnim mRunningWindowAnim; - private boolean mIsShelfPeeking; + private boolean mIsMotionPaused; private boolean mContinuingLastGesture; private ThumbnailData mTaskSnapshot; // Used to control launcher components throughout the swipe gesture. - private AnimatorPlaybackController mLauncherTransitionController; - private boolean mHasLauncherTransitionControllerStarted; + private AnimatorControllerWithResistance mLauncherTransitionController; private AnimationFactory mAnimationFactory = (t) -> { }; @@ -494,7 +486,9 @@ public abstract class AbsSwipeUpHandler, Q extends * Called when motion pause is detected */ public void onMotionPauseChanged(boolean isPaused) { - setShelfState(isPaused ? PEEK : HIDE, ShelfPeekAnim.INTERPOLATOR, ShelfPeekAnim.DURATION); + mIsMotionPaused = isPaused; + maybeUpdateRecentsAttachedState(); + performHapticFeedback(); } public void maybeUpdateRecentsAttachedState() { @@ -525,9 +519,23 @@ public abstract class AbsSwipeUpHandler, Q extends // The window is going away so make sure recents is always visible in this case. recentsAttachedToAppWindow = true; } else { - recentsAttachedToAppWindow = mIsShelfPeeking || mIsLikelyToStartNewTask; + recentsAttachedToAppWindow = mIsMotionPaused || mIsLikelyToStartNewTask; } mAnimationFactory.setRecentsAttachedToAppWindow(recentsAttachedToAppWindow, animate); + + // Reapply window transform throughout the attach animation, as the animation affects how + // much the window is bound by overscroll (vs moving freely). + if (animate) { + ValueAnimator reapplyWindowTransformAnim = ValueAnimator.ofFloat(0, 1); + reapplyWindowTransformAnim.addUpdateListener(anim -> { + if (mRunningWindowAnim == null) { + applyWindowTransform(); + } + }); + reapplyWindowTransformAnim.setDuration(RECENTS_ATTACH_DURATION).start(); + } else { + applyWindowTransform(); + } } public void setIsLikelyToStartNewTask(boolean isLikelyToStartNewTask) { @@ -541,19 +549,6 @@ public abstract class AbsSwipeUpHandler, Q extends } } - @UiThread - public void setShelfState(ShelfAnimState shelfState, Interpolator interpolator, long duration) { - mAnimationFactory.setShelfState(shelfState, interpolator, duration); - boolean wasShelfPeeking = mIsShelfPeeking; - mIsShelfPeeking = shelfState == PEEK; - if (mIsShelfPeeking != wasShelfPeeking) { - maybeUpdateRecentsAttachedState(); - } - if (shelfState.shouldPreformHaptic) { - performHapticFeedback(); - } - } - private void buildAnimationController() { if (!canCreateNewOrUpdateExistingLauncherTransitionController()) { return; @@ -564,11 +559,11 @@ public abstract class AbsSwipeUpHandler, Q extends /** * We don't want to change mLauncherTransitionController if mGestureState.getEndTarget() == HOME - * (it has its own animation) or if we're already animating the current controller. + * (it has its own animation). * @return Whether we can create the launcher controller or update its progress. */ private boolean canCreateNewOrUpdateExistingLauncherTransitionController() { - return mGestureState.getEndTarget() != HOME && !mHasLauncherTransitionControllerStarted; + return mGestureState.getEndTarget() != HOME; } @Override @@ -578,10 +573,9 @@ public abstract class AbsSwipeUpHandler, Q extends return result; } - private void onAnimatorPlaybackControllerCreated(AnimatorPlaybackController anim) { + private void onAnimatorPlaybackControllerCreated(AnimatorControllerWithResistance anim) { mLauncherTransitionController = anim; - mLauncherTransitionController.dispatchSetInterpolator(t -> t * mDragLengthFactor); - mLauncherTransitionController.dispatchOnStart(); + mLauncherTransitionController.getNormalController().dispatchOnStart(); updateLauncherTransitionProgress(); } @@ -621,10 +615,7 @@ public abstract class AbsSwipeUpHandler, Q extends || !canCreateNewOrUpdateExistingLauncherTransitionController()) { return; } - // Normalize the progress to 0 to 1, as the animation controller will clamp it to that - // anyway. The controller mimics the drag length factor by applying it to its interpolators. - float progress = mCurrentShift.value / mDragLengthFactor; - mLauncherTransitionController.setPlayFraction(progress); + mLauncherTransitionController.setProgress(mCurrentShift.value, mDragLengthFactor); } /** @@ -845,7 +836,7 @@ public abstract class AbsSwipeUpHandler, Q extends if (isCancel) { endTarget = LAST_TASK; } else if (mDeviceState.isFullyGesturalNavMode()) { - if (mIsShelfPeeking) { + if (mIsMotionPaused) { endTarget = RECENTS; } else if (goingToNewTask) { endTarget = NEW_TASK; @@ -867,7 +858,7 @@ public abstract class AbsSwipeUpHandler, Q extends if (mDeviceState.isFullyGesturalNavMode() && isSwipeUp && !willGoToNewTaskOnSwipeUp) { endTarget = HOME; - } else if (mDeviceState.isFullyGesturalNavMode() && isSwipeUp && !mIsShelfPeeking) { + } else if (mDeviceState.isFullyGesturalNavMode() && isSwipeUp && !mIsMotionPaused) { // If swiping at a diagonal, base end target on the faster velocity. endTarget = NEW_TASK; } else if (isSwipeUp) { @@ -935,7 +926,6 @@ public abstract class AbsSwipeUpHandler, Q extends mInputConsumerProxy.enable(); } if (endTarget == HOME) { - setShelfState(ShelfAnimState.CANCEL, LINEAR, 0); duration = Math.max(MIN_OVERSHOOT_DURATION, duration); } else if (endTarget == RECENTS) { LiveTileOverlay.INSTANCE.startIconAnimation(); @@ -951,9 +941,6 @@ public abstract class AbsSwipeUpHandler, Q extends } duration = Math.max(duration, mRecentsView.getScroller().getDuration()); } - if (mDeviceState.isFullyGesturalNavMode()) { - setShelfState(ShelfAnimState.OVERVIEW, interpolator, duration); - } } // Let RecentsView handle the scrolling to the task, which we launch in startNewTask() @@ -1052,6 +1039,7 @@ public abstract class AbsSwipeUpHandler, Q extends } if (mGestureState.getEndTarget() == HOME) { + mTaskViewSimulator.setDrawsBelowRecents(false); HomeAnimationFactory homeAnimFactory = createHomeAnimationFactory(duration); RectFSpringAnim windowAnim = createWindowAnimationToHome(start, homeAnimFactory); windowAnim.addAnimatorListener(new AnimationSuccessListener() { @@ -1112,31 +1100,6 @@ public abstract class AbsSwipeUpHandler, Q extends windowAnim.start(); mRunningWindowAnim = RunningWindowAnim.wrap(windowAnim); } - // Always play the entire launcher animation when going home, since it is separate from - // the animation that has been controlled thus far. - if (mGestureState.getEndTarget() == HOME) { - start = 0; - } - - // We want to use the same interpolator as the window, but need to adjust it to - // interpolate over the remaining progress (end - start). - TimeInterpolator adjustedInterpolator = Interpolators.mapToProgress( - interpolator, start, end); - if (mLauncherTransitionController == null) { - return; - } - if (start == end || duration <= 0) { - mLauncherTransitionController.dispatchSetInterpolator(t -> end); - } else { - mLauncherTransitionController.dispatchSetInterpolator(adjustedInterpolator); - } - mLauncherTransitionController.getAnimationPlayer().setDuration(Math.max(0, duration)); - - if (UNSTABLE_SPRINGS.get()) { - mLauncherTransitionController.dispatchOnStart(); - } - mLauncherTransitionController.getAnimationPlayer().start(); - mHasLauncherTransitionControllerStarted = true; } private void computeRecentsScrollIfInvisible() { @@ -1261,10 +1224,6 @@ public abstract class AbsSwipeUpHandler, Q extends private void cancelCurrentAnimation() { mCanceled = true; mCurrentShift.cancelAnimation(); - if (mLauncherTransitionController != null && mLauncherTransitionController - .getAnimationPlayer().isStarted()) { - mLauncherTransitionController.getAnimationPlayer().cancel(); - } } private void invalidateHandler() { @@ -1288,9 +1247,11 @@ public abstract class AbsSwipeUpHandler, Q extends } private void endLauncherTransitionController() { - setShelfState(ShelfAnimState.CANCEL, LINEAR, 0); if (mLauncherTransitionController != null) { - mLauncherTransitionController.getAnimationPlayer().end(); + // End the animation, but stay at the same visual progress. + mLauncherTransitionController.getNormalController().dispatchSetInterpolator( + t -> Utilities.boundToRange(mCurrentShift.value, 0, 1)); + mLauncherTransitionController.getNormalController().getAnimationPlayer().end(); mLauncherTransitionController = null; } } @@ -1572,8 +1533,7 @@ public abstract class AbsSwipeUpHandler, Q extends */ protected void applyWindowTransform() { if (mWindowTransitionController != null) { - float progress = mCurrentShift.value / mDragLengthFactor; - mWindowTransitionController.setPlayFraction(progress); + mWindowTransitionController.setProgress(mCurrentShift.value, mDragLengthFactor); } if (mRecentsAnimationTargets != null) { if (mRecentsViewScrollLinked) { diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/AppToOverviewAnimationProvider.java b/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java similarity index 97% rename from quickstep/recents_ui_overrides/src/com/android/quickstep/AppToOverviewAnimationProvider.java rename to quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java index 9310685e30..55f542461c 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/AppToOverviewAnimationProvider.java +++ b/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java @@ -79,8 +79,8 @@ final class AppToOverviewAnimationProvider> extend BaseActivityInterface.AnimationFactory factory = mActivityInterface.prepareRecentsUI( mDeviceState, wasVisible, (controller) -> { - controller.dispatchOnStart(); - controller.getAnimationPlayer().end(); + controller.getNormalController().dispatchOnStart(); + controller.getNormalController().getAnimationPlayer().end(); }); factory.createActivityInterface(RECENTS_LAUNCH_DURATION); factory.setRecentsAttachedToAppWindow(true, false); diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java index 9dc2132683..8b108ac299 100644 --- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java +++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java @@ -18,7 +18,6 @@ package com.android.quickstep; import static com.android.launcher3.anim.Interpolators.ACCEL_2; import static com.android.launcher3.anim.Interpolators.INSTANT; import static com.android.launcher3.anim.Interpolators.LINEAR; -import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS; import static com.android.quickstep.AbsSwipeUpHandler.RECENTS_ATTACH_DURATION; import static com.android.quickstep.SysUINavigationMode.getMode; import static com.android.quickstep.SysUINavigationMode.hideShelfInTwoButtonLandscape; @@ -28,6 +27,7 @@ import static com.android.quickstep.util.RecentsAtomicAnimationFactory.INDEX_REC import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET; import static com.android.quickstep.views.RecentsView.FULLSCREEN_PROGRESS; import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY; +import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION; import android.animation.Animator; import android.annotation.TargetApi; @@ -36,7 +36,6 @@ import android.content.res.Resources; import android.graphics.Rect; import android.os.Build; import android.view.MotionEvent; -import android.view.animation.Interpolator; import androidx.annotation.Nullable; import androidx.annotation.UiThread; @@ -52,7 +51,7 @@ import com.android.launcher3.touch.PagedOrientationHandler; import com.android.launcher3.util.WindowBounds; import com.android.quickstep.SysUINavigationMode.Mode; import com.android.quickstep.util.ActivityInitListener; -import com.android.quickstep.util.ShelfPeekAnim; +import com.android.quickstep.util.AnimatorControllerWithResistance; import com.android.quickstep.util.SplitScreenBounds; import com.android.quickstep.views.RecentsView; import com.android.systemui.shared.recents.model.ThumbnailData; @@ -106,7 +105,7 @@ public abstract class BaseActivityInterface callback); + boolean activityVisible, Consumer callback); public abstract ActivityInitListener createActivityInitListener( Predicate onInitListener); @@ -297,9 +296,6 @@ public abstract class BaseActivityInterface