summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTony <twickham@google.com>2018-02-02 21:45:39 -0600
committerTony <twickham@google.com>2018-02-05 18:48:24 -0800
commitdc76f8e85699a0da959959f4e1af79935be1532c (patch)
tree138d440ea2973eb589832caf26d63b963681e06a /src
parent9c70e7e220b8ffebc15d3cc1fed89163d4724abf (diff)
downloadandroid_packages_apps_Trebuchet-dc76f8e85699a0da959959f4e1af79935be1532c.tar.gz
android_packages_apps_Trebuchet-dc76f8e85699a0da959959f4e1af79935be1532c.tar.bz2
android_packages_apps_Trebuchet-dc76f8e85699a0da959959f4e1af79935be1532c.zip
Cancel launcher app transition when changing states
The app transition might change an object that the new state depends on, causing an inconsistent state. Bug: 72816542 Change-Id: Ia6dd52971b52be5589c88f4f6d93d06146fbadab
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/Launcher.java8
-rw-r--r--src/com/android/launcher3/LauncherAppTransitionManager.java4
-rw-r--r--src/com/android/launcher3/LauncherStateManager.java7
3 files changed, 15 insertions, 4 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 759579314..fd9b61a27 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -20,7 +20,6 @@ import static android.content.pm.ActivityInfo.CONFIG_ORIENTATION;
import static android.content.pm.ActivityInfo.CONFIG_SCREEN_SIZE;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
-
import static com.android.launcher3.ItemInfoWithIcon.FLAG_DISABLED_BY_PUBLISHER;
import static com.android.launcher3.ItemInfoWithIcon.FLAG_DISABLED_LOCKED_USER;
import static com.android.launcher3.ItemInfoWithIcon.FLAG_DISABLED_QUIET_USER;
@@ -40,7 +39,6 @@ import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
-import android.app.ActivityOptions;
import android.app.AlertDialog;
import android.appwidget.AppWidgetHostView;
import android.appwidget.AppWidgetManager;
@@ -55,14 +53,12 @@ import android.content.IntentFilter;
import android.content.IntentSender;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
-import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.Rect;
-import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
@@ -446,6 +442,10 @@ public class Launcher extends BaseActivity
return mStateManager;
}
+ public LauncherAppTransitionManager getAppTransitionManager() {
+ return mAppTransitionManager;
+ }
+
protected void overrideTheme(boolean isDark, boolean supportsDarkText) {
if (isDark) {
setTheme(R.style.LauncherThemeDark);
diff --git a/src/com/android/launcher3/LauncherAppTransitionManager.java b/src/com/android/launcher3/LauncherAppTransitionManager.java
index be2dc54ed..c0d52c1c1 100644
--- a/src/com/android/launcher3/LauncherAppTransitionManager.java
+++ b/src/com/android/launcher3/LauncherAppTransitionManager.java
@@ -64,4 +64,8 @@ public class LauncherAppTransitionManager {
public Bundle getActivityLaunchOptions(Launcher launcher, View v) {
return getDefaultActivityLaunchOptions(launcher, v);
}
+
+ /** Cancels the current transition animation */
+ public void finishAnimation() {
+ }
}
diff --git a/src/com/android/launcher3/LauncherStateManager.java b/src/com/android/launcher3/LauncherStateManager.java
index 8eeeec3df..6eafc895d 100644
--- a/src/com/android/launcher3/LauncherStateManager.java
+++ b/src/com/android/launcher3/LauncherStateManager.java
@@ -269,6 +269,13 @@ public class LauncherStateManager {
// Only disable clipping if needed, otherwise leave it as previous value.
mLauncher.getWorkspace().setClipChildren(false);
}
+
+ // If we are still animating to launcher from an app,
+ // finish it and let this state animation take over.
+ LauncherAppTransitionManager transitionManager = mLauncher.getAppTransitionManager();
+ if (transitionManager != null) {
+ transitionManager.finishAnimation();
+ }
}
private void onStateTransitionEnd(LauncherState state) {