diff options
author | Torne (Richard Coles) <torne@google.com> | 2014-05-08 16:07:05 +0100 |
---|---|---|
committer | Torne (Richard Coles) <torne@google.com> | 2014-07-17 09:18:43 -0700 |
commit | 08cfaf672604422dd355d6703aec78f3aa5ee74e (patch) | |
tree | 0b295c181e5ba8cf6b69f431e97a17bcb3d0dabd /services | |
parent | b5de924fad4f9dcd4d8137c0e6a17a41c32bc22a (diff) | |
download | frameworks_base-08cfaf672604422dd355d6703aec78f3aa5ee74e.zip frameworks_base-08cfaf672604422dd355d6703aec78f3aa5ee74e.tar.gz frameworks_base-08cfaf672604422dd355d6703aec78f3aa5ee74e.tar.bz2 |
Use the WebView's loader library to load the real library.
Load libwebviewchromiumloader and use it to load the real WebView
library, to enable sharing of the relro segment between different
application processes without requiring that the library be preloaded in
the zygote. A system service is added to track whether the relro segment
file has been prepared, and block loading of the library until it has
been.
Bug: 13005501
Change-Id: I846b37c7b8e2a4eb8a39e4fd455bccbb2048c173
Diffstat (limited to 'services')
-rw-r--r-- | services/core/java/com/android/server/webkit/WebViewUpdateService.java | 78 | ||||
-rw-r--r-- | services/java/com/android/server/SystemServer.java | 8 |
2 files changed, 86 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/webkit/WebViewUpdateService.java b/services/core/java/com/android/server/webkit/WebViewUpdateService.java new file mode 100644 index 0000000..e8ae97c --- /dev/null +++ b/services/core/java/com/android/server/webkit/WebViewUpdateService.java @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.webkit; + +import android.os.Binder; +import android.os.Process; +import android.util.Log; +import android.webkit.IWebViewUpdateService; + +/** + * Private service to wait for the updatable WebView to be ready for use. + * @hide + */ +public class WebViewUpdateService extends IWebViewUpdateService.Stub { + + private static final String TAG = "WebViewUpdateService"; + + private boolean mRelroReady32Bit = false; + private boolean mRelroReady64Bit = false; + + public WebViewUpdateService() { + } + + /** + * The shared relro process calls this to notify us that it's done trying to create a relro + * file. + */ + public void notifyRelroCreationCompleted(boolean is64Bit, boolean success) { + // Verify that the caller is the shared relro process. + if (Binder.getCallingUid() != Process.SHARED_RELRO_UID) { + return; + } + + synchronized (this) { + if (is64Bit) { + mRelroReady64Bit = true; + } else { + mRelroReady32Bit = true; + } + this.notifyAll(); + } + } + + /** + * WebViewFactory calls this to block WebView loading until the relro file is created. + */ + public void waitForRelroCreationCompleted(boolean is64Bit) { + synchronized (this) { + if (is64Bit) { + while (!mRelroReady64Bit) { + try { + this.wait(); + } catch (InterruptedException e) {} + } + } else { + while (!mRelroReady32Bit) { + try { + this.wait(); + } catch (InterruptedException e) {} + } + } + } + } +} diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 8d38827..a6030cf 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -49,6 +49,7 @@ import android.util.EventLog; import android.util.Log; import android.util.Slog; import android.view.WindowManager; +import android.webkit.WebViewFactory; import com.android.internal.R; import com.android.internal.os.BinderInternal; @@ -91,6 +92,7 @@ import com.android.server.tv.TvInputManagerService; import com.android.server.twilight.TwilightService; import com.android.server.usb.UsbService; import com.android.server.wallpaper.WallpaperManagerService; +import com.android.server.webkit.WebViewUpdateService; import com.android.server.wm.WindowManagerService; import dalvik.system.VMRuntime; @@ -408,6 +410,12 @@ public final class SystemServer { Slog.i(TAG, "Reading configuration..."); SystemConfig.getInstance(); + Slog.i(TAG, "WebView Update Service"); + ServiceManager.addService("webviewupdate", new WebViewUpdateService()); + + Slog.i(TAG, "WebViewFactory preparation"); + WebViewFactory.prepareWebViewInSystemServer(); + Slog.i(TAG, "Scheduling Policy"); ServiceManager.addService("scheduling_policy", new SchedulingPolicyService()); |