summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Robert Sesek <rsesek@google.com> 2016-12-02 17:43:56 +0000
committer android-build-merger <android-build-merger@google.com> 2016-12-02 17:43:56 +0000
commite4ddf44967e90cc9fd13ba748def97ef99d06342 (patch)
treeaa6e3cbe8c45f59373997353058d6c905578326b
parentd29d66c7875cb6d375fc755c317ec6e6af977b3f (diff)
parent5c442501764bc509927ef59640214ddac0e9d66b (diff)
Merge "Add new hostingType for startProcessLocked() that selects using the WebViewZygote." am: eda1af611f am: bbcd9d26b1 am: 5806963539
am: 5c44250176 Change-Id: Ia1a819697d7144073f824a98dd8a315eb60c779b
-rw-r--r--core/java/android/webkit/WebViewZygote.java4
-rw-r--r--services/core/java/com/android/server/am/ActiveServices.java8
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java16
3 files changed, 23 insertions, 5 deletions
diff --git a/core/java/android/webkit/WebViewZygote.java b/core/java/android/webkit/WebViewZygote.java
index c2069741d6cd..e0d589a8a8fb 100644
--- a/core/java/android/webkit/WebViewZygote.java
+++ b/core/java/android/webkit/WebViewZygote.java
@@ -53,6 +53,10 @@ public class WebViewZygote {
return sPackage.packageName;
}
+ public static boolean isMultiprocessEnabled() {
+ return sMultiprocessEnabled && sPackage != null;
+ }
+
public static void setMultiprocessEnabled(boolean enabled) {
sMultiprocessEnabled = enabled;
diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java
index 136e02c434d5..7661127927e1 100644
--- a/services/core/java/com/android/server/am/ActiveServices.java
+++ b/services/core/java/com/android/server/am/ActiveServices.java
@@ -75,6 +75,7 @@ import android.util.EventLog;
import android.util.Slog;
import android.util.SparseArray;
import android.util.TimeUtils;
+import android.webkit.WebViewZygote;
public final class ActiveServices {
private static final String TAG = TAG_WITH_CLASS_NAME ? "ActiveServices" : TAG_AM;
@@ -1704,6 +1705,7 @@ public final class ActiveServices {
final boolean isolated = (r.serviceInfo.flags&ServiceInfo.FLAG_ISOLATED_PROCESS) != 0;
final String procName = r.processName;
+ String hostingType = "service";
ProcessRecord app;
if (!isolated) {
@@ -1732,13 +1734,17 @@ public final class ActiveServices {
// in the service any current isolated process it is running in or
// waiting to have come up.
app = r.isolatedProc;
+ if (WebViewZygote.isMultiprocessEnabled()
+ && r.serviceInfo.packageName.equals(WebViewZygote.getPackageName())) {
+ hostingType = "webview_service";
+ }
}
// Not running -- get it started, and enqueue this service record
// to be executed when the app comes up.
if (app == null && !permissionsReviewRequired) {
if ((app=mAm.startProcessLocked(procName, r.appInfo, true, intentFlags,
- "service", r.name, false, isolated, false)) == null) {
+ hostingType, r.name, false, isolated, false)) == null) {
String msg = "Unable to launch app "
+ r.appInfo.packageName + "/"
+ r.appInfo.uid + " for service "
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 229a68b3f46f..c537c4981709 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -3695,10 +3695,18 @@ public class ActivityManagerService extends IActivityManager.Stub
Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "Start proc: " +
app.processName);
checkTime(startTime, "startProcess: asking zygote to start proc");
- Process.ProcessStartResult startResult = Process.start(entryPoint,
- app.processName, uid, uid, gids, debugFlags, mountExternal,
- app.info.targetSdkVersion, app.info.seinfo, requiredAbi, instructionSet,
- app.info.dataDir, entryPointArgs);
+ Process.ProcessStartResult startResult;
+ if (hostingType.equals("webview_service")) {
+ startResult = Process.startWebView(entryPoint,
+ app.processName, uid, uid, gids, debugFlags, mountExternal,
+ app.info.targetSdkVersion, app.info.seinfo, requiredAbi, instructionSet,
+ app.info.dataDir, entryPointArgs);
+ } else {
+ startResult = Process.start(entryPoint,
+ app.processName, uid, uid, gids, debugFlags, mountExternal,
+ app.info.targetSdkVersion, app.info.seinfo, requiredAbi, instructionSet,
+ app.info.dataDir, entryPointArgs);
+ }
checkTime(startTime, "startProcess: returned from zygote!");
Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);