diff options
author | Fred Quintana <fredq@google.com> | 2009-11-09 15:42:20 -0800 |
---|---|---|
committer | Fred Quintana <fredq@google.com> | 2009-11-10 16:10:54 -0800 |
commit | 5ebbb4a6b3e16f711735ae0615b9a9ea64faad38 (patch) | |
tree | 57cd54aa0cdb48dcadc3cf236bf0947caf1a6f6e /core/java/android/content/SyncAdaptersCache.java | |
parent | 50c548d242d637328ec6b2c4987969b02695cc7d (diff) | |
download | frameworks_base-5ebbb4a6b3e16f711735ae0615b9a9ea64faad38.zip frameworks_base-5ebbb4a6b3e16f711735ae0615b9a9ea64faad38.tar.gz frameworks_base-5ebbb4a6b3e16f711735ae0615b9a9ea64faad38.tar.bz2 |
Make the RegisteredSErvices Cache not allow the registered service for a
type to change without first uninstalling the previous service for that
type, unless the newly installed service is in the system image.
Notify the listener when a service is added or removed.
Make the AccountManagerService remove the accounts for an authenticator
when the registered authenticator changes from one uid to another.
Make the AbstractSyncableContentProvider force a sync when the database is first created.
Diffstat (limited to 'core/java/android/content/SyncAdaptersCache.java')
-rw-r--r-- | core/java/android/content/SyncAdaptersCache.java | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/core/java/android/content/SyncAdaptersCache.java b/core/java/android/content/SyncAdaptersCache.java index 7d9f1de..6ade837 100644 --- a/core/java/android/content/SyncAdaptersCache.java +++ b/core/java/android/content/SyncAdaptersCache.java @@ -17,9 +17,14 @@ package android.content; import android.content.pm.RegisteredServicesCache; +import android.content.pm.XmlSerializerAndParser; import android.content.res.TypedArray; -import android.content.Context; import android.util.AttributeSet; +import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlSerializer; +import org.xmlpull.v1.XmlPullParserException; + +import java.io.IOException; /** * A cache of services that export the {@link android.content.ISyncAdapter} interface. @@ -31,9 +36,10 @@ import android.util.AttributeSet; private static final String SERVICE_INTERFACE = "android.content.SyncAdapter"; private static final String SERVICE_META_DATA = "android.content.SyncAdapter"; private static final String ATTRIBUTES_NAME = "sync-adapter"; + private static final MySerializer sSerializer = new MySerializer(); SyncAdaptersCache(Context context) { - super(context, SERVICE_INTERFACE, SERVICE_META_DATA, ATTRIBUTES_NAME); + super(context, SERVICE_INTERFACE, SERVICE_META_DATA, ATTRIBUTES_NAME, sSerializer); } public SyncAdapterType parseServiceAttributes(String packageName, AttributeSet attrs) { @@ -57,4 +63,18 @@ import android.util.AttributeSet; sa.recycle(); } } + + static class MySerializer implements XmlSerializerAndParser<SyncAdapterType> { + public void writeAsXml(SyncAdapterType item, XmlSerializer out) throws IOException { + out.attribute(null, "authority", item.authority); + out.attribute(null, "accountType", item.accountType); + } + + public SyncAdapterType createFromXml(XmlPullParser parser) + throws IOException, XmlPullParserException { + final String authority = parser.getAttributeValue(null, "authority"); + final String accountType = parser.getAttributeValue(null, "accountType"); + return SyncAdapterType.newKey(authority, accountType); + } + } }
\ No newline at end of file |