@@ -32,6 +32,7 @@ public class SyncAdapterType implements Parcelable {
3232 private final boolean supportsUploading ;
3333 private final boolean isAlwaysSyncable ;
3434 private final boolean allowParallelSyncs ;
35+ private final String settingsActivity ;
3536
3637 public SyncAdapterType (String authority , String accountType , boolean userVisible ,
3738 boolean supportsUploading ) {
@@ -47,14 +48,16 @@ public SyncAdapterType(String authority, String accountType, boolean userVisible
4748 this .supportsUploading = supportsUploading ;
4849 this .isAlwaysSyncable = false ;
4950 this .allowParallelSyncs = false ;
51+ this .settingsActivity = null ;
5052 this .isKey = false ;
5153 }
5254
5355 /** @hide */
5456 public SyncAdapterType (String authority , String accountType , boolean userVisible ,
5557 boolean supportsUploading ,
5658 boolean isAlwaysSyncable ,
57- boolean allowParallelSyncs ) {
59+ boolean allowParallelSyncs ,
60+ String settingsActivity ) {
5861 if (TextUtils .isEmpty (authority )) {
5962 throw new IllegalArgumentException ("the authority must not be empty: " + authority );
6063 }
@@ -67,6 +70,7 @@ public SyncAdapterType(String authority, String accountType, boolean userVisible
6770 this .supportsUploading = supportsUploading ;
6871 this .isAlwaysSyncable = isAlwaysSyncable ;
6972 this .allowParallelSyncs = allowParallelSyncs ;
73+ this .settingsActivity = settingsActivity ;
7074 this .isKey = false ;
7175 }
7276
@@ -83,6 +87,7 @@ private SyncAdapterType(String authority, String accountType) {
8387 this .supportsUploading = true ;
8488 this .isAlwaysSyncable = false ;
8589 this .allowParallelSyncs = false ;
90+ this .settingsActivity = null ;
8691 this .isKey = true ;
8792 }
8893
@@ -131,6 +136,18 @@ public boolean isAlwaysSyncable() {
131136 return isAlwaysSyncable ;
132137 }
133138
139+ /**
140+ * @return The activity to use to invoke this SyncAdapter's settings activity.
141+ * May be null.
142+ */
143+ public String getSettingsActivity () {
144+ if (isKey ) {
145+ throw new IllegalStateException (
146+ "this method is not allowed to be called when this is a key" );
147+ }
148+ return settingsActivity ;
149+ }
150+
134151 public static SyncAdapterType newKey (String authority , String accountType ) {
135152 return new SyncAdapterType (authority , accountType );
136153 }
@@ -163,6 +180,7 @@ public String toString() {
163180 + ", supportsUploading=" + supportsUploading
164181 + ", isAlwaysSyncable=" + isAlwaysSyncable
165182 + ", allowParallelSyncs=" + allowParallelSyncs
183+ + ", settingsActivity=" + settingsActivity
166184 + "}" ;
167185 }
168186 }
@@ -182,6 +200,7 @@ public void writeToParcel(Parcel dest, int flags) {
182200 dest .writeInt (supportsUploading ? 1 : 0 );
183201 dest .writeInt (isAlwaysSyncable ? 1 : 0 );
184202 dest .writeInt (allowParallelSyncs ? 1 : 0 );
203+ dest .writeString (settingsActivity );
185204 }
186205
187206 public SyncAdapterType (Parcel source ) {
@@ -191,7 +210,8 @@ public SyncAdapterType(Parcel source) {
191210 source .readInt () != 0 ,
192211 source .readInt () != 0 ,
193212 source .readInt () != 0 ,
194- source .readInt () != 0 );
213+ source .readInt () != 0 ,
214+ source .readString ());
195215 }
196216
197217 public static final Creator <SyncAdapterType > CREATOR = new Creator <SyncAdapterType >() {
0 commit comments