summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMatthew Williams <mjwilliams@google.com>2016-01-19 23:04:04 +0000
committerThe Android Automerger <android-build@google.com>2016-02-26 16:56:12 -0800
commit3cd1905d857913241198f65066e1aa78516192ea (patch)
tree9a4b133c8e228dae15d3f741cb59d0f58873d5a2 /core
parentb22f3f2d93df118092449500177c9d07b08bbe91 (diff)
downloadframeworks_base-3cd1905d857913241198f65066e1aa78516192ea.zip
frameworks_base-3cd1905d857913241198f65066e1aa78516192ea.tar.gz
frameworks_base-3cd1905d857913241198f65066e1aa78516192ea.tar.bz2
Redact Account info from getCurrentSyncs
BUG:26094635 If the caller to ContentResolver#getCurrentSyncs does not hold the GET_ACCOUNTS permission, return a SyncInfo object that does not contain any Account information. Change-Id: I5628ebe1f56c8e3f784aaf1b3281e6b829d19314 (cherry picked from commit b63057e698a01dafcefc7ba09b397b0336bba43d)
Diffstat (limited to 'core')
-rw-r--r--core/java/android/content/SyncInfo.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/core/java/android/content/SyncInfo.java b/core/java/android/content/SyncInfo.java
index a586d6f..ab3c30b 100644
--- a/core/java/android/content/SyncInfo.java
+++ b/core/java/android/content/SyncInfo.java
@@ -24,6 +24,13 @@ import android.os.Parcelable;
* Information about the sync operation that is currently underway.
*/
public class SyncInfo implements Parcelable {
+ /**
+ * Used when the caller receiving this object doesn't have permission to access the accounts
+ * on device.
+ * @See Manifest.permission.GET_ACCOUNTS
+ */
+ private static final Account REDACTED_ACCOUNT = new Account("*****", "*****");
+
/** @hide */
public final int authorityId;
@@ -44,6 +51,17 @@ public class SyncInfo implements Parcelable {
*/
public final long startTime;
+ /**
+ * Creates a SyncInfo object with an unusable Account. Used when the caller receiving this
+ * object doesn't have access to the accounts on the device.
+ * @See Manifest.permission.GET_ACCOUNTS
+ * @hide
+ */
+ public static SyncInfo createAccountRedacted(
+ int authorityId, String authority, long startTime) {
+ return new SyncInfo(authorityId, REDACTED_ACCOUNT, authority, startTime);
+ }
+
/** @hide */
public SyncInfo(int authorityId, Account account, String authority, long startTime) {
this.authorityId = authorityId;