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

Commit be19fe5e authored by Richard Coles's avatar Richard Coles Committed by Gerrit Code Review
Browse files

Merge "Fix WebViewUpdateServiceTest failures when using Thread without Looper."

parents 8d0c4ed7 86f7bbe1
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.UserInfo;
import android.content.res.XmlResourceParser;
import android.database.ContentObserver;
import android.os.Build;
import android.os.RemoteException;
import android.os.UserHandle;
@@ -270,8 +271,21 @@ public class SystemImpl implements SystemInterface {
    }

    @Override
    public void setMultiprocessEnabled(boolean enabled) {
        WebViewZygote.setMultiprocessEnabled(enabled);
    public void setMultiProcessEnabledFromContext(Context context) {
        boolean enableMultiProcess = false;
        try {
            enableMultiProcess = Settings.Global.getInt(context.getContentResolver(),
                    Settings.Global.WEBVIEW_MULTIPROCESS) == 1;
        } catch (Settings.SettingNotFoundException ex) {
        }
        WebViewZygote.setMultiprocessEnabled(enableMultiProcess);
    }

    @Override
    public void registerContentObserver(Context context, ContentObserver contentObserver) {
        context.getContentResolver().registerContentObserver(
                Settings.Global.getUriFor(Settings.Global.WEBVIEW_MULTIPROCESS),
                false, contentObserver);
    }

    // flags declaring we want extra info from the package manager for webview providers
+3 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.server.webkit;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.database.ContentObserver;
import android.webkit.WebViewProviderInfo;

/**
@@ -49,5 +50,6 @@ public interface SystemInterface {
    public PackageInfo getPackageInfoForProvider(WebViewProviderInfo configInfo)
            throws NameNotFoundException;

    public void setMultiprocessEnabled(boolean enabled);
    public void setMultiProcessEnabledFromContext(Context context);
    public void registerContentObserver(Context context, ContentObserver contentObserver);
}
+3 −18
Original line number Diff line number Diff line
@@ -20,12 +20,10 @@ import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.Signature;
import android.content.ContentResolver;
import android.database.ContentObserver;
import android.net.Uri;
import android.os.Handler;
import android.os.UserHandle;
import android.provider.Settings;
import android.util.Base64;
import android.util.Slog;
import android.webkit.WebViewFactory;
@@ -48,7 +46,7 @@ public class WebViewUpdateServiceImpl {
    private SystemInterface mSystemInterface;
    private WebViewUpdater mWebViewUpdater;
    private SettingsObserver mSettingsObserver;
    private Context mContext;
    final private Context mContext;

    public WebViewUpdateServiceImpl(Context context, SystemInterface systemInterface) {
        mContext = context;
@@ -683,15 +681,10 @@ public class WebViewUpdateServiceImpl {
     * appropriately.
     */
    private class SettingsObserver extends ContentObserver {
        private final ContentResolver mResolver;

        SettingsObserver() {
            super(new Handler());

            mResolver = mContext.getContentResolver();
            mResolver.registerContentObserver(
                    Settings.Global.getUriFor(Settings.Global.WEBVIEW_MULTIPROCESS),
                    false, this);
            mSystemInterface.registerContentObserver(mContext, this);

            // Push the current value of the setting immediately.
            notifyZygote();
@@ -703,15 +696,7 @@ public class WebViewUpdateServiceImpl {
        }

        private void notifyZygote() {
            boolean enableMultiprocess = false;

            try {
                enableMultiprocess = Settings.Global.getInt(mResolver,
                        Settings.Global.WEBVIEW_MULTIPROCESS) == 1;
            } catch (Settings.SettingNotFoundException ex) {
            }

            mSystemInterface.setMultiprocessEnabled(enableMultiprocess);
            mSystemInterface.setMultiProcessEnabledFromContext(mContext);
        }
    }
}
+5 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.server.webkit;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.database.ContentObserver;
import android.webkit.WebViewProviderInfo;

import java.util.HashMap;
@@ -115,5 +116,8 @@ public class TestSystemImpl implements SystemInterface {
    }

    @Override
    public void setMultiprocessEnabled(boolean enabled) {}
    public void setMultiProcessEnabledFromContext(Context context) {}

    @Override
    public void registerContentObserver(Context context, ContentObserver contentObserver) {}
}
+83 −29

File changed.

Preview size limit exceeded, changes collapsed.