Loading services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java +10 −2 Original line number Diff line number Diff line Loading @@ -336,8 +336,10 @@ public class CompanionDeviceManagerService extends SystemService implements Bind @Override public List<String> getAssociations(String callingPackage, int userId) throws RemoteException { if (!callerCanManageCompanionDevices()) { checkCallerIsSystemOr(callingPackage, userId); checkUsesFeature(callingPackage, getCallingUserId()); } return new ArrayList<>(CollectionUtils.map( readAllAssociations(userId, callingPackage), a -> a.deviceAddress)); Loading @@ -353,6 +355,12 @@ public class CompanionDeviceManagerService extends SystemService implements Bind removeAssociation(getCallingUserId(), callingPackage, deviceMacAddress); } private boolean callerCanManageCompanionDevices() { return getContext().checkCallingOrSelfPermission( android.Manifest.permission.MANAGE_COMPANION_DEVICES) == PackageManager.PERMISSION_GRANTED; } private void checkCallerIsSystemOr(String pkg) throws RemoteException { checkCallerIsSystemOr(pkg, getCallingUserId()); } Loading Loading
services/companion/java/com/android/server/companion/CompanionDeviceManagerService.java +10 −2 Original line number Diff line number Diff line Loading @@ -336,8 +336,10 @@ public class CompanionDeviceManagerService extends SystemService implements Bind @Override public List<String> getAssociations(String callingPackage, int userId) throws RemoteException { if (!callerCanManageCompanionDevices()) { checkCallerIsSystemOr(callingPackage, userId); checkUsesFeature(callingPackage, getCallingUserId()); } return new ArrayList<>(CollectionUtils.map( readAllAssociations(userId, callingPackage), a -> a.deviceAddress)); Loading @@ -353,6 +355,12 @@ public class CompanionDeviceManagerService extends SystemService implements Bind removeAssociation(getCallingUserId(), callingPackage, deviceMacAddress); } private boolean callerCanManageCompanionDevices() { return getContext().checkCallingOrSelfPermission( android.Manifest.permission.MANAGE_COMPANION_DEVICES) == PackageManager.PERMISSION_GRANTED; } private void checkCallerIsSystemOr(String pkg) throws RemoteException { checkCallerIsSystemOr(pkg, getCallingUserId()); } Loading