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

Commit 6b86ac70 authored by Christopher Tate's avatar Christopher Tate Committed by Android Git Automerger
Browse files

am ffe0a803: Fix permission checks around setBackupEnabled()

* commit 'ffe0a803':
  Fix permission checks around setBackupEnabled()
parents d4ff4b64 ffe0a803
Loading
Loading
Loading
Loading
+37 −31
Original line number Diff line number Diff line
@@ -5358,12 +5358,15 @@ class BackupManagerService extends IBackupManager.Stub {
    }

    // Enable/disable the backup service
    @Override
    public void setBackupEnabled(boolean enable) {
        mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP,
                "setBackupEnabled");

        Slog.i(TAG, "Backup enabled => " + enable);

        long oldId = Binder.clearCallingIdentity();
        try {
            boolean wasEnabled = mEnabled;
            synchronized (this) {
                Settings.Secure.putInt(mContext.getContentResolver(),
@@ -5400,6 +5403,9 @@ class BackupManagerService extends IBackupManager.Stub {
                    }
                }
            }
        } finally {
            Binder.restoreCallingIdentity(oldId);
        }
    }

    // Enable/disable automatic restore of app data at install time