summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2016-10-07 18:04:15 (GMT)
committerAndroid (Google) Code Review <android-gerrit@google.com>2016-10-07 18:04:16 (GMT)
commit81300a9f75e34f3cf22b911fb087c528941ed516 (patch)
tree47b30c6abb54a7a67061c5acfe618ccaa0a77c9f
parent1ee2db14e08404db72e9b016c76d965571c418e0 (diff)
parentcaa52918f17158ac779b6faab1735e87f0702e48 (diff)
downloadandroid_packages_apps_Trebuchet-81300a9f75e34f3cf22b911fb087c528941ed516.zip
android_packages_apps_Trebuchet-81300a9f75e34f3cf22b911fb087c528941ed516.tar.gz
android_packages_apps_Trebuchet-81300a9f75e34f3cf22b911fb087c528941ed516.tar.bz2
Merge "Using add/replace instead of update when updating an entry." into ub-launcher3-calgary-polish
-rw-r--r--src/com/android/launcher3/IconCache.java16
-rw-r--r--src/com/android/launcher3/util/SQLiteCacheHelper.java16
2 files changed, 9 insertions, 23 deletions
diff --git a/src/com/android/launcher3/IconCache.java b/src/com/android/launcher3/IconCache.java
index d3fb38e..5c86b6b 100644
--- a/src/com/android/launcher3/IconCache.java
+++ b/src/com/android/launcher3/IconCache.java
@@ -772,13 +772,15 @@ public class IconCache {
public void run() {
if (!mAppsToUpdate.isEmpty()) {
LauncherActivityInfoCompat app = mAppsToUpdate.pop();
- String cn = app.getComponentName().flattenToString();
- ContentValues values = updateCacheAndGetContentValues(app, true);
- mIconDb.update(values,
- IconDB.COLUMN_COMPONENT + " = ? AND " + IconDB.COLUMN_USER + " = ?",
- new String[]{cn, Long.toString(mUserSerial)});
- mUpdatedPackages.add(app.getComponentName().getPackageName());
-
+ String pkg = app.getComponentName().getPackageName();
+ PackageInfo info = mPkgInfoMap.get(pkg);
+ if (info != null) {
+ synchronized (IconCache.this) {
+ ContentValues values = updateCacheAndGetContentValues(app, true);
+ addIconToDB(values, app.getComponentName(), info, mUserSerial);
+ }
+ mUpdatedPackages.add(pkg);
+ }
if (mAppsToUpdate.isEmpty() && !mUpdatedPackages.isEmpty()) {
// No more app to update. Notify model.
LauncherAppState.getInstance().getModel().onPackageIconsUpdated(
diff --git a/src/com/android/launcher3/util/SQLiteCacheHelper.java b/src/com/android/launcher3/util/SQLiteCacheHelper.java
index c455791..d1cfe42 100644
--- a/src/com/android/launcher3/util/SQLiteCacheHelper.java
+++ b/src/com/android/launcher3/util/SQLiteCacheHelper.java
@@ -29,22 +29,6 @@ public abstract class SQLiteCacheHelper {
}
/**
- * @see SQLiteDatabase#update(String, ContentValues, String, String[])
- */
- public void update(ContentValues values, String whereClause, String[] whereArgs) {
- if (mIgnoreWrites) {
- return;
- }
- try {
- mOpenHelper.getWritableDatabase().update(mTableName, values, whereClause, whereArgs);
- } catch (SQLiteFullException e) {
- onDiskFull(e);
- } catch (SQLiteException e) {
- Log.d(TAG, "Ignoring sqlite exception", e);
- }
- }
-
- /**
* @see SQLiteDatabase#delete(String, String, String[])
*/
public void delete(String whereClause, String[] whereArgs) {