summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/LauncherModel.java
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2016-06-29 18:12:15 -0700
committerTony Wickham <twickham@google.com>2016-06-30 14:14:48 -0700
commit80f5787b1c12be2a5ce3d11e01ff9435bae71bdf (patch)
tree0ccffa1294c066aa3d590d060c0961a8e1cecf5b /src/com/android/launcher3/LauncherModel.java
parent5215b545b98a19f2be626d26924af10757da1a76 (diff)
downloadandroid_packages_apps_Trebuchet-80f5787b1c12be2a5ce3d11e01ff9435bae71bdf.tar.gz
android_packages_apps_Trebuchet-80f5787b1c12be2a5ce3d11e01ff9435bae71bdf.tar.bz2
android_packages_apps_Trebuchet-80f5787b1c12be2a5ce3d11e01ff9435bae71bdf.zip
Call bindDeepShortcuts() from runBindSynchronousPage().
Otherwise Launcher's copy of the deep shortcut map is cleared when Launcher is re-created, such as on rotation, so the UI won't show shortcuts. Change-Id: I3bb6a904762dc4661cc2b5da28485e4bf778c9e7
Diffstat (limited to 'src/com/android/launcher3/LauncherModel.java')
-rw-r--r--src/com/android/launcher3/LauncherModel.java28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index 3e666541e..3e98c1336 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -236,7 +236,7 @@ public class LauncherModel extends BroadcastReceiver
/** Runs the specified runnable immediately if called from the main thread, otherwise it is
* posted on the main thread handler. */
- @Thunk void runOnMainThread(Runnable r) {
+ private void runOnMainThread(Runnable r) {
if (sWorkerThread.getThreadId() == Process.myTid()) {
// If we are on the worker thread, post onto the main handler
mHandler.post(r);
@@ -247,7 +247,7 @@ public class LauncherModel extends BroadcastReceiver
/** Runs the specified runnable immediately if called from the worker thread, otherwise it is
* posted on the worker thread handler. */
- @Thunk static void runOnWorkerThread(Runnable r) {
+ private static void runOnWorkerThread(Runnable r) {
if (sWorkerThread.getThreadId() == Process.myTid()) {
r.run();
} else {
@@ -1298,8 +1298,8 @@ public class LauncherModel extends BroadcastReceiver
// If there is already one running, tell it to stop.
stopLoaderLocked();
mLoaderTask = new LoaderTask(mApp.getContext(), synchronousBindPage);
- if (synchronousBindPage != PagedView.INVALID_RESTORE_PAGE
- && mAllAppsLoaded && mWorkspaceLoaded && !mIsLoaderTaskRunning) {
+ if (synchronousBindPage != PagedView.INVALID_RESTORE_PAGE && mAllAppsLoaded
+ && mWorkspaceLoaded && mDeepShortcutsLoaded && !mIsLoaderTaskRunning) {
mLoaderTask.runBindSynchronousPage(synchronousBindPage);
} else {
sWorkerThread.setPriority(Thread.NORM_PRIORITY);
@@ -1441,6 +1441,8 @@ public class LauncherModel extends BroadcastReceiver
// XXX: For now, continue posting the binding of AllApps as there are other issues that
// arise from that.
onlyBindAllApps();
+
+ bindDeepShortcuts();
}
public void run() {
@@ -2660,12 +2662,7 @@ public class LauncherModel extends BroadcastReceiver
}
}
};
- boolean isRunningOnMainThread = !(sWorkerThread.getThreadId() == Process.myTid());
- if (isRunningOnMainThread) {
- r.run();
- } else {
- mHandler.post(r);
- }
+ runOnMainThread(r);
}
private void loadAllApps() {
@@ -2777,7 +2774,7 @@ public class LauncherModel extends BroadcastReceiver
mDeepShortcutsLoaded = true;
}
}
- bindDeepShortcutMapOnMainThread();
+ bindDeepShortcuts();
}
public void dumpState() {
@@ -2810,10 +2807,10 @@ public class LauncherModel extends BroadcastReceiver
}
}
- private void bindDeepShortcutMapOnMainThread() {
+ public void bindDeepShortcuts() {
final MultiHashMap<ComponentKey, String> shortcutMapCopy = new MultiHashMap<>();
shortcutMapCopy.putAll(mBgDeepShortcutMap);
- mHandler.post(new Runnable() {
+ Runnable r = new Runnable() {
@Override
public void run() {
Callbacks callbacks = getCallback();
@@ -2821,7 +2818,8 @@ public class LauncherModel extends BroadcastReceiver
callbacks.bindDeepShortcutMap(shortcutMapCopy);
}
}
- });
+ };
+ runOnMainThread(r);
}
/**
@@ -3322,7 +3320,7 @@ public class LauncherModel extends BroadcastReceiver
// Update the deep shortcut map, in case the list of ids has changed for an activity.
updateDeepShortcutMap(mPackageName, mShortcuts);
- bindDeepShortcutMapOnMainThread();
+ bindDeepShortcuts();
}
}