Don't preload into nonexistent zygote

We tried to access the first entry of Build.SUPPORTED_32_BIT_ABIS
even when there where none, causing an out of bounds array access.
The resulting exception was handled correctly, so this only
speeds things up a little and avoids log spam.

Bug: 228390898
Test: Build and boot master, Treehugger
Change-Id: I5827c6991065dd50d3f6e797930a9e6b7616de6e
This commit is contained in:
Hans Boehm
2022-04-13 15:12:20 -07:00
parent 70c3d35319
commit c8e95b9329

View File

@@ -1382,8 +1382,9 @@ public final class SystemServer implements Dumpable {
Slog.i(TAG, SECONDARY_ZYGOTE_PRELOAD);
TimingsTraceAndSlog traceLog = TimingsTraceAndSlog.newAsyncLog();
traceLog.traceBegin(SECONDARY_ZYGOTE_PRELOAD);
if (!Process.ZYGOTE_PROCESS.preloadDefault(Build.SUPPORTED_32_BIT_ABIS[0])) {
Slog.e(TAG, "Unable to preload default resources");
String[] abis32 = Build.SUPPORTED_32_BIT_ABIS;
if (abis32.length > 0 && !Process.ZYGOTE_PROCESS.preloadDefault(abis32[0])) {
Slog.e(TAG, "Unable to preload default resources for secondary");
}
traceLog.traceEnd();
} catch (Exception ex) {