Loading services/core/java/com/android/server/webkit/SystemImpl.java +16 −2 Original line number Original line Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.UserInfo; import android.content.pm.UserInfo; import android.content.res.XmlResourceParser; import android.content.res.XmlResourceParser; import android.database.ContentObserver; import android.os.Build; import android.os.Build; import android.os.RemoteException; import android.os.RemoteException; import android.os.UserHandle; import android.os.UserHandle; Loading Loading @@ -270,8 +271,21 @@ public class SystemImpl implements SystemInterface { } } @Override @Override public void setMultiprocessEnabled(boolean enabled) { public void setMultiProcessEnabledFromContext(Context context) { WebViewZygote.setMultiprocessEnabled(enabled); 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 // flags declaring we want extra info from the package manager for webview providers Loading services/core/java/com/android/server/webkit/SystemInterface.java +3 −1 Original line number Original line Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.server.webkit; import android.content.Context; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.PackageManager.NameNotFoundException; import android.database.ContentObserver; import android.webkit.WebViewProviderInfo; import android.webkit.WebViewProviderInfo; /** /** Loading Loading @@ -49,5 +50,6 @@ public interface SystemInterface { public PackageInfo getPackageInfoForProvider(WebViewProviderInfo configInfo) public PackageInfo getPackageInfoForProvider(WebViewProviderInfo configInfo) throws NameNotFoundException; throws NameNotFoundException; public void setMultiprocessEnabled(boolean enabled); public void setMultiProcessEnabledFromContext(Context context); public void registerContentObserver(Context context, ContentObserver contentObserver); } } services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl.java +3 −18 Original line number Original line Diff line number Diff line Loading @@ -20,12 +20,10 @@ import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.Signature; import android.content.pm.Signature; import android.content.ContentResolver; import android.database.ContentObserver; import android.database.ContentObserver; import android.net.Uri; import android.net.Uri; import android.os.Handler; import android.os.Handler; import android.os.UserHandle; import android.os.UserHandle; import android.provider.Settings; import android.util.Base64; import android.util.Base64; import android.util.Slog; import android.util.Slog; import android.webkit.WebViewFactory; import android.webkit.WebViewFactory; Loading Loading @@ -79,7 +77,7 @@ public class WebViewUpdateServiceImpl { private SystemInterface mSystemInterface; private SystemInterface mSystemInterface; private WebViewUpdater mWebViewUpdater; private WebViewUpdater mWebViewUpdater; private SettingsObserver mSettingsObserver; private SettingsObserver mSettingsObserver; private Context mContext; final private Context mContext; public WebViewUpdateServiceImpl(Context context, SystemInterface systemInterface) { public WebViewUpdateServiceImpl(Context context, SystemInterface systemInterface) { mContext = context; mContext = context; Loading Loading @@ -725,15 +723,10 @@ public class WebViewUpdateServiceImpl { * appropriately. * appropriately. */ */ private class SettingsObserver extends ContentObserver { private class SettingsObserver extends ContentObserver { private final ContentResolver mResolver; SettingsObserver() { SettingsObserver() { super(new Handler()); super(new Handler()); mResolver = mContext.getContentResolver(); mSystemInterface.registerContentObserver(mContext, this); mResolver.registerContentObserver( Settings.Global.getUriFor(Settings.Global.WEBVIEW_MULTIPROCESS), false, this); // Push the current value of the setting immediately. // Push the current value of the setting immediately. notifyZygote(); notifyZygote(); Loading @@ -745,15 +738,7 @@ public class WebViewUpdateServiceImpl { } } private void notifyZygote() { private void notifyZygote() { boolean enableMultiprocess = false; mSystemInterface.setMultiProcessEnabledFromContext(mContext); try { enableMultiprocess = Settings.Global.getInt(mResolver, Settings.Global.WEBVIEW_MULTIPROCESS) == 1; } catch (Settings.SettingNotFoundException ex) { } mSystemInterface.setMultiprocessEnabled(enableMultiprocess); } } } } } } services/tests/servicestests/src/com/android/server/webkit/TestSystemImpl.java +5 −1 Original line number Original line Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.server.webkit; import android.content.Context; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.PackageManager.NameNotFoundException; import android.database.ContentObserver; import android.webkit.WebViewProviderInfo; import android.webkit.WebViewProviderInfo; import java.util.HashMap; import java.util.HashMap; Loading Loading @@ -120,5 +121,8 @@ public class TestSystemImpl implements SystemInterface { } } @Override @Override public void setMultiprocessEnabled(boolean enabled) {} public void setMultiProcessEnabledFromContext(Context context) {} @Override public void registerContentObserver(Context context, ContentObserver contentObserver) {} } } services/tests/servicestests/src/com/android/server/webkit/WebViewUpdateServiceTest.java +93 −31 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
services/core/java/com/android/server/webkit/SystemImpl.java +16 −2 Original line number Original line Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.UserInfo; import android.content.pm.UserInfo; import android.content.res.XmlResourceParser; import android.content.res.XmlResourceParser; import android.database.ContentObserver; import android.os.Build; import android.os.Build; import android.os.RemoteException; import android.os.RemoteException; import android.os.UserHandle; import android.os.UserHandle; Loading Loading @@ -270,8 +271,21 @@ public class SystemImpl implements SystemInterface { } } @Override @Override public void setMultiprocessEnabled(boolean enabled) { public void setMultiProcessEnabledFromContext(Context context) { WebViewZygote.setMultiprocessEnabled(enabled); 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 // flags declaring we want extra info from the package manager for webview providers Loading
services/core/java/com/android/server/webkit/SystemInterface.java +3 −1 Original line number Original line Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.server.webkit; import android.content.Context; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.PackageManager.NameNotFoundException; import android.database.ContentObserver; import android.webkit.WebViewProviderInfo; import android.webkit.WebViewProviderInfo; /** /** Loading Loading @@ -49,5 +50,6 @@ public interface SystemInterface { public PackageInfo getPackageInfoForProvider(WebViewProviderInfo configInfo) public PackageInfo getPackageInfoForProvider(WebViewProviderInfo configInfo) throws NameNotFoundException; throws NameNotFoundException; public void setMultiprocessEnabled(boolean enabled); public void setMultiProcessEnabledFromContext(Context context); public void registerContentObserver(Context context, ContentObserver contentObserver); } }
services/core/java/com/android/server/webkit/WebViewUpdateServiceImpl.java +3 −18 Original line number Original line Diff line number Diff line Loading @@ -20,12 +20,10 @@ import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.Signature; import android.content.pm.Signature; import android.content.ContentResolver; import android.database.ContentObserver; import android.database.ContentObserver; import android.net.Uri; import android.net.Uri; import android.os.Handler; import android.os.Handler; import android.os.UserHandle; import android.os.UserHandle; import android.provider.Settings; import android.util.Base64; import android.util.Base64; import android.util.Slog; import android.util.Slog; import android.webkit.WebViewFactory; import android.webkit.WebViewFactory; Loading Loading @@ -79,7 +77,7 @@ public class WebViewUpdateServiceImpl { private SystemInterface mSystemInterface; private SystemInterface mSystemInterface; private WebViewUpdater mWebViewUpdater; private WebViewUpdater mWebViewUpdater; private SettingsObserver mSettingsObserver; private SettingsObserver mSettingsObserver; private Context mContext; final private Context mContext; public WebViewUpdateServiceImpl(Context context, SystemInterface systemInterface) { public WebViewUpdateServiceImpl(Context context, SystemInterface systemInterface) { mContext = context; mContext = context; Loading Loading @@ -725,15 +723,10 @@ public class WebViewUpdateServiceImpl { * appropriately. * appropriately. */ */ private class SettingsObserver extends ContentObserver { private class SettingsObserver extends ContentObserver { private final ContentResolver mResolver; SettingsObserver() { SettingsObserver() { super(new Handler()); super(new Handler()); mResolver = mContext.getContentResolver(); mSystemInterface.registerContentObserver(mContext, this); mResolver.registerContentObserver( Settings.Global.getUriFor(Settings.Global.WEBVIEW_MULTIPROCESS), false, this); // Push the current value of the setting immediately. // Push the current value of the setting immediately. notifyZygote(); notifyZygote(); Loading @@ -745,15 +738,7 @@ public class WebViewUpdateServiceImpl { } } private void notifyZygote() { private void notifyZygote() { boolean enableMultiprocess = false; mSystemInterface.setMultiProcessEnabledFromContext(mContext); try { enableMultiprocess = Settings.Global.getInt(mResolver, Settings.Global.WEBVIEW_MULTIPROCESS) == 1; } catch (Settings.SettingNotFoundException ex) { } mSystemInterface.setMultiprocessEnabled(enableMultiprocess); } } } } } }
services/tests/servicestests/src/com/android/server/webkit/TestSystemImpl.java +5 −1 Original line number Original line Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.server.webkit; import android.content.Context; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.PackageManager.NameNotFoundException; import android.database.ContentObserver; import android.webkit.WebViewProviderInfo; import android.webkit.WebViewProviderInfo; import java.util.HashMap; import java.util.HashMap; Loading Loading @@ -120,5 +121,8 @@ public class TestSystemImpl implements SystemInterface { } } @Override @Override public void setMultiprocessEnabled(boolean enabled) {} public void setMultiProcessEnabledFromContext(Context context) {} @Override public void registerContentObserver(Context context, ContentObserver contentObserver) {} } }
services/tests/servicestests/src/com/android/server/webkit/WebViewUpdateServiceTest.java +93 −31 File changed.Preview size limit exceeded, changes collapsed. Show changes