Merge "ZygoteInit: warm up JCA providers during preload" am: aa733e0b41 am: ef42102cf8

am: 9d95ab47ff

* commit '9d95ab47ff318ebb30804dce0890b4de414d5844':
  ZygoteInit: warm up JCA providers during preload

Change-Id: I0c987173ffc212581b21958091e288de531e3e97
This commit is contained in:
Sergio Giro
2016-05-17 16:06:43 +00:00
committed by android-build-merger

View File

@@ -240,6 +240,24 @@ public class ZygoteInit {
Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
}
/**
* Warm up the providers that are already registered.
*
* By doing it here we avoid that each app does it when requesting a service from the
* provider for the first time.
*/
private static void warmUpJcaProviders() {
long startTime = SystemClock.uptimeMillis();
Trace.traceBegin(
Trace.TRACE_TAG_DALVIK, "Starting warm up of JCA providers");
for (Provider p : Security.getProviders()) {
p.warmUpServiceProvision();
}
Log.i(TAG, "Warmed up JCA providers in "
+ (SystemClock.uptimeMillis()-startTime) + "ms.");
Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
}
/**
* Performs Zygote process initialization. Loads and initializes
* commonly used classes.