diff options
author | Makoto Onuki <omakoto@google.com> | 2012-03-28 09:58:18 -0700 |
---|---|---|
committer | The Android Automerger <android-build@android.com> | 2012-03-28 16:42:36 -0700 |
commit | 1365d25fb9b3fad07bc5d5d65271dff971a1eeca (patch) | |
tree | 918f3cad308f35f4d1ad068d645e4d8cac4bfb2c | |
parent | 5141ee997fec406aca857b9f6f527aeaa358abd1 (diff) | |
download | packages_providers_ContactsProvider-1365d25fb9b3fad07bc5d5d65271dff971a1eeca.zip packages_providers_ContactsProvider-1365d25fb9b3fad07bc5d5d65271dff971a1eeca.tar.gz packages_providers_ContactsProvider-1365d25fb9b3fad07bc5d5d65271dff971a1eeca.tar.bz2 |
Revert ""Rollback" mimetype cache"
This reverts commit c624ff13d5df4848a6ec605e25ea8469dd677d5d
Due to b/6123232
3 files changed, 4 insertions, 51 deletions
diff --git a/src/com/android/providers/contacts/ContactsDatabaseHelper.java b/src/com/android/providers/contacts/ContactsDatabaseHelper.java index e4879ea..f451b2c 100644 --- a/src/com/android/providers/contacts/ContactsDatabaseHelper.java +++ b/src/com/android/providers/contacts/ContactsDatabaseHelper.java @@ -701,16 +701,12 @@ public class ContactsDatabaseHelper extends SQLiteOpenHelper { } /** In-memory cache of previously found MIME-type mappings */ + // TODO Use ConcurrentHashMap? private final HashMap<String, Long> mMimetypeCache = new HashMap<String, Long>(); - - /** TODO Remove it */ + /** In-memory cache of previously found package name mappings */ + // TODO Use ConcurrentHashMap? private final HashMap<String, Long> mPackageCache = new HashMap<String, Long>(); - /** - * The last known maximum mimetype ID when the current transaction started. Used to - * "Rollback" {@link #mMimetypeCache}. - */ - private long mMaxMimeTypeIdAtTransactionStart; private long mMimeTypeIdEmail; private long mMimeTypeIdIm; private long mMimeTypeIdNickname; @@ -4127,42 +4123,6 @@ public class ContactsDatabaseHelper extends SQLiteOpenHelper { } } - private long getBiggestCachedMimetypeId() { - long max = -1; - for (long id : mMimetypeCache.values()) { - if (id > max) max = id; - } - return max; - } - - public void onBeginTransaction() { - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "onBeginTransaction: [" + getClass().getSimpleName() + "]"); - } - mMaxMimeTypeIdAtTransactionStart = getBiggestCachedMimetypeId(); - } - - public void onCommitTransaction() { - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "onCommitTransaction: [" + getClass().getSimpleName() + "]"); - } - } - - public void onRollbackTransaction() { - Log.w(TAG, "onRollbackTransaction: [" + getClass().getSimpleName() + "]"); - - final Set<String> mimetypesToRemove = Sets.newHashSet(); - for (String mimetype : mMimetypeCache.keySet()) { - if (mMimetypeCache.get(mimetype) > mMaxMimeTypeIdAtTransactionStart) { - mimetypesToRemove.add(mimetype); - } - } - - for (String mimetype : mimetypesToRemove) { - mMimetypeCache.remove(mimetype); - } - } - /** * Gets all accounts in the accounts table. */ diff --git a/src/com/android/providers/contacts/ContactsProvider2.java b/src/com/android/providers/contacts/ContactsProvider2.java index b85cc6b..7473718 100644 --- a/src/com/android/providers/contacts/ContactsProvider2.java +++ b/src/com/android/providers/contacts/ContactsProvider2.java @@ -2127,7 +2127,6 @@ public class ContactsProvider2 extends AbstractContactsProvider mContactAggregator.clearPendingAggregations(); mContactTransactionContext.clear(); } - mDbHelper.get().onBeginTransaction(); } @Override @@ -2151,15 +2150,11 @@ public class ContactsProvider2 extends AbstractContactsProvider updateProviderStatus(); mProviderStatusUpdateNeeded = false; } - mDbHelper.get().onCommitTransaction(); } @Override public void onRollback() { - if (VERBOSE_LOGGING) { - Log.v(TAG, "onRollback"); - } - mDbHelper.get().onRollbackTransaction(); + // Not used. } private void updateSearchIndexInTransaction() { diff --git a/src/com/android/providers/contacts/ProfileProvider.java b/src/com/android/providers/contacts/ProfileProvider.java index 360909f..8aa653d 100644 --- a/src/com/android/providers/contacts/ProfileProvider.java +++ b/src/com/android/providers/contacts/ProfileProvider.java @@ -140,13 +140,11 @@ public class ProfileProvider extends AbstractContactsProvider { return mDelegate.getLocale(); } - @Override public void onBegin() { mDelegate.switchToProfileMode(); mDelegate.onBegin(); } - @Override public void onCommit() { mDelegate.switchToProfileMode(); mDelegate.onCommit(); |