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

Commit fcd9f58f authored by Vinod Krishnan's avatar Vinod Krishnan Committed by android-build-merger
Browse files

Wear: Release wake lock during uninstall

am: 478ee7e0

Change-Id: I898c709282be21384e81fd4c325601adc3a54d0e
parents 4433224f 478ee7e0
Loading
Loading
Loading
Loading
+5 −11
Original line number Diff line number Diff line
@@ -354,28 +354,22 @@ public class WearPackageInstallerService extends Service {
        int startId = WearPackageArgs.getStartId(argsBundle);
        final String packageName = WearPackageArgs.getPackageName(argsBundle);

        PowerManager.WakeLock lock = getLock(this.getApplicationContext());
        final PackageManager pm = getPackageManager();
        try {
            // Result ignored.
            pm.getPackageInfo(packageName, 0);

            // 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);
                finishService(lock, startId);
            }

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