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
This commit is contained in:
Keun-young Park
2017-01-27 11:30:19 -08:00
parent 45250aca6d
commit d80e894b3b

View File

@@ -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");