diff options
author | Nicolas Prevot <nprevot@google.com> | 2015-02-11 13:45:35 +0000 |
---|---|---|
committer | Nicolas Prevot <nprevot@google.com> | 2015-02-11 14:17:21 +0000 |
commit | 0413046f12316f36d12e91ba6dbafc53a7c20408 (patch) | |
tree | 725c60eafbcdb10496f253a37796a1bee93cf43f /services/devicepolicy/java | |
parent | 8f6afec2aa84f4dc7684fa8e1e43150e8a611247 (diff) | |
download | frameworks_base-0413046f12316f36d12e91ba6dbafc53a7c20408.zip frameworks_base-0413046f12316f36d12e91ba6dbafc53a7c20408.tar.gz frameworks_base-0413046f12316f36d12e91ba6dbafc53a7c20408.tar.bz2 |
Dont throw an exception for non-system apps when enabling system apps.
In EnableSystemAppWithIntent: if a non-system app matches the intent:
ignore it instead of throwing an exception.
Change-Id: I64dc9a0bbc1a6bc5e2159a33b7273464ed2518c5
Diffstat (limited to 'services/devicepolicy/java')
-rw-r--r-- | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index b8f0d07..05c37d1 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -5045,15 +5045,14 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { if (activitiesToEnable != null) { for (ResolveInfo info : activitiesToEnable) { if (info.activityInfo != null) { - - if (!isSystemApp(pm, info.activityInfo.packageName, primaryUser.id)) { - throw new IllegalArgumentException( - "Only system apps can be enabled this way."); + String packageName = info.activityInfo.packageName; + if (isSystemApp(pm, packageName, primaryUser.id)) { + numberOfAppsInstalled++; + pm.installExistingPackageAsUser(packageName, userId); + } else { + Slog.d(LOG_TAG, "Not enabling " + packageName + " since is not a" + + " system app"); } - - - numberOfAppsInstalled++; - pm.installExistingPackageAsUser(info.activityInfo.packageName, userId); } } } |