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

Commit 0413046f authored by Nicolas Prevot's avatar Nicolas Prevot
Browse files

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
parent 8f6afec2
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -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(info.activityInfo.packageName, userId);
                                pm.installExistingPackageAsUser(packageName, userId);
                            } else {
                                Slog.d(LOG_TAG, "Not enabling " + packageName + " since is not a"
                                        + " system app");
                            }
                        }
                    }
                }