diff options
author | Makoto Onuki <omakoto@google.com> | 2012-03-01 11:09:33 -0800 |
---|---|---|
committer | Makoto Onuki <omakoto@google.com> | 2012-03-01 16:42:31 -0800 |
commit | 47ad37083874664d5983627c3ecd8e1c9e86a6f8 (patch) | |
tree | 6bc460466ebdaf6125080d42c0557d37c3110dce /src/com | |
parent | 73e87a8245896e1b38c4dc10c951d2b841c361d4 (diff) | |
download | packages_providers_ContactsProvider-47ad37083874664d5983627c3ecd8e1c9e86a6f8.zip packages_providers_ContactsProvider-47ad37083874664d5983627c3ecd8e1c9e86a6f8.tar.gz packages_providers_ContactsProvider-47ad37083874664d5983627c3ecd8e1c9e86a6f8.tar.bz2 |
Add log to openAssetFile() and query()
(And remove from queryLocal)
To understand better what data is accessed.
Change-Id: Ib59de2336e291a1d19dc9c7b6bd6cb87f0d67f05
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/providers/contacts/ContactsProvider2.java | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/src/com/android/providers/contacts/ContactsProvider2.java b/src/com/android/providers/contacts/ContactsProvider2.java index 171a7c8..183526b 100644 --- a/src/com/android/providers/contacts/ContactsProvider2.java +++ b/src/com/android/providers/contacts/ContactsProvider2.java @@ -4666,6 +4666,9 @@ public class ContactsProvider2 extends AbstractContactsProvider @Override public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder, CancellationSignal cancellationSignal) { + if (VERBOSE_LOGGING) { + Log.v(TAG, "query uri=" + uri + " selection=" + selection + " order=" + sortOrder); + } waitForAccess(mReadAccessLatch); @@ -4832,9 +4835,6 @@ public class ContactsProvider2 extends AbstractContactsProvider protected Cursor queryLocal(final Uri uri, final String[] projection, String selection, String[] selectionArgs, String sortOrder, final long directoryId, final CancellationSignal cancellationSignal) { - if (VERBOSE_LOGGING) { - Log.v(TAG, "query=" + uri + " selection=" + selection + " order=" + sortOrder); - } // Default active DB to the contacts DB if none has been set. if (mActiveDb.get() == null) { @@ -7014,17 +7014,27 @@ public class ContactsProvider2 extends AbstractContactsProvider @Override public AssetFileDescriptor openAssetFile(Uri uri, String mode) throws FileNotFoundException { - if (mode.equals("r")) { - waitForAccess(mReadAccessLatch); - } else { - waitForAccess(mWriteAccessLatch); - } - if (mapsToProfileDb(uri)) { - switchToProfileMode(); - return mProfileProvider.openAssetFile(uri, mode); - } else { - switchToContactMode(); - return openAssetFileLocal(uri, mode); + boolean success = false; + try { + if (mode.equals("r")) { + waitForAccess(mReadAccessLatch); + } else { + waitForAccess(mWriteAccessLatch); + } + final AssetFileDescriptor ret; + if (mapsToProfileDb(uri)) { + switchToProfileMode(); + ret = mProfileProvider.openAssetFile(uri, mode); + } else { + switchToContactMode(); + ret = openAssetFileLocal(uri, mode); + } + success = true; + return ret; + } finally { + if (VERBOSE_LOGGING) { + Log.v(TAG, "openAssetFile uri=" + uri + " mode=" + mode + " success=" + success); + } } } |