Merge "Dont throw an exception for non-system apps when enabling system apps."

This commit is contained in:
Nicolas Prevot
2015-02-11 14:27:47 +00:00
committed by Android (Google) Code Review

View File

@@ -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);
}
}
}