diff options
| author | Matthew Williams <mjwilliams@google.com> | 2013-10-10 15:51:00 -0700 |
|---|---|---|
| committer | Matthew Williams <mjwilliams@google.com> | 2013-10-11 13:18:22 -0700 |
| commit | 632515b9d0960749ddb1636677d7f12f196d73f7 (patch) | |
| tree | 4812bfb7f9de3d5e9851e4fb1fa5f11f4e224bb7 /core/java | |
| parent | 9dc7e12c67476d05e64822d3f019c4b7f46d253b (diff) | |
Fix infinite boot-loop bug in SM.
Bug:11064918
If the ContentResolver sync API is used with the empty ("")
string as a provider, the ContentService will throw an RTE.
This cl addresses all the entry points of the API that could
allow this, as well as adds an ifEmpty check at the point of
failure.
Also removed RTE throws from public functions(no point in
crashing the phone).
Change-Id: I57427d12a6cafb3e6d7a32ca0c10b05315b20580
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/content/ContentResolver.java | 18 | ||||
| -rw-r--r-- | core/java/android/content/SyncRequest.java | 3 |
2 files changed, 3 insertions, 18 deletions
diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java index 49dfdb5ef29d..04b40270da52 100644 --- a/core/java/android/content/ContentResolver.java +++ b/core/java/android/content/ContentResolver.java @@ -1914,12 +1914,6 @@ public abstract class ContentResolver { public static void addPeriodicSync(Account account, String authority, Bundle extras, long pollFrequency) { validateSyncExtrasBundle(extras); - if (account == null) { - throw new IllegalArgumentException("account must not be null"); - } - if (authority == null) { - throw new IllegalArgumentException("authority must not be null"); - } if (extras.getBoolean(SYNC_EXTRAS_MANUAL, false) || extras.getBoolean(SYNC_EXTRAS_DO_NOT_RETRY, false) || extras.getBoolean(SYNC_EXTRAS_IGNORE_BACKOFF, false) @@ -1949,12 +1943,6 @@ public abstract class ContentResolver { */ public static void removePeriodicSync(Account account, String authority, Bundle extras) { validateSyncExtrasBundle(extras); - if (account == null) { - throw new IllegalArgumentException("account must not be null"); - } - if (authority == null) { - throw new IllegalArgumentException("authority must not be null"); - } try { getContentService().removePeriodicSync(account, authority, extras); } catch (RemoteException e) { @@ -1972,12 +1960,6 @@ public abstract class ContentResolver { * @return a list of PeriodicSync objects. This list may be empty but will never be null. */ public static List<PeriodicSync> getPeriodicSyncs(Account account, String authority) { - if (account == null) { - throw new IllegalArgumentException("account must not be null"); - } - if (authority == null) { - throw new IllegalArgumentException("authority must not be null"); - } try { return getContentService().getPeriodicSyncs(account, authority); } catch (RemoteException e) { diff --git a/core/java/android/content/SyncRequest.java b/core/java/android/content/SyncRequest.java index d4e0c2a578d5..6ca283d8b819 100644 --- a/core/java/android/content/SyncRequest.java +++ b/core/java/android/content/SyncRequest.java @@ -408,6 +408,9 @@ public class SyncRequest implements Parcelable { if (mSyncTarget != SYNC_TARGET_UNKNOWN) { throw new IllegalArgumentException("Sync target has already been defined."); } + if (authority != null && authority.length() == 0) { + throw new IllegalArgumentException("Authority must be non-empty"); + } mSyncTarget = SYNC_TARGET_ADAPTER; mAccount = account; mAuthority = authority; |
