diff options
author | Tony Wickham <twickham@google.com> | 2019-04-12 16:56:45 -0700 |
---|---|---|
committer | Tony Wickham <twickham@google.com> | 2019-04-16 10:56:59 -0700 |
commit | 1e24b6d7d590cc221ce3e2921c2c93db784a890d (patch) | |
tree | 5f819108cd564bcd0b631cf6a6cc8c4dd9fd4401 /quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java | |
parent | d4eed0b191196b4ba4e43adc573f11f24aef12ff (diff) | |
download | android_packages_apps_Trebuchet-1e24b6d7d590cc221ce3e2921c2c93db784a890d.tar.gz android_packages_apps_Trebuchet-1e24b6d7d590cc221ce3e2921c2c93db784a890d.tar.bz2 android_packages_apps_Trebuchet-1e24b6d7d590cc221ce3e2921c2c93db784a890d.zip |
Don't special case swipe up animation if launcher was visible
This case originally existed to handle transparent activities, but in
reality it was hit most often when swiping up during transitions, i.e.
before launcher was stopped. So now we do the same thing regardless of
whether launcher was "visible" at the start of the animation: go to the
background state immediately and create our transition from there. This
looks a little strange if the activity truly is transparent, because you
can see launcher jump to the background state, but ultimately leads to a
more consistent experience (and the state animation we used before
looked super weird anyway).
Test:
- Open Calculator from the home screen and immediately swipe up from nav
bar (before animation finishes)
- Open Calculator from overview and immediately swipe up from nav bar
- Open Caluclator from all apps and immediately swipe up from nav bar
- Open Cortana (which has a translucent activity) from home screen,
then swipe up.
- Open Cortana and quick switch from it
- Open Rube screenshot (dialog activity) from home screen and swipe up
- Open Rube screenshot from all apps and swipe up
- Open Rube screenshot from all apps and swipe up and back down (ensure
launcher returns to all apps state)
Change-Id: I87bdbc6ddf41971fd327c807269c0bd94c97c95c
Diffstat (limited to 'quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java')
-rw-r--r-- | quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java | 45 |
1 files changed, 15 insertions, 30 deletions
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java index baef2eb7c..7c7184606 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java @@ -38,6 +38,10 @@ import android.view.MotionEvent; import android.view.View; import android.view.animation.Interpolator; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.UiThread; + import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; @@ -59,10 +63,6 @@ import com.android.systemui.shared.system.RemoteAnimationTargetCompat; import java.util.function.BiPredicate; import java.util.function.Consumer; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.UiThread; - /** * {@link ActivityControlHelper} for the in-launcher recents. */ @@ -163,21 +163,16 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe } activity.getStateManager().setRestState(resetState); - final LauncherState fromState; - if (!activityVisible) { - // Since the launcher is not visible, we can safely reset the scroll position. - // This ensures then the next swipe up to all-apps starts from scroll 0. - activity.getAppsView().reset(false /* animate */); - fromState = animateActivity ? BACKGROUND_APP : OVERVIEW; - activity.getStateManager().goToState(fromState, false); + final LauncherState fromState = animateActivity ? BACKGROUND_APP : OVERVIEW; + activity.getStateManager().goToState(fromState, false); + // Since all apps is not visible, we can safely reset the scroll position. + // This ensures then the next swipe up to all-apps starts from scroll 0. + activity.getAppsView().reset(false /* animate */); - // Optimization, hide the all apps view to prevent layout while initializing - activity.getAppsView().getContentView().setVisibility(View.GONE); + // Optimization, hide the all apps view to prevent layout while initializing + activity.getAppsView().getContentView().setVisibility(View.GONE); - AccessibilityManagerCompat.sendStateEventToTest(activity, fromState.ordinal); - } else { - fromState = startState; - } + AccessibilityManagerCompat.sendStateEventToTest(activity, fromState.ordinal); return new AnimationFactory() { private Animator mShelfAnim; @@ -185,8 +180,7 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe @Override public void createActivityController(long transitionLength) { - createActivityControllerInternal(activity, activityVisible, fromState, - transitionLength, callback); + createActivityControllerInternal(activity, fromState, transitionLength, callback); } @Override @@ -230,18 +224,9 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe }; } - private void createActivityControllerInternal(Launcher activity, boolean wasVisible, - LauncherState fromState, long transitionLength, - Consumer<AnimatorPlaybackController> callback) { + private void createActivityControllerInternal(Launcher activity, LauncherState fromState, + long transitionLength, Consumer<AnimatorPlaybackController> callback) { LauncherState endState = OVERVIEW; - if (wasVisible && fromState != BACKGROUND_APP) { - // If a translucent app was launched fom launcher, animate launcher states. - DeviceProfile dp = activity.getDeviceProfile(); - long accuracy = 2 * Math.max(dp.widthPx, dp.heightPx); - callback.accept(activity.getStateManager() - .createAnimationToNewWorkspace(fromState, endState, accuracy)); - return; - } if (fromState == endState) { return; } |