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

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

Merge "[CDM] Fix a bug when checking system uid" into main

parents 37faad86 e1c743ff
Loading
Loading
Loading
Loading
+5 −5
Original line number Original line Diff line number Diff line
@@ -612,7 +612,7 @@ public class CompanionDeviceManagerService extends SystemService {


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


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


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


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


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