From 2368014073a7614820284f38025d926fd1699085 Mon Sep 17 00:00:00 2001 From: Matthew Williams Date: Mon, 9 Jun 2014 20:06:03 -0700 Subject: [PATCH] Remove SyncRequest.setPriority from public API Bug: 15517262 Change-Id: If62b6f3bf339011dd504889aa24c71a22cb08ed8 --- api/current.txt | 2 -- core/java/android/content/SyncRequest.java | 31 +++++++--------------- 2 files changed, 9 insertions(+), 24 deletions(-) diff --git a/api/current.txt b/api/current.txt index d18fddc784571..53006ae932a45 100644 --- a/api/current.txt +++ b/api/current.txt @@ -7887,7 +7887,6 @@ package android.content { public class SyncRequest implements android.os.Parcelable { method public int describeContents(); - method public boolean isExpedited(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator CREATOR; } @@ -7902,7 +7901,6 @@ package android.content { method public android.content.SyncRequest.Builder setIgnoreSettings(boolean); method public android.content.SyncRequest.Builder setManual(boolean); method public android.content.SyncRequest.Builder setNoRetry(boolean); - method public android.content.SyncRequest.Builder setPriority(int); method public android.content.SyncRequest.Builder setSyncAdapter(android.accounts.Account, java.lang.String); method public android.content.SyncRequest.Builder syncOnce(); method public android.content.SyncRequest.Builder syncPeriodic(long, long); diff --git a/core/java/android/content/SyncRequest.java b/core/java/android/content/SyncRequest.java index 869f85c900c52..7619c6d53bd46 100644 --- a/core/java/android/content/SyncRequest.java +++ b/core/java/android/content/SyncRequest.java @@ -21,6 +21,11 @@ import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; +/** + * Convenience class to construct sync requests. See {@link android.content.SyncRequest.Builder} + * for an explanation of the various functions. The resulting object is passed through to the + * framework via {@link android.content.ContentResolver#requestSync(SyncRequest)}. + */ public class SyncRequest implements Parcelable { private static final String TAG = "SyncRequest"; /** Account to pass to the sync adapter. Can be null. */ @@ -57,6 +62,10 @@ public class SyncRequest implements Parcelable { return mIsPeriodic; } + /** + * {@hide} + * @return whether this sync is expedited. + */ public boolean isExpedited() { return mIsExpedited; } @@ -199,14 +208,8 @@ public class SyncRequest implements Parcelable { * discriminate between equivalent syncs. */ private Bundle mSyncConfigExtras; - /** Expected upload transfer in bytes. */ - private long mTxBytes = -1L; - /** Expected download transfer in bytes. */ - private long mRxBytes = -1L; /** Whether or not this sync can occur on metered networks. Default false. */ private boolean mDisallowMetered; - /** Priority of this sync relative to others from calling app [-2, 2]. Default 0. */ - private int mPriority = 0; /** * Whether this builder is building a periodic sync, or a one-time sync. */ @@ -314,7 +317,6 @@ public class SyncRequest implements Parcelable { return this; } - /** {@hide} */ private void setupInterval(long at, long before) { if (before > at) { throw new IllegalArgumentException("Specified run time for the sync must be" + @@ -476,18 +478,6 @@ public class SyncRequest implements Parcelable { return this; } - /** - * @param priority the priority of this request among all requests from the calling app. - * Range of [-2,2] similar to how this is done with notifications. - */ - public Builder setPriority(int priority) { - if (priority < -2 || priority > 2) { - throw new IllegalArgumentException("Priority must be within range [-2, 2]"); - } - mPriority = priority; - return this; - } - /** * Performs validation over the request and throws the runtime exception * IllegalArgumentException if this validation fails. @@ -522,9 +512,6 @@ public class SyncRequest implements Parcelable { mSyncConfigExtras.putBoolean(ContentResolver.SYNC_EXTRAS_IGNORE_BACKOFF, true); mSyncConfigExtras.putBoolean(ContentResolver.SYNC_EXTRAS_IGNORE_SETTINGS, true); } - mSyncConfigExtras.putLong(ContentResolver.SYNC_EXTRAS_EXPECTED_UPLOAD, mTxBytes); - mSyncConfigExtras.putLong(ContentResolver.SYNC_EXTRAS_EXPECTED_DOWNLOAD, mRxBytes); - mSyncConfigExtras.putInt(ContentResolver.SYNC_EXTRAS_PRIORITY, mPriority); if (mSyncType == SYNC_TYPE_PERIODIC) { // If this is a periodic sync ensure than invalid extras were not set. if (ContentResolver.invalidPeriodicExtras(mCustomExtras) ||