OSDN Git Service

Revert "Redact Account info from getCurrentSyncs"
authorMatthew Williams <mjwilliams@google.com>
Wed, 20 Jan 2016 00:12:25 +0000 (00:12 +0000)
committerMatthew Williams <mjwilliams@google.com>
Wed, 20 Jan 2016 00:12:25 +0000 (00:12 +0000)
This reverts commit b63057e698a01dafcefc7ba09b397b0336bba43d.

Reverting this b/c http://droidmerger-01.mtv.corp.google.com:8888/googleplex/branch/lmp-dev
claims there's an automerge path from lmp-dev all the way to master.

Change-Id: Ia99a20410153442436ea836b5223a524b640dcbf

core/java/android/content/SyncInfo.java
services/core/java/com/android/server/content/ContentService.java
services/core/java/com/android/server/content/SyncStorageEngine.java

index ab3c30b..a586d6f 100644 (file)
@@ -24,13 +24,6 @@ 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;
 
@@ -51,17 +44,6 @@ 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;
index f72b1c3..75a74c0 100644 (file)
@@ -815,13 +815,9 @@ public final class ContentService extends IContentService.Stub {
         mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_STATS,
                 "no permission to read the sync stats");
 
-        final boolean canAccessAccounts =
-            mContext.checkCallingOrSelfPermission(Manifest.permission.GET_ACCOUNTS)
-                == PackageManager.PERMISSION_GRANTED;
         long identityToken = clearCallingIdentity();
         try {
-            return getSyncManager().getSyncStorageEngine()
-                .getCurrentSyncsCopy(userId, canAccessAccounts);
+            return getSyncManager().getSyncStorageEngine().getCurrentSyncsCopy(userId);
         } finally {
             restoreCallingIdentity(identityToken);
         }
index eae783e..8266c08 100644 (file)
@@ -1469,23 +1469,15 @@ public class SyncStorageEngine extends Handler {
     }
 
     /**
-     * @param userId Id of user to return current sync info.
-     * @param canAccessAccounts Determines whether to redact Account information from the result.
-     * @return a copy of the current syncs data structure. Will not return null.
+     * @return a copy of the current syncs data structure. Will not return
+     * null.
      */
-    public List<SyncInfo> getCurrentSyncsCopy(int userId, boolean canAccessAccounts) {
+    public List<SyncInfo> getCurrentSyncsCopy(int userId) {
         synchronized (mAuthorities) {
             final List<SyncInfo> syncs = getCurrentSyncsLocked(userId);
             final List<SyncInfo> syncsCopy = new ArrayList<SyncInfo>();
             for (SyncInfo sync : syncs) {
-                SyncInfo copy;
-                if (!canAccessAccounts) {
-                    copy = SyncInfo.createAccountRedacted(
-                        sync.authorityId, sync.authority, sync.startTime);
-                } else {
-                    copy = new SyncInfo(sync);
-                }
-                syncsCopy.add(copy);
+                syncsCopy.add(new SyncInfo(sync));
             }
             return syncsCopy;
         }