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

Commit a936b291 authored by Guojing Yuan's avatar Guojing Yuan Committed by Android (Google) Code Review
Browse files

Merge "[CDM] Handle multi users while checking SYSTEM UID" into main

parents b4360f83 5614ae8d
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -612,7 +612,7 @@ public class CompanionDeviceManagerService extends SystemService {

        @Override
        public void enablePermissionsSync(int associationId) {
            if (getCallingUid() != SYSTEM_UID) {
            if (UserHandle.getAppId(Binder.getCallingUid()) == SYSTEM_UID) {
                throw new SecurityException("Caller must be system UID");
            }
            mSystemDataTransferProcessor.enablePermissionsSync(associationId);
@@ -620,7 +620,7 @@ public class CompanionDeviceManagerService extends SystemService {

        @Override
        public void disablePermissionsSync(int associationId) {
            if (getCallingUid() != SYSTEM_UID) {
            if (UserHandle.getAppId(Binder.getCallingUid()) == SYSTEM_UID) {
                throw new SecurityException("Caller must be system UID");
            }
            mSystemDataTransferProcessor.disablePermissionsSync(associationId);
@@ -628,7 +628,7 @@ public class CompanionDeviceManagerService extends SystemService {

        @Override
        public PermissionSyncRequest getPermissionSyncRequest(int associationId) {
            if (getCallingUid() != SYSTEM_UID) {
            if (UserHandle.getAppId(Binder.getCallingUid()) == SYSTEM_UID) {
                throw new SecurityException("Caller must be system UID");
            }
            return mSystemDataTransferProcessor.getPermissionSyncRequest(associationId);
@@ -704,7 +704,7 @@ public class CompanionDeviceManagerService extends SystemService {

        @Override
        public byte[] getBackupPayload(int userId) {
            if (getCallingUid() != SYSTEM_UID) {
            if (UserHandle.getAppId(Binder.getCallingUid()) == SYSTEM_UID) {
                throw new SecurityException("Caller must be system");
            }
            return mBackupRestoreProcessor.getBackupPayload(userId);
@@ -712,7 +712,7 @@ public class CompanionDeviceManagerService extends SystemService {

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