summaryrefslogtreecommitdiffstats
path: root/core/java/android/content
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2015-06-22 17:41:44 -0700
committerDianne Hackborn <hackbod@google.com>2015-06-22 17:41:44 -0700
commitd01ed46c633912895ac4d9dc0804dac8f7fe9069 (patch)
treeabb9f7c86cef37102cfd1f4aee1c481dd05e3c36 /core/java/android/content
parent9622c0cc900da84c903f0395053dd4d9a9e4f53d (diff)
downloadframeworks_base-d01ed46c633912895ac4d9dc0804dac8f7fe9069.zip
frameworks_base-d01ed46c633912895ac4d9dc0804dac8f7fe9069.tar.gz
frameworks_base-d01ed46c633912895ac4d9dc0804dac8f7fe9069.tar.bz2
Fix issue #21799741: AbstractThreadedSyncAdapter crashes...
...when permissions aren't granted Eat the SecurityException, turn it into a new callback. Change-Id: Ibeffce061aa51beba097c90f431de07ce70b3c4e
Diffstat (limited to 'core/java/android/content')
-rw-r--r--core/java/android/content/AbstractThreadedSyncAdapter.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/core/java/android/content/AbstractThreadedSyncAdapter.java b/core/java/android/content/AbstractThreadedSyncAdapter.java
index 809f900..9b61359 100644
--- a/core/java/android/content/AbstractThreadedSyncAdapter.java
+++ b/core/java/android/content/AbstractThreadedSyncAdapter.java
@@ -261,6 +261,10 @@ public abstract class AbstractThreadedSyncAdapter {
} else {
syncResult.databaseError = true;
}
+ } catch (SecurityException e) {
+ AbstractThreadedSyncAdapter.this.onSecurityException(mAccount, mExtras,
+ mAuthority, syncResult);
+ syncResult.databaseError = true;
} finally {
Trace.traceEnd(Trace.TRACE_TAG_SYNC_MANAGER);
@@ -306,6 +310,20 @@ public abstract class AbstractThreadedSyncAdapter {
String authority, ContentProviderClient provider, SyncResult syncResult);
/**
+ * Report that there was a security exception when opening the content provider
+ * prior to calling {@link #onPerformSync}. This will be treated as a sync
+ * database failure.
+ *
+ * @param account the account that attempted to sync
+ * @param extras SyncAdapter-specific parameters
+ * @param authority the authority of the failed sync request
+ * @param syncResult SyncAdapter-specific parameters
+ */
+ public void onSecurityException(Account account, Bundle extras,
+ String authority, SyncResult syncResult) {
+ }
+
+ /**
* Indicates that a sync operation has been canceled. This will be invoked on a separate
* thread than the sync thread and so you must consider the multi-threaded implications
* of the work that you do in this method.