summaryrefslogtreecommitdiffstats
path: root/src/com/android/providers
diff options
context:
space:
mode:
authorMakoto Onuki <omakoto@google.com>2012-03-05 11:18:52 -0800
committerMakoto Onuki <omakoto@google.com>2012-03-05 15:11:36 -0800
commit49ed71913609193a00059df944f6259e9397b0bd (patch)
tree237fe2947dce0e6215635aac5505d5ee43cc3f24 /src/com/android/providers
parent47ad37083874664d5983627c3ecd8e1c9e86a6f8 (diff)
downloadpackages_providers_ContactsProvider-49ed71913609193a00059df944f6259e9397b0bd.zip
packages_providers_ContactsProvider-49ed71913609193a00059df944f6259e9397b0bd.tar.gz
packages_providers_ContactsProvider-49ed71913609193a00059df944f6259e9397b0bd.tar.bz2
Move aggregator to its own package
... so that methods used only by ProfileAggregator don't have to be public. And fix some method visibilities that don't make sense. Needed to change the bogus ID in PhotoStoreTest; otherwise moving the aggregator test will make this test fail for some unclear reason. Bug 6118852 Change-Id: Ic0c022cbf50128f40c70559c1a7cf8e2a6c06fc8
Diffstat (limited to 'src/com/android/providers')
-rw-r--r--src/com/android/providers/contacts/CommonNicknameCache.java2
-rw-r--r--src/com/android/providers/contacts/ContactsDatabaseHelper.java4
-rw-r--r--src/com/android/providers/contacts/ContactsProvider2.java14
-rw-r--r--src/com/android/providers/contacts/DataRowHandler.java1
-rw-r--r--src/com/android/providers/contacts/DataRowHandlerForCommonDataKind.java2
-rw-r--r--src/com/android/providers/contacts/DataRowHandlerForCustomMimetype.java2
-rw-r--r--src/com/android/providers/contacts/DataRowHandlerForEmail.java1
-rw-r--r--src/com/android/providers/contacts/DataRowHandlerForGroupMembership.java1
-rw-r--r--src/com/android/providers/contacts/DataRowHandlerForIm.java1
-rw-r--r--src/com/android/providers/contacts/DataRowHandlerForNickname.java1
-rw-r--r--src/com/android/providers/contacts/DataRowHandlerForNote.java1
-rw-r--r--src/com/android/providers/contacts/DataRowHandlerForOrganization.java1
-rw-r--r--src/com/android/providers/contacts/DataRowHandlerForPhoneNumber.java1
-rw-r--r--src/com/android/providers/contacts/DataRowHandlerForPhoto.java2
-rw-r--r--src/com/android/providers/contacts/DataRowHandlerForStructuredName.java1
-rw-r--r--src/com/android/providers/contacts/DataRowHandlerForStructuredPostal.java1
-rw-r--r--src/com/android/providers/contacts/aggregation/ContactAggregator.java (renamed from src/com/android/providers/contacts/ContactAggregator.java)17
-rw-r--r--src/com/android/providers/contacts/aggregation/ProfileAggregator.java (renamed from src/com/android/providers/contacts/ProfileAggregator.java)10
18 files changed, 47 insertions, 16 deletions
diff --git a/src/com/android/providers/contacts/CommonNicknameCache.java b/src/com/android/providers/contacts/CommonNicknameCache.java
index 0276743..e1dfae3 100644
--- a/src/com/android/providers/contacts/CommonNicknameCache.java
+++ b/src/com/android/providers/contacts/CommonNicknameCache.java
@@ -87,7 +87,7 @@ public class CommonNicknameCache {
/**
* Returns nickname cluster IDs or null. Maintains cache.
*/
- protected String[] getCommonNicknameClusters(String normalizedName) {
+ public String[] getCommonNicknameClusters(String normalizedName) {
if (mNicknameBloomFilter == null) {
preloadNicknameBloomFilter();
}
diff --git a/src/com/android/providers/contacts/ContactsDatabaseHelper.java b/src/com/android/providers/contacts/ContactsDatabaseHelper.java
index fbc2c55..074949c 100644
--- a/src/com/android/providers/contacts/ContactsDatabaseHelper.java
+++ b/src/com/android/providers/contacts/ContactsDatabaseHelper.java
@@ -83,16 +83,14 @@ import android.util.Log;
import java.util.HashMap;
import java.util.Locale;
-import java.util.Map;
import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
/**
* Database helper for contacts. Designed as a singleton to make sure that all
* {@link android.content.ContentProvider} users get the same reference.
* Provides handy methods for maintaining package and mime-type lookup tables.
*/
-/* package */ class ContactsDatabaseHelper extends SQLiteOpenHelper {
+public class ContactsDatabaseHelper extends SQLiteOpenHelper {
private static final String TAG = "ContactsDatabaseHelper";
/**
diff --git a/src/com/android/providers/contacts/ContactsProvider2.java b/src/com/android/providers/contacts/ContactsProvider2.java
index 183526b..a2e4c7f 100644
--- a/src/com/android/providers/contacts/ContactsProvider2.java
+++ b/src/com/android/providers/contacts/ContactsProvider2.java
@@ -18,7 +18,6 @@ package com.android.providers.contacts;
import com.android.common.content.ProjectionMap;
import com.android.common.content.SyncStateContentProviderHelper;
-import com.android.providers.contacts.ContactAggregator.AggregationSuggestionParameter;
import com.android.providers.contacts.ContactLookupKey.LookupKeySegment;
import com.android.providers.contacts.ContactsDatabaseHelper.AccountsColumns;
import com.android.providers.contacts.ContactsDatabaseHelper.AggregatedPresenceColumns;
@@ -47,6 +46,9 @@ import com.android.providers.contacts.ContactsDatabaseHelper.Tables;
import com.android.providers.contacts.ContactsDatabaseHelper.ViewGroupsColumns;
import com.android.providers.contacts.ContactsDatabaseHelper.Views;
import com.android.providers.contacts.SearchIndexManager.FtsQueryBuilder;
+import com.android.providers.contacts.aggregation.ContactAggregator;
+import com.android.providers.contacts.aggregation.ContactAggregator.AggregationSuggestionParameter;
+import com.android.providers.contacts.aggregation.ProfileAggregator;
import com.android.providers.contacts.util.DbQueryUtils;
import com.android.providers.contacts.util.NeededForTesting;
import com.android.vcard.VCardComposer;
@@ -1812,11 +1814,11 @@ public class ContactsProvider2 extends AbstractContactsProvider
return mProfilePhotoStore;
}
- /* package */ int getMaxDisplayPhotoDim() {
+ public int getMaxDisplayPhotoDim() {
return mMaxDisplayPhotoDim;
}
- /* package */ int getMaxThumbnailPhotoDim() {
+ public int getMaxThumbnailPhotoDim() {
return mMaxThumbnailPhotoDim;
}
@@ -6374,10 +6376,6 @@ public class ContactsProvider2 extends AbstractContactsProvider
return false;
}
- public void updateLookupKeyForRawContact(SQLiteDatabase db, long rawContactId) {
- mAggregator.get().updateLookupKeyForRawContact(db, rawContactId);
- }
-
/**
* Returns the contact ID that is mentioned the highest number of times.
*/
@@ -7793,7 +7791,7 @@ public class ContactsProvider2 extends AbstractContactsProvider
/**
* Returns true if the specified account type and data set is writable.
*/
- protected boolean isWritableAccountWithDataSet(String accountTypeAndDataSet) {
+ public boolean isWritableAccountWithDataSet(String accountTypeAndDataSet) {
if (accountTypeAndDataSet == null) {
return true;
}
diff --git a/src/com/android/providers/contacts/DataRowHandler.java b/src/com/android/providers/contacts/DataRowHandler.java
index 32e6954..b98f6c7 100644
--- a/src/com/android/providers/contacts/DataRowHandler.java
+++ b/src/com/android/providers/contacts/DataRowHandler.java
@@ -19,6 +19,7 @@ import com.android.providers.contacts.ContactsDatabaseHelper.DataColumns;
import com.android.providers.contacts.ContactsDatabaseHelper.MimetypesColumns;
import com.android.providers.contacts.ContactsDatabaseHelper.PresenceColumns;
import com.android.providers.contacts.ContactsDatabaseHelper.Tables;
+import com.android.providers.contacts.aggregation.ContactAggregator;
import android.content.ContentValues;
import android.content.Context;
diff --git a/src/com/android/providers/contacts/DataRowHandlerForCommonDataKind.java b/src/com/android/providers/contacts/DataRowHandlerForCommonDataKind.java
index ae20309..b717d31 100644
--- a/src/com/android/providers/contacts/DataRowHandlerForCommonDataKind.java
+++ b/src/com/android/providers/contacts/DataRowHandlerForCommonDataKind.java
@@ -15,6 +15,8 @@
*/
package com.android.providers.contacts;
+import com.android.providers.contacts.aggregation.ContactAggregator;
+
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
diff --git a/src/com/android/providers/contacts/DataRowHandlerForCustomMimetype.java b/src/com/android/providers/contacts/DataRowHandlerForCustomMimetype.java
index 726516c..0202fd6 100644
--- a/src/com/android/providers/contacts/DataRowHandlerForCustomMimetype.java
+++ b/src/com/android/providers/contacts/DataRowHandlerForCustomMimetype.java
@@ -15,6 +15,8 @@
*/
package com.android.providers.contacts;
+import com.android.providers.contacts.aggregation.ContactAggregator;
+
import android.content.Context;
public class DataRowHandlerForCustomMimetype extends DataRowHandler {
diff --git a/src/com/android/providers/contacts/DataRowHandlerForEmail.java b/src/com/android/providers/contacts/DataRowHandlerForEmail.java
index de4f17a..f1fa941 100644
--- a/src/com/android/providers/contacts/DataRowHandlerForEmail.java
+++ b/src/com/android/providers/contacts/DataRowHandlerForEmail.java
@@ -16,6 +16,7 @@
package com.android.providers.contacts;
import com.android.providers.contacts.SearchIndexManager.IndexBuilder;
+import com.android.providers.contacts.aggregation.ContactAggregator;
import android.content.ContentValues;
import android.content.Context;
diff --git a/src/com/android/providers/contacts/DataRowHandlerForGroupMembership.java b/src/com/android/providers/contacts/DataRowHandlerForGroupMembership.java
index 542e5a0..3a4b167 100644
--- a/src/com/android/providers/contacts/DataRowHandlerForGroupMembership.java
+++ b/src/com/android/providers/contacts/DataRowHandlerForGroupMembership.java
@@ -22,6 +22,7 @@ import com.android.providers.contacts.ContactsDatabaseHelper.Projections;
import com.android.providers.contacts.ContactsDatabaseHelper.RawContactsColumns;
import com.android.providers.contacts.ContactsDatabaseHelper.Tables;
import com.android.providers.contacts.ContactsProvider2.GroupIdCacheEntry;
+import com.android.providers.contacts.aggregation.ContactAggregator;
import android.content.ContentValues;
import android.content.Context;
diff --git a/src/com/android/providers/contacts/DataRowHandlerForIm.java b/src/com/android/providers/contacts/DataRowHandlerForIm.java
index 715a26c..009bb89 100644
--- a/src/com/android/providers/contacts/DataRowHandlerForIm.java
+++ b/src/com/android/providers/contacts/DataRowHandlerForIm.java
@@ -16,6 +16,7 @@
package com.android.providers.contacts;
import com.android.providers.contacts.SearchIndexManager.IndexBuilder;
+import com.android.providers.contacts.aggregation.ContactAggregator;
import android.content.ContentValues;
import android.content.Context;
diff --git a/src/com/android/providers/contacts/DataRowHandlerForNickname.java b/src/com/android/providers/contacts/DataRowHandlerForNickname.java
index efaf3b0..0fec6ee 100644
--- a/src/com/android/providers/contacts/DataRowHandlerForNickname.java
+++ b/src/com/android/providers/contacts/DataRowHandlerForNickname.java
@@ -16,6 +16,7 @@
package com.android.providers.contacts;
import com.android.providers.contacts.SearchIndexManager.IndexBuilder;
+import com.android.providers.contacts.aggregation.ContactAggregator;
import android.content.ContentValues;
import android.content.Context;
diff --git a/src/com/android/providers/contacts/DataRowHandlerForNote.java b/src/com/android/providers/contacts/DataRowHandlerForNote.java
index 4610cc7..317af1a 100644
--- a/src/com/android/providers/contacts/DataRowHandlerForNote.java
+++ b/src/com/android/providers/contacts/DataRowHandlerForNote.java
@@ -16,6 +16,7 @@
package com.android.providers.contacts;
import com.android.providers.contacts.SearchIndexManager.IndexBuilder;
+import com.android.providers.contacts.aggregation.ContactAggregator;
import android.content.ContentValues;
import android.content.Context;
diff --git a/src/com/android/providers/contacts/DataRowHandlerForOrganization.java b/src/com/android/providers/contacts/DataRowHandlerForOrganization.java
index 0280c3b..7384ccb 100644
--- a/src/com/android/providers/contacts/DataRowHandlerForOrganization.java
+++ b/src/com/android/providers/contacts/DataRowHandlerForOrganization.java
@@ -17,6 +17,7 @@ package com.android.providers.contacts;
import com.android.providers.contacts.ContactsDatabaseHelper.Tables;
import com.android.providers.contacts.SearchIndexManager.IndexBuilder;
+import com.android.providers.contacts.aggregation.ContactAggregator;
import android.content.ContentValues;
import android.content.Context;
diff --git a/src/com/android/providers/contacts/DataRowHandlerForPhoneNumber.java b/src/com/android/providers/contacts/DataRowHandlerForPhoneNumber.java
index 88e432e..f6d6d5d 100644
--- a/src/com/android/providers/contacts/DataRowHandlerForPhoneNumber.java
+++ b/src/com/android/providers/contacts/DataRowHandlerForPhoneNumber.java
@@ -18,6 +18,7 @@ package com.android.providers.contacts;
import com.android.providers.contacts.ContactsDatabaseHelper.PhoneLookupColumns;
import com.android.providers.contacts.ContactsDatabaseHelper.Tables;
import com.android.providers.contacts.SearchIndexManager.IndexBuilder;
+import com.android.providers.contacts.aggregation.ContactAggregator;
import android.content.ContentValues;
import android.content.Context;
diff --git a/src/com/android/providers/contacts/DataRowHandlerForPhoto.java b/src/com/android/providers/contacts/DataRowHandlerForPhoto.java
index dcd23cd..bfe1c3d 100644
--- a/src/com/android/providers/contacts/DataRowHandlerForPhoto.java
+++ b/src/com/android/providers/contacts/DataRowHandlerForPhoto.java
@@ -15,6 +15,8 @@
*/
package com.android.providers.contacts;
+import com.android.providers.contacts.aggregation.ContactAggregator;
+
import android.content.ContentValues;
import android.content.Context;
import android.content.res.Resources;
diff --git a/src/com/android/providers/contacts/DataRowHandlerForStructuredName.java b/src/com/android/providers/contacts/DataRowHandlerForStructuredName.java
index fd237fd..c84d2e8 100644
--- a/src/com/android/providers/contacts/DataRowHandlerForStructuredName.java
+++ b/src/com/android/providers/contacts/DataRowHandlerForStructuredName.java
@@ -16,6 +16,7 @@
package com.android.providers.contacts;
import com.android.providers.contacts.SearchIndexManager.IndexBuilder;
+import com.android.providers.contacts.aggregation.ContactAggregator;
import android.content.ContentValues;
import android.content.Context;
diff --git a/src/com/android/providers/contacts/DataRowHandlerForStructuredPostal.java b/src/com/android/providers/contacts/DataRowHandlerForStructuredPostal.java
index d329cb4..6898a43 100644
--- a/src/com/android/providers/contacts/DataRowHandlerForStructuredPostal.java
+++ b/src/com/android/providers/contacts/DataRowHandlerForStructuredPostal.java
@@ -16,6 +16,7 @@
package com.android.providers.contacts;
import com.android.providers.contacts.SearchIndexManager.IndexBuilder;
+import com.android.providers.contacts.aggregation.ContactAggregator;
import android.content.ContentValues;
import android.content.Context;
diff --git a/src/com/android/providers/contacts/ContactAggregator.java b/src/com/android/providers/contacts/aggregation/ContactAggregator.java
index d6b2abc..a235ce2 100644
--- a/src/com/android/providers/contacts/ContactAggregator.java
+++ b/src/com/android/providers/contacts/aggregation/ContactAggregator.java
@@ -14,9 +14,13 @@
* limitations under the License
*/
-package com.android.providers.contacts;
+package com.android.providers.contacts.aggregation;
+import com.android.providers.contacts.CommonNicknameCache;
+import com.android.providers.contacts.ContactLookupKey;
+import com.android.providers.contacts.ContactMatcher;
import com.android.providers.contacts.ContactMatcher.MatchScore;
+import com.android.providers.contacts.ContactsDatabaseHelper;
import com.android.providers.contacts.ContactsDatabaseHelper.AccountsColumns;
import com.android.providers.contacts.ContactsDatabaseHelper.AggregatedPresenceColumns;
import com.android.providers.contacts.ContactsDatabaseHelper.ContactsColumns;
@@ -29,6 +33,13 @@ import com.android.providers.contacts.ContactsDatabaseHelper.RawContactsColumns;
import com.android.providers.contacts.ContactsDatabaseHelper.StatusUpdatesColumns;
import com.android.providers.contacts.ContactsDatabaseHelper.Tables;
import com.android.providers.contacts.ContactsDatabaseHelper.Views;
+import com.android.providers.contacts.ContactsProvider2;
+import com.android.providers.contacts.NameLookupBuilder;
+import com.android.providers.contacts.NameNormalizer;
+import com.android.providers.contacts.NameSplitter;
+import com.android.providers.contacts.PhotoPriorityResolver;
+import com.android.providers.contacts.ReorderingCursorWrapper;
+import com.android.providers.contacts.TransactionContext;
import android.database.Cursor;
import android.database.DatabaseUtils;
@@ -549,7 +560,7 @@ public class ContactAggregator {
return contactId;
}
- public long insertContact(SQLiteDatabase db, long rawContactId) {
+ protected long insertContact(SQLiteDatabase db, long rawContactId) {
mSelectionArgs1[0] = String.valueOf(rawContactId);
computeAggregateData(db, mRawContactsQueryByRawContactId, mSelectionArgs1, mContactInsert);
return mContactInsert.executeInsert();
@@ -2110,7 +2121,7 @@ public class ContactAggregator {
* Execute {@link SQLiteStatement} that will update the
* {@link Contacts#STARRED} flag for the given {@link RawContacts#_ID}.
*/
- protected void updateStarred(long rawContactId) {
+ public void updateStarred(long rawContactId) {
long contactId = mDbHelper.getContactId(rawContactId);
if (contactId == 0) {
return;
diff --git a/src/com/android/providers/contacts/ProfileAggregator.java b/src/com/android/providers/contacts/aggregation/ProfileAggregator.java
index e4f8a3a..6126184 100644
--- a/src/com/android/providers/contacts/ProfileAggregator.java
+++ b/src/com/android/providers/contacts/aggregation/ProfileAggregator.java
@@ -13,13 +13,21 @@
* See the License for the specific language governing permissions and
* limitations under the License
*/
-package com.android.providers.contacts;
+package com.android.providers.contacts.aggregation;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDoneException;
import android.database.sqlite.SQLiteStatement;
import android.provider.ContactsContract.Contacts;
+
+import com.android.providers.contacts.CommonNicknameCache;
+import com.android.providers.contacts.ContactLookupKey;
+import com.android.providers.contacts.ContactsDatabaseHelper;
import com.android.providers.contacts.ContactsDatabaseHelper.Tables;
+import com.android.providers.contacts.ContactsProvider2;
+import com.android.providers.contacts.NameSplitter;
+import com.android.providers.contacts.PhotoPriorityResolver;
+import com.android.providers.contacts.TransactionContext;
/**
* A version of the ContactAggregator for use against the profile database.