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

Commit fff2595d authored by Alex Johnston's avatar Alex Johnston
Browse files

Fix leaks of personal apps in setApplicationHidden

* If setApplicationHidden is called with a non-system
  non-installed app, the exception thrown exposes
  whether the app is installed on the personal side.
* To solve this, the exception thrown is wrapped
  and a different message, which does not include
  whether the app is installed, is used.

Bug: 150677248
Test: atest com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testApplicationHiddenParent
Change-Id: I742b5d71904e5d54cc2b353448fa043bbc7293cb
parent 2523db7c
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -10927,9 +10927,14 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    private void enforcePackageIsSystemPackage(String packageName, int userId)
            throws RemoteException {
        if (!isSystemApp(mIPackageManager, packageName, userId)) {
            throw new IllegalArgumentException(
                    "The provided package is not a system package");
        boolean isSystem;
        try {
            isSystem = isSystemApp(mIPackageManager, packageName, userId);
        } catch (IllegalArgumentException e) {
            isSystem = false;
        }
        if (!isSystem) {
            throw new IllegalArgumentException("The provided package is not a system package");
        }
    }