diff options
author | Tony <twickham@google.com> | 2017-07-31 23:29:42 -0700 |
---|---|---|
committer | Tony Wickham <twickham@google.com> | 2017-08-04 11:52:42 -0700 |
commit | 2917a8bf2b83c0d17400b1475f01a9a8d9137f62 (patch) | |
tree | 997ee0bcefeac147867f0e8612594ea739ed3048 /src/com/android/launcher3/Launcher.java | |
parent | 00abdaca619d3a91aad9f9cc2c192650705c6b98 (diff) | |
download | android_packages_apps_Trebuchet-2917a8bf2b83c0d17400b1475f01a9a8d9137f62.tar.gz android_packages_apps_Trebuchet-2917a8bf2b83c0d17400b1475f01a9a8d9137f62.tar.bz2 android_packages_apps_Trebuchet-2917a8bf2b83c0d17400b1475f01a9a8d9137f62.zip |
Defer some work until after workspace fade-in
Defer:
- Setting all apps
- Setting widgets
Also set the launcher-loader thread to THREAD_PRIORITY_BACKGROUND
for the duration of the animation.
Bug: 37965432
Change-Id: I8364940805b84aecb8353a473ab4d575c27bfec4
Diffstat (limited to 'src/com/android/launcher3/Launcher.java')
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 7c258616f..615ec4716 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -144,6 +144,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Set; +import java.util.concurrent.Executor; /** * Default launcher application. @@ -1855,6 +1856,8 @@ public class Launcher extends BaseActivity LauncherAnimUtils.onDestroyActivity(); + clearPendingBinds(); + if (mLauncherCallbacks != null) { mLauncherCallbacks.onDestroy(); } @@ -3705,6 +3708,13 @@ public class Launcher extends BaseActivity } if (mAppsView != null) { + Executor pendingExecutor = getPendingExecutor(); + if (pendingExecutor != null && mState != State.APPS) { + // Wait until the fade in animation has finished before setting all apps list. + mTmpAppsList = apps; + pendingExecutor.execute(mBindAllApplicationsRunnable); + return; + } mAppsView.setApps(apps); } if (mLauncherCallbacks != null) { @@ -3713,6 +3723,14 @@ public class Launcher extends BaseActivity } /** + * Returns an Executor that will run after the launcher is first drawn (including after the + * initial fade in animation). Returns null if the first draw has already occurred. + */ + public @Nullable Executor getPendingExecutor() { + return mPendingExecutor != null && mPendingExecutor.canQueue() ? mPendingExecutor : null; + } + + /** * Copies LauncherModel's map of activities to shortcut ids to Launcher's. This is necessary * because LauncherModel's map is updated in the background, while Launcher runs on the UI. */ @@ -3904,6 +3922,12 @@ public class Launcher extends BaseActivity } if (mWidgetsView != null && allWidgets != null) { + Executor pendingExecutor = getPendingExecutor(); + if (pendingExecutor != null && mState != State.WIDGETS) { + mAllWidgets = allWidgets; + pendingExecutor.execute(mBindAllWidgetsRunnable); + return; + } mWidgetsView.setWidgets(allWidgets); mAllWidgets = null; } |