summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2015-08-13 23:53:13 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-08-13 23:53:13 +0000
commite88491d66bb66d69033f563df17f9474dc188de7 (patch)
tree164a4ca6cd1b23e23e5c33079e3cbc327504be6e /src
parent4e7a1018bcf2338266b3102d09b11e1d9657156d (diff)
parentd468ee90911bee4d83e119500b52df1984107411 (diff)
downloadandroid_packages_apps_Trebuchet-e88491d66bb66d69033f563df17f9474dc188de7.tar.gz
android_packages_apps_Trebuchet-e88491d66bb66d69033f563df17f9474dc188de7.tar.bz2
android_packages_apps_Trebuchet-e88491d66bb66d69033f563df17f9474dc188de7.zip
am d468ee90: Merge "Reloading launcher whenever there is an external update to contentprovider, irrespective of the uri" into ub-launcher3-burnaby
* commit 'd468ee90911bee4d83e119500b52df1984107411': Reloading launcher whenever there is an external update to contentprovider, irrespective of the uri
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/LauncherProvider.java29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/com/android/launcher3/LauncherProvider.java b/src/com/android/launcher3/LauncherProvider.java
index 6cbb267be..059971405 100644
--- a/src/com/android/launcher3/LauncherProvider.java
+++ b/src/com/android/launcher3/LauncherProvider.java
@@ -77,8 +77,6 @@ public class LauncherProvider extends ContentProvider {
static final String TABLE_WORKSPACE_SCREENS = LauncherSettings.WorkspaceScreens.TABLE_NAME;
static final String EMPTY_DATABASE_CREATED = "EMPTY_DATABASE_CREATED";
- private static final String URI_PARAM_IS_EXTERNAL_ADD = "isExternalAdd";
-
private static final String RESTRICTION_PACKAGE_NAME = "workspace.configuration.package.name";
@Thunk LauncherProviderChangeListener mListener;
@@ -140,14 +138,21 @@ public class LauncherProvider extends ContentProvider {
return db.insert(table, nullColumnHack, values);
}
+ private void reloadLauncherIfExternal() {
+ if (Binder.getCallingPid() != Process.myPid()) {
+ LauncherAppState app = LauncherAppState.getInstanceNoCreate();
+ if (app != null) {
+ app.reloadWorkspace();
+ }
+ }
+ }
+
@Override
public Uri insert(Uri uri, ContentValues initialValues) {
SqlArguments args = new SqlArguments(uri);
- // In very limited cases, we support system|signature permission apps to add to the db
- String externalAdd = uri.getQueryParameter(URI_PARAM_IS_EXTERNAL_ADD);
- final boolean isExternalAll = externalAdd != null && "true".equals(externalAdd);
- if (isExternalAll) {
+ // In very limited cases, we support system|signature permission apps to modify the db.
+ if (Binder.getCallingPid() != Process.myPid()) {
if (!mOpenHelper.initializeExternalAdd(initialValues)) {
return null;
}
@@ -161,13 +166,7 @@ public class LauncherProvider extends ContentProvider {
uri = ContentUris.withAppendedId(uri, rowId);
notifyListeners();
- if (isExternalAll) {
- LauncherAppState app = LauncherAppState.getInstanceNoCreate();
- if (app != null) {
- app.reloadWorkspace();
- }
- }
-
+ reloadLauncherIfExternal();
return uri;
}
@@ -192,6 +191,7 @@ public class LauncherProvider extends ContentProvider {
}
notifyListeners();
+ reloadLauncherIfExternal();
return values.length;
}
@@ -203,6 +203,7 @@ public class LauncherProvider extends ContentProvider {
try {
ContentProviderResult[] result = super.applyBatch(operations);
db.setTransactionSuccessful();
+ reloadLauncherIfExternal();
return result;
} finally {
db.endTransaction();
@@ -217,6 +218,7 @@ public class LauncherProvider extends ContentProvider {
int count = db.delete(args.table, args.where, args.args);
if (count > 0) notifyListeners();
+ reloadLauncherIfExternal();
return count;
}
@@ -229,6 +231,7 @@ public class LauncherProvider extends ContentProvider {
int count = db.update(args.table, values, args.where, args.args);
if (count > 0) notifyListeners();
+ reloadLauncherIfExternal();
return count;
}