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

Commit ef8d5f50 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix cancelSync() permission check for periodic syncs."

parents 950c769c d51101c9
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -644,6 +644,11 @@ public final class ContentService extends IContentService.Stub {
        int userId = UserHandle.getCallingUserId();
        final int callingUid = Binder.getCallingUid();

        if (request.isPeriodic()) {
            mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS,
                    "no permission to write the sync settings");
        }

        long identityToken = clearCallingIdentity();
        try {
            SyncStorageEngine.EndPoint info;
@@ -653,8 +658,6 @@ public final class ContentService extends IContentService.Stub {
            info = new SyncStorageEngine.EndPoint(account, provider, userId);
            if (request.isPeriodic()) {
                // Remove periodic sync.
                mContext.enforceCallingOrSelfPermission(Manifest.permission.WRITE_SYNC_SETTINGS,
                        "no permission to write the sync settings");
                getSyncManager().removePeriodicSync(info, extras,
                        "cancelRequest() by uid=" + callingUid);
            }