From 850171a99438776591a2104a3fe6f2b1db815382 Mon Sep 17 00:00:00 2001 From: Salud Lemus Date: Mon, 25 Apr 2022 16:54:42 -0700 Subject: [PATCH] Update canSilentlyInstallPackage DPMS API for financed device owner Currently, this API returns false for a financed device owner even though it is a device owner. Because it returns false, it prevents a financed device owner from installing apps. Bug: 228137429 Test: Local test with and without the changes Change-Id: Ia1b4893ae601d8e50d0b7c6d16e895d92b1885f0 --- .../server/devicepolicy/DevicePolicyManagerService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 837d3b0589d42..48e97bd947166 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -13059,9 +13059,11 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { if (callerPackage == null) { return false; } + + CallerIdentity caller = new CallerIdentity(callerUid, null, null); if (isUserAffiliatedWithDevice(UserHandle.getUserId(callerUid)) && (isActiveProfileOwner(callerUid) - || isActiveDeviceOwner(callerUid))) { + || isDefaultDeviceOwner(caller) || isFinancedDeviceOwner(caller))) { // device owner or a profile owner affiliated with the device owner return true; }