diff options
Diffstat (limited to 'core/java/android')
-rw-r--r-- | core/java/android/content/SyncAdapterType.java | 69 | ||||
-rw-r--r-- | core/java/android/content/SyncAdaptersCache.java | 5 | ||||
-rw-r--r-- | core/java/android/content/SyncManager.java | 27 | ||||
-rw-r--r-- | core/java/android/preference/CheckBoxPreference.java | 14 | ||||
-rw-r--r-- | core/java/android/provider/Settings.java | 7 | ||||
-rw-r--r-- | core/java/android/widget/MediaController.java | 6 |
6 files changed, 101 insertions, 27 deletions
diff --git a/core/java/android/content/SyncAdapterType.java b/core/java/android/content/SyncAdapterType.java index 93b61ec..25cbdb1 100644 --- a/core/java/android/content/SyncAdapterType.java +++ b/core/java/android/content/SyncAdapterType.java @@ -27,9 +27,12 @@ import android.os.Parcel; public class SyncAdapterType implements Parcelable { public final String authority; public final String accountType; - public final boolean userVisible; + public final boolean isKey; + private final boolean userVisible; + private final boolean supportsUploading; - public SyncAdapterType(String authority, String accountType, boolean userVisible) { + public SyncAdapterType(String authority, String accountType, boolean userVisible, + boolean supportsUploading) { if (TextUtils.isEmpty(authority)) { throw new IllegalArgumentException("the authority must not be empty: " + authority); } @@ -39,17 +42,49 @@ public class SyncAdapterType implements Parcelable { this.authority = authority; this.accountType = accountType; this.userVisible = userVisible; + this.supportsUploading = supportsUploading; + this.isKey = false; + } + + private SyncAdapterType(String authority, String accountType) { + if (TextUtils.isEmpty(authority)) { + throw new IllegalArgumentException("the authority must not be empty: " + authority); + } + if (TextUtils.isEmpty(accountType)) { + throw new IllegalArgumentException("the accountType must not be empty: " + accountType); + } + this.authority = authority; + this.accountType = accountType; + this.userVisible = true; + this.supportsUploading = true; + this.isKey = true; + } + + public boolean supportsUploading() { + if (isKey) { + throw new IllegalStateException( + "this method is not allowed to be called when this is a key"); + } + return supportsUploading; + } + + public boolean isUserVisible() { + if (isKey) { + throw new IllegalStateException( + "this method is not allowed to be called when this is a key"); + } + return userVisible; } public static SyncAdapterType newKey(String authority, String accountType) { - return new SyncAdapterType(authority, accountType, true); + return new SyncAdapterType(authority, accountType); } 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 + // don't include userVisible or supportsUploading in the equality check return authority.equals(other.authority) && accountType.equals(other.accountType); } @@ -57,13 +92,22 @@ 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 + // don't include userVisible or supportsUploading the hash return result; } public String toString() { - return "SyncAdapterType {name=" + authority + ", type=" + accountType - + ", userVisible=" + userVisible + "}"; + if (isKey) { + return "SyncAdapterType Key {name=" + authority + + ", type=" + accountType + + "}"; + } else { + return "SyncAdapterType {name=" + authority + + ", type=" + accountType + + ", userVisible=" + userVisible + + ", supportsUploading=" + supportsUploading + + "}"; + } } public int describeContents() { @@ -71,13 +115,22 @@ public class SyncAdapterType implements Parcelable { } public void writeToParcel(Parcel dest, int flags) { + if (isKey) { + throw new IllegalStateException("keys aren't parcelable"); + } + dest.writeString(authority); dest.writeString(accountType); dest.writeInt(userVisible ? 1 : 0); + dest.writeInt(supportsUploading ? 1 : 0); } public SyncAdapterType(Parcel source) { - this(source.readString(), source.readString(), source.readInt() != 0); + this( + source.readString(), + source.readString(), + source.readInt() != 0, + source.readInt() != 0); } public static final Creator<SyncAdapterType> CREATOR = new Creator<SyncAdapterType>() { diff --git a/core/java/android/content/SyncAdaptersCache.java b/core/java/android/content/SyncAdaptersCache.java index c27fd25..7d9f1de 100644 --- a/core/java/android/content/SyncAdaptersCache.java +++ b/core/java/android/content/SyncAdaptersCache.java @@ -49,7 +49,10 @@ import android.util.AttributeSet; } final boolean userVisible = sa.getBoolean(com.android.internal.R.styleable.SyncAdapter_userVisible, true); - return new SyncAdapterType(authority, accountType, userVisible); + final boolean supportsUploading = + sa.getBoolean(com.android.internal.R.styleable.SyncAdapter_supportsUploading, + true); + return new SyncAdapterType(authority, accountType, userVisible, supportsUploading); } finally { sa.recycle(); } diff --git a/core/java/android/content/SyncManager.java b/core/java/android/content/SyncManager.java index 34efc51..82cf23f 100644 --- a/core/java/android/content/SyncManager.java +++ b/core/java/android/content/SyncManager.java @@ -526,13 +526,6 @@ class SyncManager implements OnAccountsUpdatedListener { public void scheduleSync(Account requestedAccount, String requestedAuthority, Bundle extras, long delay, boolean onlyThoseWithUnkownSyncableState) { boolean isLoggable = Log.isLoggable(TAG, Log.VERBOSE); - if (isLoggable) { - Log.v(TAG, "scheduleSync:" - + " delay " + delay - + ", account " + requestedAccount - + ", authority " + requestedAuthority - + ", extras " + ((extras == null) ? "(null)" : extras)); - } if (!isSyncEnabled()) { if (isLoggable) { @@ -617,13 +610,27 @@ class SyncManager implements OnAccountsUpdatedListener { if (onlyThoseWithUnkownSyncableState && isSyncable >= 0) { continue; } - if (mSyncAdapters.getServiceInfo(SyncAdapterType.newKey(authority, account.type)) - != null) { + final RegisteredServicesCache.ServiceInfo<SyncAdapterType> syncAdapterInfo = + mSyncAdapters.getServiceInfo( + SyncAdapterType.newKey(authority, account.type)); + if (syncAdapterInfo != null) { + if (!syncAdapterInfo.type.supportsUploading() && uploadOnly) { + continue; + } // make this an initialization sync if the isSyncable state is unknown - Bundle extrasCopy = new Bundle(extras); + Bundle extrasCopy = extras; if (isSyncable < 0) { + extrasCopy = new Bundle(extras); extrasCopy.putBoolean(ContentResolver.SYNC_EXTRAS_INITIALIZE, true); } + if (isLoggable) { + Log.v(TAG, "scheduleSync:" + + " delay " + delay + + ", source " + source + + ", account " + account + + ", authority " + authority + + ", extras " + extrasCopy); + } scheduleSyncOperation( new SyncOperation(account, source, authority, extrasCopy, delay)); } diff --git a/core/java/android/preference/CheckBoxPreference.java b/core/java/android/preference/CheckBoxPreference.java index cf5664c..f16a7e4 100644 --- a/core/java/android/preference/CheckBoxPreference.java +++ b/core/java/android/preference/CheckBoxPreference.java @@ -149,14 +149,12 @@ public class CheckBoxPreference extends Preference { * @param checked The checked state. */ public void setChecked(boolean checked) { - - mChecked = checked; - - persistBoolean(checked); - - notifyDependencyChange(shouldDisableDependents()); - - notifyChanged(); + if (mChecked != checked) { + mChecked = checked; + persistBoolean(checked); + notifyDependencyChange(shouldDisableDependents()); + notifyChanged(); + } } /** diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 1861095..84e07f0 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -3390,6 +3390,13 @@ public final class Settings { "google_calendar_sync_window_days"; /** + * How often to update the calendar sync window. + * The window will be advanced every n days. + */ + public static final String GOOGLE_CALENDAR_SYNC_WINDOW_UPDATE_DAYS = + "google_calendar_sync_window_update_days"; + + /** * @deprecated * @hide */ diff --git a/core/java/android/widget/MediaController.java b/core/java/android/widget/MediaController.java index 9910c37..446a992 100644 --- a/core/java/android/widget/MediaController.java +++ b/core/java/android/widget/MediaController.java @@ -282,6 +282,9 @@ public class MediaController extends FrameLayout { if (!mShowing && mAnchor != null) { setProgress(); + if (mPauseButton != null) { + mPauseButton.requestFocus(); + } disableUnsupportedButtons(); int [] anchorpos = new int[2]; @@ -416,6 +419,9 @@ public class MediaController extends FrameLayout { keyCode == KeyEvent.KEYCODE_SPACE)) { doPauseResume(); show(sDefaultTimeout); + if (mPauseButton != null) { + mPauseButton.requestFocus(); + } return true; } else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP) { if (mPlayer.isPlaying()) { |