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

Commit f0471c77 authored by Gustav Sennton's avatar Gustav Sennton Committed by android-build-merger
Browse files

Merge "Ensure we don\'t crash the system server when disabling/enabling package." into nyc-dev

am: 15e636b5

* commit '15e636b5':
  Ensure we don't crash the system server when disabling/enabling package.

Change-Id: I32b8af9a18b5ea00144ca59afb036400be6a84be
parents 7bbeaf89 15e636b5
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.server.webkit;
import android.app.ActivityManagerNative;
import android.app.AppGlobals;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.IPackageDeleteObserver;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
@@ -187,7 +188,8 @@ public class SystemImpl implements SystemInterface {
        enablePackageForAllUsers(context, packageName, false);
        try {
            PackageManager pm = AppGlobals.getInitialApplication().getPackageManager();
            if (pm.getApplicationInfo(packageName, 0).isUpdatedSystemApp()) {
            ApplicationInfo applicationInfo = pm.getApplicationInfo(packageName, 0);
            if (applicationInfo != null && applicationInfo.isUpdatedSystemApp()) {
                pm.deletePackage(packageName, new IPackageDeleteObserver.Stub() {
                        public void packageDeleted(String packageName, int returnCode) {
                            enablePackageForAllUsers(context, packageName, false);
@@ -214,8 +216,9 @@ public class SystemImpl implements SystemInterface {
                    enable ? PackageManager.COMPONENT_ENABLED_STATE_DEFAULT :
                    PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER, 0,
                    userId, null);
        } catch (RemoteException e) {
            Log.w(TAG, "Tried to disable " + packageName + " for user " + userId + ": " + e);
        } catch (RemoteException | IllegalArgumentException e) {
            Log.w(TAG, "Tried to " + (enable ? "enable " : "disable ") + packageName
                    + " for user " + userId + ": " + e);
        }
    }

+2 −0
Original line number Diff line number Diff line
@@ -160,6 +160,8 @@ public class WebViewUpdateServiceImpl {
            isFallbackEnabled = isEnabledPackage(
                    mSystemInterface.getPackageInfoForProvider(fallbackProvider));
        } catch (NameNotFoundException e) {
            // No fallback package installed -> early out.
            return;
        }

        if (existsValidNonFallbackProvider