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

Commit 7946586c authored by Raphael Kim's avatar Raphael Kim Committed by Android Build Coastguard Worker
Browse files

[CDM] Check for system calling UID when backing up and restoring data

Bug: 370962373
Test: Manual test on POC
Flag: EXEMPT bugfix
(cherry picked from commit 692cddfb)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:191638ababfc5b03d63264b8932c5903f18543ba)
Merged-In: I307940b7194dd17eacbbfb8be5c92ac21e688c65
Change-Id: I307940b7194dd17eacbbfb8be5c92ac21e688c65
parent 2d1d69e1
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -724,11 +724,17 @@ public class CompanionDeviceManagerService extends SystemService {

        @Override
        public byte[] getBackupPayload(int userId) {
            if (getCallingUid() != SYSTEM_UID) {
                throw new SecurityException("Caller must be system");
            }
            return mBackupRestoreProcessor.getBackupPayload(userId);
        }

        @Override
        public void applyRestoredPayload(byte[] payload, int userId) {
            if (getCallingUid() != SYSTEM_UID) {
                throw new SecurityException("Caller must be system");
            }
            mBackupRestoreProcessor.applyRestoredPayload(payload, userId);
        }