From 5a3163d2eb43279f51d3711fbe2d85f25da69314 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Kongstad?= Date: Wed, 2 Nov 2022 15:11:59 +0100 Subject: [PATCH] OMS: do not hide reason for failing transactions (on non-user builds) To improve security, the reason why an overlay transaction failed is hidden from the caller unless OverlayManagerService.DEBUG is set to true. Tweak the logic to not hide the reason on userdebug and eng builds: this will make it easier to debug tests that fail in CI while keeping the code secure on user builds. Test: manual: make executeAllRequests throw, test via `adb shell cmd overlay enable`, check error message Change-Id: I1c35b9b24a01ea30a50398df9f250ad4e43c0686 Merged-In: I1c35b9b24a01ea30a50398df9f250ad4e43c0686 --- .../core/java/com/android/server/om/OverlayManagerService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/om/OverlayManagerService.java b/services/core/java/com/android/server/om/OverlayManagerService.java index 5544669e1252b..362b26ec762a5 100644 --- a/services/core/java/com/android/server/om/OverlayManagerService.java +++ b/services/core/java/com/android/server/om/OverlayManagerService.java @@ -56,6 +56,7 @@ import android.content.pm.overlay.OverlayPaths; import android.content.res.ApkAssets; import android.net.Uri; import android.os.Binder; +import android.os.Build; import android.os.Environment; import android.os.FabricatedOverlayInternal; import android.os.HandlerThread; @@ -876,7 +877,7 @@ public final class OverlayManagerService extends SystemService { } Slog.d(TAG, "commit failed: " + e.getMessage(), e); throw new SecurityException("commit failed" - + (DEBUG ? ": " + e.getMessage() : "")); + + (DEBUG || Build.IS_DEBUGGABLE ? ": " + e.getMessage() : "")); } } finally { traceEnd(TRACE_TAG_RRO);