summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/launcher3/Launcher.java4
-rw-r--r--src/com/android/launcher3/LauncherAppWidgetHost.java3
-rw-r--r--src/com/android/launcher3/LauncherModel.java17
3 files changed, 12 insertions, 12 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index cd861d4e0..a7e32d31a 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -4608,13 +4608,13 @@ public class Launcher extends Activity
}
if (mAppsCustomizeContent != null) {
mAppsCustomizeContent.onPackagesUpdated(
- LauncherModel.getSortedWidgetsAndShortcuts(this));
+ LauncherModel.getSortedWidgetsAndShortcuts(this, false /* refresh */));
}
} else {
if (mAppsCustomizeContent != null) {
mAppsCustomizeContent.setApps(apps);
mAppsCustomizeContent.onPackagesUpdated(
- LauncherModel.getSortedWidgetsAndShortcuts(this));
+ LauncherModel.getSortedWidgetsAndShortcuts(this, false /* refresh */));
}
}
if (mLauncherCallbacks != null) {
diff --git a/src/com/android/launcher3/LauncherAppWidgetHost.java b/src/com/android/launcher3/LauncherAppWidgetHost.java
index 840508a1d..a28fd255a 100644
--- a/src/com/android/launcher3/LauncherAppWidgetHost.java
+++ b/src/com/android/launcher3/LauncherAppWidgetHost.java
@@ -81,7 +81,8 @@ public class LauncherAppWidgetHost extends AppWidgetHost {
protected void onProvidersChanged() {
// Once we get the message that widget packages are updated, we need to rebind items
// in AppsCustomize accordingly.
- mLauncher.bindPackagesUpdated(LauncherModel.getSortedWidgetsAndShortcuts(mLauncher));
+ mLauncher.bindPackagesUpdated(LauncherModel.getSortedWidgetsAndShortcuts(mLauncher,
+ true /* refresh */));
for (Runnable callback : mProviderChangeListeners) {
callback.run();
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index 9f976318d..c39bcee09 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -175,7 +175,6 @@ public class LauncherModel extends BroadcastReceiver
// sBgWidgetProviders is the set of widget providers including custom internal widgets
public static HashMap<ComponentName, LauncherAppWidgetProviderInfo> sBgWidgetProviders;
- public static boolean sWidgetProvidersDirty;
// sPendingPackages is a set of packages which could be on sdcard and are not available yet
static final HashMap<UserHandleCompat, HashSet<String>> sPendingPackages =
@@ -3319,7 +3318,7 @@ public class LauncherModel extends BroadcastReceiver
}
final ArrayList<Object> widgetsAndShortcuts =
- getSortedWidgetsAndShortcuts(context);
+ getSortedWidgetsAndShortcuts(context, true /* refresh */);
mHandler.post(new Runnable() {
@Override
public void run() {
@@ -3342,9 +3341,10 @@ public class LauncherModel extends BroadcastReceiver
}
}
- public static List<LauncherAppWidgetProviderInfo> getWidgetProviders(Context context) {
+ public static List<LauncherAppWidgetProviderInfo> getWidgetProviders(Context context,
+ boolean refresh) {
synchronized (sBgLock) {
- if (sBgWidgetProviders != null && !sWidgetProvidersDirty) {
+ if (sBgWidgetProviders != null && !refresh) {
return new ArrayList<LauncherAppWidgetProviderInfo>(sBgWidgetProviders.values());
}
sBgWidgetProviders = new HashMap<ComponentName, LauncherAppWidgetProviderInfo>();
@@ -3361,7 +3361,6 @@ public class LauncherModel extends BroadcastReceiver
info = new LauncherAppWidgetProviderInfo(context, widget);
sBgWidgetProviders.put(info.provider, info);
}
- sWidgetProvidersDirty = false;
return new ArrayList<LauncherAppWidgetProviderInfo>(sBgWidgetProviders.values());
}
}
@@ -3369,17 +3368,17 @@ public class LauncherModel extends BroadcastReceiver
public static LauncherAppWidgetProviderInfo getProviderInfo(Context ctx, ComponentName name) {
synchronized (sBgLock) {
if (sBgWidgetProviders == null) {
- getWidgetProviders(ctx);
+ getWidgetProviders(ctx, false /* refresh */);
}
return sBgWidgetProviders.get(name);
}
}
- // Returns a list of ResolveInfos/AppWindowInfos in sorted order
- public static ArrayList<Object> getSortedWidgetsAndShortcuts(Context context) {
+ // Returns a list of ResolveInfos/AppWidgetInfos in sorted order
+ public static ArrayList<Object> getSortedWidgetsAndShortcuts(Context context, boolean refresh) {
PackageManager packageManager = context.getPackageManager();
final ArrayList<Object> widgetsAndShortcuts = new ArrayList<Object>();
- widgetsAndShortcuts.addAll(getWidgetProviders(context));
+ widgetsAndShortcuts.addAll(getWidgetProviders(context, refresh));
Intent shortcutsIntent = new Intent(Intent.ACTION_CREATE_SHORTCUT);
widgetsAndShortcuts.addAll(packageManager.queryIntentActivities(shortcutsIntent, 0));
Collections.sort(widgetsAndShortcuts, new WidgetAndShortcutNameComparator(context));