From c8e95b9329d40bd0c35e58dd60185c97d940cebe Mon Sep 17 00:00:00 2001 From: Hans Boehm Date: Wed, 13 Apr 2022 15:12:20 -0700 Subject: 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 --- services/java/com/android/server/SystemServer.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'services/java') diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 8e4afe685372..dc729f23c770 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -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) { -- cgit v1.2.3-59-g8ed1b