From e5e38431766150b975605997c293550e8029b108 Mon Sep 17 00:00:00 2001 From: Remi NGUYEN VAN Date: Wed, 12 Aug 2020 14:48:26 +0900 Subject: [PATCH] Add Build.IS_DEBUGGABLE to public API For testing purposes, system components such as mainline modules may need to relax some security restrictions on debuggable builds only, in cases where there is no testing strategy that would be reasonable on user builds security-wise. One example is to test interfaces between a mainline module and the rest of the system, which typically require very privileged permissions. There is no particular reason or permission check to keep the symbol non-public so add it to the public API. Test: m Fixes: 163699557 Change-Id: I15c093af04f024eed5567151b241a4bc35c611d4 --- core/api/current.txt | 1 + core/java/android/os/Build.java | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/core/api/current.txt b/core/api/current.txt index c4bd134c40c42..20bade6fd68d5 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -29237,6 +29237,7 @@ package android.os { field public static final String HARDWARE; field public static final String HOST; field public static final String ID; + field public static final boolean IS_DEBUGGABLE; field public static final String MANUFACTURER; field public static final String MODEL; field @NonNull public static final String ODM_SKU; diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java index 5ae53b502330f..d7d3e58812198 100755 --- a/core/java/android/os/Build.java +++ b/core/java/android/os/Build.java @@ -1287,10 +1287,12 @@ public class Build { public static final String HOST = getString("ro.build.host"); /** - * Returns true if we are running a debug build such as "user-debug" or "eng". - * @hide + * Returns true if the device is running a debuggable build such as "userdebug" or "eng". + * + * Debuggable builds allow users to gain root access via local shell, attach debuggers to any + * application regardless of whether they have the "debuggable" attribute set, or downgrade + * selinux into "permissive" mode in particular. */ - @UnsupportedAppUsage public static final boolean IS_DEBUGGABLE = SystemProperties.getInt("ro.debuggable", 0) == 1;