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

Commit c1951902 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Clean up android.webkit.update_service_v2." into main

parents 6f38d94c 84c198ae
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -71,16 +71,6 @@ interface IWebViewUpdateService {
     */
    PackageInfo getCurrentWebViewPackage();

    /**
     * Used by Settings to determine whether multiprocess is enabled.
     */
    boolean isMultiProcessEnabled();

    /**
     * Used by Settings to enable/disable multiprocess.
     */
    void enableMultiProcess(boolean enable);

    /**
     * Used by Settings to get the default WebView package.
     */
+1 −14
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ import android.content.pm.ApplicationInfo;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.RecordingCanvas;
import android.os.RemoteException;
import android.os.SystemProperties;
import android.os.Trace;
import android.util.SparseArray;
@@ -217,19 +216,7 @@ public final class WebViewDelegate {
     * Returns whether WebView should run in multiprocess mode.
     */
    public boolean isMultiProcessEnabled() {
        if (Flags.updateServiceV2()) {
        return true;
        } else if (Flags.updateServiceIpcWrapper()) {
            // We don't want to support this method in the new wrapper because updateServiceV2 is
            // intended to ship in the same release (or sooner). It's only possible to disable it
            // with an obscure adb command, so just return true here too.
            return true;
        }
        try {
            return WebViewFactory.getUpdateService().isMultiProcessEnabled();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
+2 −4
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package android.webkit;

import static android.webkit.Flags.updateServiceV2;

import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.annotation.UptimeMillisLong;
@@ -490,7 +488,7 @@ public final class WebViewFactory {
                Trace.traceEnd(Trace.TRACE_TAG_WEBVIEW);
            }

            if (updateServiceV2() && !isInstalledPackage(newPackageInfo)) {
            if (!isInstalledPackage(newPackageInfo)) {
                throw new MissingWebViewPackageException(
                        TextUtils.formatSimple(
                                "Current WebView Package (%s) is not installed for the current "
@@ -498,7 +496,7 @@ public final class WebViewFactory {
                                newPackageInfo.packageName));
            }

            if (updateServiceV2() && !isEnabledPackage(newPackageInfo)) {
            if (!isEnabledPackage(newPackageInfo)) {
                throw new MissingWebViewPackageException(
                        TextUtils.formatSimple(
                                "Current WebView Package (%s) is not enabled for the current user",
+1 −37
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package android.webkit;

import static android.webkit.Flags.updateServiceV2;

import android.content.pm.PackageInfo;
import android.os.Build;
import android.os.ChildZygoteProcess;
@@ -52,13 +50,6 @@ public class WebViewZygote {
    @GuardedBy("sLock")
    private static PackageInfo sPackage;

    /**
     * Flag for whether multi-process WebView is enabled. If this is {@code false}, the zygote will
     * not be started. Should be removed entirely after we remove the updateServiceV2 flag.
     */
    @GuardedBy("sLock")
    private static boolean sMultiprocessEnabled = false;

    public static ZygoteProcess getProcess() {
        synchronized (sLock) {
            if (sZygote != null) return sZygote;
@@ -76,40 +67,13 @@ public class WebViewZygote {

    public static boolean isMultiprocessEnabled() {
        synchronized (sLock) {
            if (updateServiceV2()) {
            return sPackage != null;
            } else {
                return sMultiprocessEnabled && sPackage != null;
            }
        }
    }

    public static void setMultiprocessEnabled(boolean enabled) {
        if (updateServiceV2()) {
            throw new IllegalStateException(
                    "setMultiprocessEnabled shouldn't be called if update_service_v2 flag is set.");
        }
        synchronized (sLock) {
            sMultiprocessEnabled = enabled;

            // When multi-process is disabled, kill the zygote. When it is enabled,
            // the zygote will be started when it is first needed in getProcess().
            if (!enabled) {
                stopZygoteLocked();
            }
        }
    }

    static void onWebViewProviderChanged(PackageInfo packageInfo) {
        synchronized (sLock) {
            sPackage = packageInfo;

            // If multi-process is not enabled, then do not start the zygote service.
            // Only check sMultiprocessEnabled if updateServiceV2 is not enabled.
            if (!updateServiceV2() && !sMultiprocessEnabled) {
                return;
            }

            stopZygoteLocked();
        }
    }
+1 −2
Original line number Diff line number Diff line
package com.android.settingslib;

import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_USER_LABEL;
import static android.webkit.Flags.updateServiceV2;

import android.annotation.ColorInt;
import android.app.admin.DevicePolicyManager;
@@ -496,7 +495,7 @@ public class Utils {
                || packageName.equals(sServicesSystemSharedLibPackageName)
                || packageName.equals(sSharedSystemSharedLibPackageName)
                || packageName.equals(PrintManager.PRINT_SPOOLER_PACKAGE_NAME)
                || (updateServiceV2() && packageName.equals(getDefaultWebViewPackageName(pm)))
                || packageName.equals(getDefaultWebViewPackageName(pm))
                || isDeviceProvisioningPackage(resources, packageName);
    }

Loading