diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2017-12-18 13:49:44 -0800 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2017-12-19 12:50:17 -0800 |
commit | 29947f0b53eb30c0324204376df001680d4d4ab1 (patch) | |
tree | f5b60c1d10c9f2d00a334f17f536fdcb451d2f00 /src/com/android/launcher3/LauncherModel.java | |
parent | e15e2a8267c677a41bd91eac4d79ee36d467d8d4 (diff) | |
download | packages_apps_Trebuchet-29947f0b53eb30c0324204376df001680d4d4ab1.tar.gz packages_apps_Trebuchet-29947f0b53eb30c0324204376df001680d4d4ab1.tar.bz2 packages_apps_Trebuchet-29947f0b53eb30c0324204376df001680d4d4ab1.zip |
No more waiting around for resume
Apply model updates as son as they arrive instead of waiting for onResume.
Various workspace items do not use any configuration dependent resources.
For Widgets, we wait until the host starts lietening before inflating the actual view.
Change-Id: Icb2f5e5940c1ce6c27062ccd34eff87e80af5ab1
Diffstat (limited to 'src/com/android/launcher3/LauncherModel.java')
-rw-r--r-- | src/com/android/launcher3/LauncherModel.java | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java index 469c5f1c0..35bf9e9ee 100644 --- a/src/com/android/launcher3/LauncherModel.java +++ b/src/com/android/launcher3/LauncherModel.java @@ -16,6 +16,9 @@ package com.android.launcher3; +import static com.android.launcher3.LauncherAppState.ACTION_FORCE_ROLOAD; +import static com.android.launcher3.config.FeatureFlags.IS_DOGFOOD_BUILD; + import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.ContentProviderOperation; @@ -37,6 +40,7 @@ import android.util.Pair; import com.android.launcher3.compat.LauncherAppsCompat; import com.android.launcher3.compat.PackageInstallerCompat.PackageInstallInfo; import com.android.launcher3.compat.UserManagerCompat; +import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.graphics.LauncherIcons; import com.android.launcher3.model.AddWorkspaceItemsTask; import com.android.launcher3.model.BgDataModel; @@ -135,7 +139,6 @@ public class LauncherModel extends BroadcastReceiver }; public interface Callbacks { - public boolean setLoadOnResume(); public int getCurrentWorkspaceScreen(); public void clearPendingBinds(); public void startBinding(); @@ -405,6 +408,8 @@ public class LauncherModel extends BroadcastReceiver enqueueModelUpdateTask(new UserLockStateChangedTask(user)); } } + } else if (IS_DOGFOOD_BUILD && ACTION_FORCE_ROLOAD.equals(action)) { + forceReload(); } } @@ -419,25 +424,11 @@ public class LauncherModel extends BroadcastReceiver mModelLoaded = false; } - // Do this here because if the launcher activity is running it will be restarted. - // If it's not running startLoaderFromBackground will merely tell it that it needs - // to reload. - startLoaderFromBackground(); - } - - /** - * When the launcher is in the background, it's possible for it to miss paired - * configuration changes. So whenever we trigger the loader from the background - * tell the launcher that it needs to re-run the loader when it comes back instead - * of doing it now. - */ - public void startLoaderFromBackground() { + // Start the loader if launcher is already running, otherwise the loader will run, + // the next time launcher starts Callbacks callbacks = getCallback(); if (callbacks != null) { - // Only actually run the loader if they're not paused. - if (!callbacks.setLoadOnResume()) { - startLoader(callbacks.getCurrentWorkspaceScreen()); - } + startLoader(callbacks.getCurrentWorkspaceScreen()); } } |