Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7b78f500 authored by Alon Albert's avatar Alon Albert Committed by Android (Google) Code Review
Browse files

Merge "Add sync reason to dumpsys"

parents bd00735d 57286f97
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -169,6 +169,25 @@ public abstract class ContentResolver {
    /** @hide */
    public static final int SYNC_ERROR_INTERNAL = 8;

    private static final String[] SYNC_ERROR_NAMES = new String[] {
          "already-in-progress",
          "authentication-error",
          "io-error",
          "parse-error",
          "conflict",
          "too-many-deletions",
          "too-many-retries",
          "internal-error",
    };

    /** @hide */
    static String syncErrorToString(int error) {
        if (error < 1 || error > SYNC_ERROR_NAMES.length) {
            return String.valueOf(error);
        }
        return SYNC_ERROR_NAMES[error - 1];
    }

    public static final int SYNC_OBSERVER_TYPE_SETTINGS = 1<<0;
    public static final int SYNC_OBSERVER_TYPE_PENDING = 1<<1;
    public static final int SYNC_OBSERVER_TYPE_ACTIVE = 1<<2;
+4 −2
Original line number Diff line number Diff line
@@ -226,6 +226,7 @@ public final class ContentService extends IContentService.Stub {
            }
        }

        final int uid = Binder.getCallingUid();
        // This makes it so that future permission checks will be in the context of this
        // process rather than the caller's process. We will restore this before returning.
        long identityToken = clearCallingIdentity();
@@ -264,7 +265,7 @@ public final class ContentService extends IContentService.Stub {
            if (syncToNetwork) {
                SyncManager syncManager = getSyncManager();
                if (syncManager != null) {
                    syncManager.scheduleLocalSync(null /* all accounts */, callingUserHandle,
                    syncManager.scheduleLocalSync(null /* all accounts */, callingUserHandle, uid,
                            uri.getAuthority());
                }
            }
@@ -300,6 +301,7 @@ public final class ContentService extends IContentService.Stub {
    public void requestSync(Account account, String authority, Bundle extras) {
        ContentResolver.validateSyncExtrasBundle(extras);
        int userId = UserHandle.getCallingUserId();
        int uId = Binder.getCallingUid();

        // This makes it so that future permission checks will be in the context of this
        // process rather than the caller's process. We will restore this before returning.
@@ -307,7 +309,7 @@ public final class ContentService extends IContentService.Stub {
        try {
            SyncManager syncManager = getSyncManager();
            if (syncManager != null) {
                syncManager.scheduleSync(account, userId, authority, extras, 0 /* no delay */,
                syncManager.scheduleSync(account, userId, uId, authority, extras, 0 /* no delay */,
                        false /* onlyThoseWithUnkownSyncableState */);
            }
        } finally {
Loading