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

Commit 076a97aa authored by Guojing Yuan's avatar Guojing Yuan Committed by Android Build Coastguard Worker
Browse files

[CDM] Check if it's system UID for hidden Perm Sync APIs

Bug: 371975420
Test: Manual test
Flag: EXEMPT bugfix
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:08f57da9e39869f696de4225197530aa2b9187e8)
Merged-In: I9771ce38728d40b026d94cb6785d55f144c66790
Change-Id: I9771ce38728d40b026d94cb6785d55f144c66790
parent 4b2a235c
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -628,16 +628,25 @@ public class CompanionDeviceManagerService extends SystemService {

        @Override
        public void enablePermissionsSync(int associationId) {
            if (getCallingUid() != SYSTEM_UID) {
                throw new SecurityException("Caller must be system UID");
            }
            mSystemDataTransferProcessor.enablePermissionsSync(associationId);
        }

        @Override
        public void disablePermissionsSync(int associationId) {
            if (getCallingUid() != SYSTEM_UID) {
                throw new SecurityException("Caller must be system UID");
            }
            mSystemDataTransferProcessor.disablePermissionsSync(associationId);
        }

        @Override
        public PermissionSyncRequest getPermissionSyncRequest(int associationId) {
            if (getCallingUid() != SYSTEM_UID) {
                throw new SecurityException("Caller must be system UID");
            }
            return mSystemDataTransferProcessor.getPermissionSyncRequest(associationId);
        }