Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 97574ede authored by Sunny Goyal's avatar Sunny Goyal Committed by android-build-merger
Browse files

Using add/replace instead of update when updating an entry.

am: caa52918

Change-Id: I728322245f07e0bc87e8a0726a22932f57248500
parents 9135a52e caa52918
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -773,13 +773,15 @@ public class IconCache {
        public void run() {
            if (!mAppsToUpdate.isEmpty()) {
                LauncherActivityInfoCompat app = mAppsToUpdate.pop();
                String cn = app.getComponentName().flattenToString();
                String pkg = app.getComponentName().getPackageName();
                PackageInfo info = mPkgInfoMap.get(pkg);
                if (info != null) {
                    synchronized (IconCache.this) {
                        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());

                        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(
+0 −16
Original line number Diff line number Diff line
@@ -28,22 +28,6 @@ public abstract class SQLiteCacheHelper {
        mIgnoreWrites = false;
    }

    /**
     * @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[])
     */