diff options
| author | 2017-01-27 11:30:19 -0800 | |
|---|---|---|
| committer | 2017-01-31 14:25:50 -0800 | |
| commit | d80e894b3b7d237c97de1124401caeafc8763afd (patch) | |
| tree | bc75933c6e5efcacdb0f2b9684c30a970af3d22e | |
| parent | 45250aca6d55988a58fdcb4ba0e8a58d36b1f34b (diff) | |
run webview preparation in separate thread
- There is no other dependency for webview from system server.
Prepare it in separate thread and confirm completion
before allowing 3rd party apps.
bug: 33840151
Test: manual, reboot
Change-Id: I417b0451c37f663c577295ab07f33474e72fe457
| -rw-r--r-- | services/java/com/android/server/SystemServer.java | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 70b0bf2e961b..b911d2d230cb 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -55,6 +55,7 @@ import com.android.internal.logging.MetricsLogger; import com.android.internal.os.BinderInternal; import com.android.internal.os.SamplingProfilerIntegration; import com.android.internal.policy.EmergencyAffordanceManager; +import com.android.internal.util.ConcurrentUtils; import com.android.internal.widget.ILockSettings; import com.android.server.accessibility.AccessibilityManagerService; import com.android.server.am.ActivityManagerService; @@ -117,6 +118,7 @@ import java.util.Locale; import java.util.Timer; import java.util.TimerTask; import java.util.concurrent.CountDownLatch; +import java.util.concurrent.Future; import static android.view.Display.DEFAULT_DISPLAY; @@ -1580,11 +1582,19 @@ public final class SystemServer { } traceEnd(); + // No dependency on Webview preparation in system server. But this should + // be completed before allowring 3rd party + final String WEBVIEW_PREPARATION = "WebViewFactoryPreparation"; + Future<?> webviewPrep = null; if (!mOnlyCore) { - Slog.i(TAG, "WebViewFactory preparation"); - traceBeginAndSlog("WebViewFactoryPreparation"); - mWebViewUpdateService.prepareWebViewInSystemServer(); - traceEnd(); + webviewPrep = SystemServerInitThreadPool.get().submit(() -> { + Slog.i(TAG, WEBVIEW_PREPARATION); + BootTimingsTraceLog traceLog = new BootTimingsTraceLog( + "SystemServerTiming", Trace.TRACE_TAG_SYSTEM_SERVER); + traceLog.traceBegin(WEBVIEW_PREPARATION); + mWebViewUpdateService.prepareWebViewInSystemServer(); + traceLog.traceEnd(); + }, WEBVIEW_PREPARATION); } traceBeginAndSlog("StartSystemUI"); @@ -1641,6 +1651,10 @@ public final class SystemServer { Watchdog.getInstance().start(); traceEnd(); + if (webviewPrep != null) { + ConcurrentUtils.waitForFutureNoInterrupt(webviewPrep, WEBVIEW_PREPARATION); + } + // It is now okay to let the various system services start their // third party code... traceBeginAndSlog("PhaseThirdPartyAppsCanStart"); |