summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2015-08-13 23:48:04 (GMT)
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-08-13 23:48:04 (GMT)
commitd468ee90911bee4d83e119500b52df1984107411 (patch)
tree04238ba94e1f9eea097292b65cc31d0e53ed2be5
parent97b0d08d92c64034ba03ae8da5a8531edbd60d52 (diff)
parentd106418dee16b041f30682540fbd3ca3d841b7af (diff)
downloadandroid_packages_apps_Trebuchet-d468ee90911bee4d83e119500b52df1984107411.zip
android_packages_apps_Trebuchet-d468ee90911bee4d83e119500b52df1984107411.tar.gz
android_packages_apps_Trebuchet-d468ee90911bee4d83e119500b52df1984107411.tar.bz2
Merge "Reloading launcher whenever there is an external update to contentprovider, irrespective of the uri" into ub-launcher3-burnaby
-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 6cbb267..0599714 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;
}