Quiet excessive logging of missing lambdas during preload
This patch will change the logging behavior in the Zygote such that lambdas from the preload list that aren't found during Zygote initialization will be counted and a summary provided at the end rather than logging them each individually. These missing lambdas will only be logged for userdebug builds. Test: Compared logs before and after Bug: 163602260 Change-Id: I4cd11d626d7e4f365c55f8458aac20cd442638ed
This commit is contained in:
@@ -86,9 +86,10 @@ import java.security.Security;
|
|||||||
*/
|
*/
|
||||||
public class ZygoteInit {
|
public class ZygoteInit {
|
||||||
|
|
||||||
// TODO (chriswailes): Change this so it is set with Zygote or ZygoteSecondary as appropriate
|
|
||||||
private static final String TAG = "Zygote";
|
private static final String TAG = "Zygote";
|
||||||
|
|
||||||
|
private static final boolean LOGGING_DEBUG = Log.isLoggable(TAG, Log.DEBUG);
|
||||||
|
|
||||||
private static final String PROPERTY_DISABLE_GRAPHICS_DRIVER_PRELOADING =
|
private static final String PROPERTY_DISABLE_GRAPHICS_DRIVER_PRELOADING =
|
||||||
"ro.zygote.disable_gl_preload";
|
"ro.zygote.disable_gl_preload";
|
||||||
|
|
||||||
@@ -284,6 +285,7 @@ public class ZygoteInit {
|
|||||||
new BufferedReader(new InputStreamReader(is), Zygote.SOCKET_BUFFER_SIZE);
|
new BufferedReader(new InputStreamReader(is), Zygote.SOCKET_BUFFER_SIZE);
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
int missingLambdaCount = 0;
|
||||||
String line;
|
String line;
|
||||||
while ((line = br.readLine()) != null) {
|
while ((line = br.readLine()) != null) {
|
||||||
// Skip comments and blank lines.
|
// Skip comments and blank lines.
|
||||||
@@ -302,24 +304,33 @@ public class ZygoteInit {
|
|||||||
Class.forName(line, true, null);
|
Class.forName(line, true, null);
|
||||||
count++;
|
count++;
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
Log.w(TAG, "Class not found for preloading: " + line);
|
if (line.contains("$$Lambda$")) {
|
||||||
|
if (LOGGING_DEBUG) {
|
||||||
|
missingLambdaCount++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Log.w(TAG, "Class not found for preloading: " + line);
|
||||||
|
}
|
||||||
} catch (UnsatisfiedLinkError e) {
|
} catch (UnsatisfiedLinkError e) {
|
||||||
Log.w(TAG, "Problem preloading " + line + ": " + e);
|
Log.w(TAG, "Problem preloading " + line + ": " + e);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
Log.e(TAG, "Error preloading " + line + ".", t);
|
Log.e(TAG, "Error preloading " + line + ".", t);
|
||||||
if (t instanceof Error) {
|
if (t instanceof Error) {
|
||||||
throw (Error) t;
|
throw (Error) t;
|
||||||
}
|
} else if (t instanceof RuntimeException) {
|
||||||
if (t instanceof RuntimeException) {
|
|
||||||
throw (RuntimeException) t;
|
throw (RuntimeException) t;
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException(t);
|
||||||
}
|
}
|
||||||
throw new RuntimeException(t);
|
|
||||||
}
|
}
|
||||||
Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
|
Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.i(TAG, "...preloaded " + count + " classes in "
|
Log.i(TAG, "...preloaded " + count + " classes in "
|
||||||
+ (SystemClock.uptimeMillis() - startTime) + "ms.");
|
+ (SystemClock.uptimeMillis() - startTime) + "ms.");
|
||||||
|
if (LOGGING_DEBUG && missingLambdaCount != 0) {
|
||||||
|
Log.i(TAG, "Unresolved lambda preloads: " + missingLambdaCount);
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG, "Error reading " + PRELOADED_CLASSES + ".", e);
|
Log.e(TAG, "Error reading " + PRELOADED_CLASSES + ".", e);
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user