From 8b5976ec3d2c3314e11ff71c27c530df653455a2 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Wed, 20 Feb 2019 15:41:03 +0000 Subject: [PATCH] Pick up the apexBootImage pinner service files when the boot image is apex.art. Test: adb shell dumpsys pinner Bug: 119800099 Change-Id: I780b65dfba0fc8f7a2807f29fa3a0f7984ae7023 --- core/res/res/values/config.xml | 4 ++++ core/res/res/values/symbols.xml | 1 + .../java/com/android/server/PinnerService.java | 15 ++++++++++++--- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 0ffe2aad5e893..de07b86819c3a 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -3195,6 +3195,10 @@ false + + + + 7 diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 2c14992fdbb41..76791fdef7587 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2904,6 +2904,7 @@ + diff --git a/services/core/java/com/android/server/PinnerService.java b/services/core/java/com/android/server/PinnerService.java index 0deaee7f78782..54a98cedccff9 100644 --- a/services/core/java/com/android/server/PinnerService.java +++ b/services/core/java/com/android/server/PinnerService.java @@ -42,6 +42,7 @@ import android.os.Handler; import android.os.Looper; import android.os.Message; import android.os.RemoteException; +import android.os.SystemProperties; import android.os.UserHandle; import android.os.UserManager; import android.provider.MediaStore; @@ -232,9 +233,17 @@ public final class PinnerService extends SystemService { * Handler for on start pinning message */ private void handlePinOnStart() { - // Files to pin come from the overlay and can be specified per-device config - String[] filesToPin = mContext.getResources().getStringArray( - com.android.internal.R.array.config_defaultPinnerServiceFiles); + final String bootImage = SystemProperties.get("dalvik.vm.boot-image", ""); + String[] filesToPin = null; + if (bootImage.endsWith("apex.art")) { + // Use the files listed for that specific boot image + filesToPin = mContext.getResources().getStringArray( + com.android.internal.R.array.config_apexBootImagePinnerServiceFiles); + } else { + // Files to pin come from the overlay and can be specified per-device config + filesToPin = mContext.getResources().getStringArray( + com.android.internal.R.array.config_defaultPinnerServiceFiles); + } // Continue trying to pin each file even if we fail to pin some of them for (String fileToPin : filesToPin) { PinnedFile pf = pinFile(fileToPin,