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

Commit dd8fef70 authored by Anthony Hugh's avatar Anthony Hugh
Browse files

Handle exception when removing package

Handles IllegalArgumentException from the deletePackage call.
It's unclear right now what the root cause of this crash is,
but we will follow up with that in a future release.

BUG: 31425541
Change-Id: I24eba7c06f090dd6dcd2f75268cd6be1d1f2f500
parent 049a4417
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -361,13 +361,20 @@ public class WearPackageInstallerService extends Service {

            // Found package, send uninstall request.
            PowerManager.WakeLock lock = getLock(this.getApplicationContext());

            try {
                pm.deletePackage(packageName, new PackageDeleteObserver(lock, startId),
                        PackageManager.DELETE_ALL_USERS);
            } catch (IllegalArgumentException e) {
                // Couldn't find the package, no need to call uninstall.
                Log.w(TAG, "Could not find package, not deleting " + packageName, e);
            }

            startPermsServiceForUninstall(packageName);
            Log.i(TAG, "Sent delete request for " + packageName);
        } catch (PackageManager.NameNotFoundException e) {
            // Couldn't find the package, no need to call uninstall.
            Log.w(TAG, "Could not find package, not deleting " + packageName);
            Log.w(TAG, "Could not find package, not deleting " + packageName, e);
        }
    }