Add support for getting widgets/shortucts for a particular package/user
Bug: 34940468
Bug: 33553066
Change-Id: I5d0131df206c6a13d4227ad28c5b094bbf1343df
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 4eeb3c0..dbf535a 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -54,6 +54,7 @@
import android.os.SystemClock;
import android.os.Trace;
import android.os.UserHandle;
+import android.support.annotation.Nullable;
import android.text.Selection;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
@@ -3929,13 +3930,17 @@
@Override
public void notifyWidgetProvidersChanged() {
- notifyWidgetProvidersChanged(false);
+ if (mWorkspace.getState().shouldUpdateWidget) {
+ refreshAndBindWidgetsForPackageUser(null);
+ }
}
- public void notifyWidgetProvidersChanged(boolean force) {
- if (force || mWorkspace.getState().shouldUpdateWidget) {
- mModel.refreshAndBindWidgetsAndShortcuts(this, mWidgetsView.isEmpty());
- }
+ /**
+ * @param packageUser if null, refreshes all widgets and shortcuts, otherwise only
+ * refreshes the widgets and shortcuts associated with the given package/user
+ */
+ public void refreshAndBindWidgetsForPackageUser(@Nullable PackageUserKey packageUser) {
+ mModel.refreshAndBindWidgetsAndShortcuts(this, mWidgetsView.isEmpty(), packageUser);
}
public void lockScreenOrientation() {