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

Commit 2adcd2ad authored by Todd Kennedy's avatar Todd Kennedy Committed by android-build-merger
Browse files

Merge "ignore IllegalArgumentException during uninstall" into oc-dev am: 8b540dc7

am: bcb2fe06

Change-Id: I3e4de8dbcd13954cf4957ff3dd813b45106231b2
parents 6fdc8fcd bcb2fe06
Loading
Loading
Loading
Loading
+3 −20
Original line number Diff line number Diff line
@@ -1323,24 +1323,8 @@ public class PackageManagerTests extends AndroidTestCase {
            return;
        }
        Runtime.getRuntime().gc();

        final String packageName = ip.pkg.packageName;
        Log.i(TAG, "Deleting package : " + packageName);

        ApplicationInfo info = null;
        try {
            info = getPm().getApplicationInfo(packageName, PackageManager.MATCH_UNINSTALLED_PACKAGES);
        } catch (NameNotFoundException ignored) {
        }

        DeleteObserver observer = new DeleteObserver(packageName);
        getPm().deletePackage(packageName, observer, PackageManager.DELETE_ALL_USERS);
        observer.waitForCompletion(MAX_WAIT_TIME);

        try {
            if (info != null) {
                assertUninstalled(info);
            }
            cleanUpInstall(ip.pkg.packageName);
        } finally {
            File outFile = new File(ip.pkg.codePath);
            if (outFile != null && outFile.exists()) {
@@ -1355,16 +1339,15 @@ public class PackageManagerTests extends AndroidTestCase {
        }
        Log.i(TAG, "Deleting package : " + pkgName);
        try {
            ApplicationInfo info = getPm().getApplicationInfo(pkgName,
            final ApplicationInfo info = getPm().getApplicationInfo(pkgName,
                    PackageManager.MATCH_UNINSTALLED_PACKAGES);

            if (info != null) {
                DeleteObserver observer = new DeleteObserver(pkgName);
                getPm().deletePackage(pkgName, observer, PackageManager.DELETE_ALL_USERS);
                observer.waitForCompletion(MAX_WAIT_TIME);
                assertUninstalled(info);
            }
        } catch (NameNotFoundException e) {
        } catch (IllegalArgumentException | NameNotFoundException e) {
        }
    }