summaryrefslogtreecommitdiffstats
path: root/core/java/android/content/AbstractThreadedSyncAdapter.java
diff options
context:
space:
mode:
authorFred Quintana <fredq@google.com>2010-03-30 15:16:21 -0700
committerFred Quintana <fredq@google.com>2010-03-30 17:31:52 -0700
commitd5e4fdc8a4743abc0d9fe3cb952a78f9ad078c6b (patch)
tree368fa8665a93e3e524b0d020fe33f5febb58661d /core/java/android/content/AbstractThreadedSyncAdapter.java
parent8acdb911f4b9c38d1cafd3ab464d6bec54564c84 (diff)
downloadframeworks_base-d5e4fdc8a4743abc0d9fe3cb952a78f9ad078c6b.zip
frameworks_base-d5e4fdc8a4743abc0d9fe3cb952a78f9ad078c6b.tar.gz
frameworks_base-d5e4fdc8a4743abc0d9fe3cb952a78f9ad078c6b.tar.bz2
some changes due to an API review
- make EntityIterator extend Iterator and thus not throw a RemoteException, instead converting it into a RuntimeException. - rename ActiveSyncInfo to SyncInfo - change getActiveSync to getCurrentSync - remove the accessors in SyncInfo and instead make the final fields publicly accessible - made AbstractThreadedSyncAdapter.cancelSync not take a thread Change-Id: I99fde5585bc5f1e95f4873ffbba189074a8d6372 http://b/issue?id=2553539 http://b/issue?id=2553541 http://b/issue?id=2553550
Diffstat (limited to 'core/java/android/content/AbstractThreadedSyncAdapter.java')
-rw-r--r--core/java/android/content/AbstractThreadedSyncAdapter.java24
1 files changed, 14 insertions, 10 deletions
diff --git a/core/java/android/content/AbstractThreadedSyncAdapter.java b/core/java/android/content/AbstractThreadedSyncAdapter.java
index 14bc5dd..9dd7b9f 100644
--- a/core/java/android/content/AbstractThreadedSyncAdapter.java
+++ b/core/java/android/content/AbstractThreadedSyncAdapter.java
@@ -17,12 +17,10 @@
package android.content;
import android.accounts.Account;
-import android.net.TrafficStats;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Process;
import android.os.RemoteException;
-import android.util.EventLog;
import java.util.concurrent.atomic.AtomicInteger;
@@ -113,12 +111,13 @@ public abstract class AbstractThreadedSyncAdapter {
public void cancelSync(ISyncContext syncContext) {
// synchronize to make sure that mSyncThread doesn't change between when we
// check it and when we use it
+ final SyncThread syncThread;
synchronized (mSyncThreadLock) {
- if (mSyncThread != null
- && mSyncThread.mSyncContext.getSyncContextBinder()
- == syncContext.asBinder()) {
- onSyncCanceled(mSyncThread);
- }
+ syncThread = mSyncThread;
+ }
+ if (syncThread != null
+ && syncThread.mSyncContext.getSyncContextBinder() == syncContext.asBinder()) {
+ onSyncCanceled();
}
}
@@ -213,9 +212,14 @@ public abstract class AbstractThreadedSyncAdapter {
* thread than the sync thread and so you must consider the multi-threaded implications
* of the work that you do in this method.
*
- * @param thread the thread that is running the sync operation to cancel
*/
- public void onSyncCanceled(Thread thread) {
- thread.interrupt();
+ public void onSyncCanceled() {
+ final SyncThread syncThread;
+ synchronized (mSyncThreadLock) {
+ syncThread = mSyncThread;
+ }
+ if (syncThread != null) {
+ syncThread.interrupt();
+ }
}
}