diff options
author | Fred Quintana <fredq@google.com> | 2009-08-17 13:05:39 -0700 |
---|---|---|
committer | Fred Quintana <fredq@google.com> | 2009-08-18 11:06:52 -0700 |
commit | 4a6679b97e0285c5b65ec5c0d9080ff90d3e9e81 (patch) | |
tree | 3356b9b309a39344d320635140a4380d5e1e5318 /core/java/android/content/SyncAdapterType.java | |
parent | 084cd8266ecbc70714fd3c7d27488411a00338b7 (diff) | |
download | frameworks_base-4a6679b97e0285c5b65ec5c0d9080ff90d3e9e81.zip frameworks_base-4a6679b97e0285c5b65ec5c0d9080ff90d3e9e81.tar.gz frameworks_base-4a6679b97e0285c5b65ec5c0d9080ff90d3e9e81.tar.bz2 |
make syncadapter set whether the account is syncable
Diffstat (limited to 'core/java/android/content/SyncAdapterType.java')
-rw-r--r-- | core/java/android/content/SyncAdapterType.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/core/java/android/content/SyncAdapterType.java b/core/java/android/content/SyncAdapterType.java index d3f8230..93b61ec 100644 --- a/core/java/android/content/SyncAdapterType.java +++ b/core/java/android/content/SyncAdapterType.java @@ -27,9 +27,9 @@ import android.os.Parcel; public class SyncAdapterType implements Parcelable { public final String authority; public final String accountType; - public final boolean isUserFacing = true; // TODO: implement logic to set this + public final boolean userVisible; - public SyncAdapterType(String authority, String accountType) { + public SyncAdapterType(String authority, String accountType, boolean userVisible) { if (TextUtils.isEmpty(authority)) { throw new IllegalArgumentException("the authority must not be empty: " + authority); } @@ -38,12 +38,18 @@ public class SyncAdapterType implements Parcelable { } this.authority = authority; this.accountType = accountType; + this.userVisible = userVisible; + } + + public static SyncAdapterType newKey(String authority, String accountType) { + return new SyncAdapterType(authority, accountType, true); } public boolean equals(Object o) { if (o == this) return true; if (!(o instanceof SyncAdapterType)) return false; final SyncAdapterType other = (SyncAdapterType)o; + // don't include userVisible in the equality check return authority.equals(other.authority) && accountType.equals(other.accountType); } @@ -51,11 +57,13 @@ public class SyncAdapterType implements Parcelable { int result = 17; result = 31 * result + authority.hashCode(); result = 31 * result + accountType.hashCode(); + // don't include userVisible in the hash return result; } public String toString() { - return "SyncAdapterType {name=" + authority + ", type=" + accountType + "}"; + return "SyncAdapterType {name=" + authority + ", type=" + accountType + + ", userVisible=" + userVisible + "}"; } public int describeContents() { @@ -65,10 +73,11 @@ public class SyncAdapterType implements Parcelable { public void writeToParcel(Parcel dest, int flags) { dest.writeString(authority); dest.writeString(accountType); + dest.writeInt(userVisible ? 1 : 0); } public SyncAdapterType(Parcel source) { - this(source.readString(), source.readString()); + this(source.readString(), source.readString(), source.readInt() != 0); } public static final Creator<SyncAdapterType> CREATOR = new Creator<SyncAdapterType>() { |