summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2015-09-08 21:01:03 (GMT)
committerSunny Goyal <sunnygoyal@google.com>2015-09-09 16:38:52 (GMT)
commitc74e41973a74aa416e16aeadaa2f491153da26bc (patch)
treed996ab627719d732e3b955b33cf7b9bfe87d1fba
parent606726ba289583a67188d9448b220c2e3fae87d7 (diff)
downloadandroid_packages_apps_Trebuchet-c74e41973a74aa416e16aeadaa2f491153da26bc.zip
android_packages_apps_Trebuchet-c74e41973a74aa416e16aeadaa2f491153da26bc.tar.gz
android_packages_apps_Trebuchet-c74e41973a74aa416e16aeadaa2f491153da26bc.tar.bz2
Restoring provider behavior for reloading app on old devices
> For older devices, launcher will only reload in case of inserts with specific query parameters > For older devices, launcehr will notify content observers of any internal inserts > Chaning TAG for Launcher provider as max logging tag is only 23 characters Bug: 23821706 Change-Id: I32891387612d967c41ddae848c43dc4b1de1b0e9
-rw-r--r--src/com/android/launcher3/LauncherProvider.java20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/com/android/launcher3/LauncherProvider.java b/src/com/android/launcher3/LauncherProvider.java
index 20844ec..8791e9e 100644
--- a/src/com/android/launcher3/LauncherProvider.java
+++ b/src/com/android/launcher3/LauncherProvider.java
@@ -65,12 +65,11 @@ import java.util.HashSet;
import java.util.List;
public class LauncherProvider extends ContentProvider {
- private static final String TAG = "Launcher.LauncherProvider";
+ private static final String TAG = "LauncherProvider";
private static final boolean LOGD = false;
private static final int DATABASE_VERSION = 26;
- static final String OLD_AUTHORITY = "com.android.launcher2.settings";
public static final String AUTHORITY = ProviderConfig.AUTHORITY;
static final String TABLE_FAVORITES = LauncherSettings.Favorites.TABLE_NAME;
@@ -139,7 +138,7 @@ public class LauncherProvider extends ContentProvider {
}
private void reloadLauncherIfExternal() {
- if (Binder.getCallingPid() != Process.myPid()) {
+ if (Utilities.ATLEAST_MARSHMALLOW && Binder.getCallingPid() != Process.myPid()) {
LauncherAppState app = LauncherAppState.getInstanceNoCreate();
if (app != null) {
app.reloadWorkspace();
@@ -166,7 +165,20 @@ public class LauncherProvider extends ContentProvider {
uri = ContentUris.withAppendedId(uri, rowId);
notifyListeners();
- reloadLauncherIfExternal();
+ if (Utilities.ATLEAST_MARSHMALLOW) {
+ reloadLauncherIfExternal();
+ } else {
+ // Deprecated behavior to support legacy devices which rely on provider callbacks.
+ LauncherAppState app = LauncherAppState.getInstanceNoCreate();
+ if (app != null && "true".equals(uri.getQueryParameter("isExternalAdd"))) {
+ app.reloadWorkspace();
+ }
+
+ String notify = uri.getQueryParameter("notify");
+ if (notify == null || "true".equals(notify)) {
+ getContext().getContentResolver().notifyChange(uri, null);
+ }
+ }
return uri;
}