summaryrefslogtreecommitdiffstats
path: root/src/com/android/providers/contacts/AccountWithDataSet.java
diff options
context:
space:
mode:
authorDave Santoro <dsantoro@google.com>2011-07-13 14:03:53 -0700
committerDave Santoro <dsantoro@google.com>2011-07-27 17:15:46 -0700
commit43368a3f9e05a979e454e278d6a0e8475f08923d (patch)
tree3ff616a1aff1af5ea4d18d437b9ac8f2032e985a /src/com/android/providers/contacts/AccountWithDataSet.java
parent51d1da962292ecef21abdf7e41abfdb7f1d72fcd (diff)
downloadpackages_providers_ContactsProvider-43368a3f9e05a979e454e278d6a0e8475f08923d.zip
packages_providers_ContactsProvider-43368a3f9e05a979e454e278d6a0e8475f08923d.tar.gz
packages_providers_ContactsProvider-43368a3f9e05a979e454e278d6a0e8475f08923d.tar.bz2
Provider and DB changes to support data_set field.
The intent of the data set field is to provide a way for multiple sync adapters from the same account name + type to manage separate sets of data in the raw_contacts and groups table. For example, this would allow for Focus groups to be synced in from Focus via the Google Contacts sync adapter, and for Google+ Circles to be synced in from the Google+ app, even though both are tied to the same account name + type. Bug 5077096 Change-Id: I641c5d233d8d4d70988d209179c4e79bdb9c7ea1
Diffstat (limited to 'src/com/android/providers/contacts/AccountWithDataSet.java')
-rw-r--r--src/com/android/providers/contacts/AccountWithDataSet.java71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/com/android/providers/contacts/AccountWithDataSet.java b/src/com/android/providers/contacts/AccountWithDataSet.java
new file mode 100644
index 0000000..d667432
--- /dev/null
+++ b/src/com/android/providers/contacts/AccountWithDataSet.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package com.android.providers.contacts;
+
+import com.android.internal.util.Objects;
+
+/**
+ * Account information that includes the data set, if any.
+ */
+public class AccountWithDataSet {
+ private final String mAccountName;
+ private final String mAccountType;
+ private final String mDataSet;
+
+ public AccountWithDataSet(String accountName, String accountType, String dataSet) {
+ mAccountName = accountName;
+ mAccountType = accountType;
+ mDataSet = dataSet;
+ }
+
+ public String getAccountName() {
+ return mAccountName;
+ }
+
+ public String getAccountType() {
+ return mAccountType;
+ }
+
+ public String getDataSet() {
+ return mDataSet;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof AccountWithDataSet) {
+ AccountWithDataSet other = (AccountWithDataSet) obj;
+ return Objects.equal(mAccountName, other.getAccountName())
+ && Objects.equal(mAccountType, other.getAccountType())
+ && Objects.equal(mDataSet, other.getDataSet());
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = mAccountName != null ? mAccountName.hashCode() : 0;
+ result = 31 * result + (mAccountType != null ? mAccountType.hashCode() : 0);
+ result = 31 * result + (mDataSet != null ? mDataSet.hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "AccountWithDataSet {name=" + mAccountName + ", type=" + mAccountType + ", dataSet="
+ + mDataSet + "}";
+ }
+}