diff options
| author | 2021-04-09 00:19:19 +0000 | |
|---|---|---|
| committer | 2021-04-09 00:19:19 +0000 | |
| commit | ba77876dbd4d354c1f86137eb6111fb9e1af3df7 (patch) | |
| tree | 01ac328b01c12d3ace4a7abb46e87750e0fb49cd | |
| parent | 13d7d5cde68754fd0fb1d7746715cfc4a7563613 (diff) | |
| parent | b5f095ebf0a5f47d861de4cdf607dc77ab05a581 (diff) | |
Merge "Replace IS_DEBUGGABLE with isDebuggable module API"
| -rw-r--r-- | core/api/current.txt | 1 | ||||
| -rw-r--r-- | core/api/module-lib-current.txt | 4 | ||||
| -rw-r--r-- | core/api/test-current.txt | 1 | ||||
| -rwxr-xr-x | core/java/android/os/Build.java | 15 | ||||
| -rw-r--r-- | services/core/java/com/android/server/ConnectivityService.java | 2 |
5 files changed, 21 insertions, 2 deletions
diff --git a/core/api/current.txt b/core/api/current.txt index 5a2b8bdd3c0a..cc425f01b926 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -29284,7 +29284,6 @@ 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/api/module-lib-current.txt b/core/api/module-lib-current.txt index e9dba8ee3485..e7a7fd2ea7a1 100644 --- a/core/api/module-lib-current.txt +++ b/core/api/module-lib-current.txt @@ -117,6 +117,10 @@ package android.os { method public final void markVintfStability(); } + public class Build { + method public static boolean isDebuggable(); + } + public static class Build.VERSION { field public static final int FIRST_SDK_INT; } diff --git a/core/api/test-current.txt b/core/api/test-current.txt index 0c57f4e3b557..f7b101d56c27 100644 --- a/core/api/test-current.txt +++ b/core/api/test-current.txt @@ -1022,6 +1022,7 @@ package android.os { public class Build { method public static boolean is64BitAbi(String); + method public static boolean isDebuggable(); field public static final boolean IS_EMULATOR; } diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java index 03caafda2b13..e47ffcc4ff4c 100755 --- a/core/java/android/os/Build.java +++ b/core/java/android/os/Build.java @@ -1309,10 +1309,25 @@ public class Build { * 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. + * @hide */ public static final boolean IS_DEBUGGABLE = SystemProperties.getInt("ro.debuggable", 0) == 1; + /** + * 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. + * @hide + */ + @TestApi + @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) + public static boolean isDebuggable() { + return IS_DEBUGGABLE; + } + /** {@hide} */ public static final boolean IS_ENG = "eng".equals(TYPE); /** {@hide} */ diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index 5aa3e5be2ae9..30667177efc7 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -7677,7 +7677,7 @@ public class ConnectivityService extends IConnectivityManager.Stub } void addRequestReassignment(@NonNull final RequestReassignment reassignment) { - if (Build.IS_DEBUGGABLE) { + if (Build.isDebuggable()) { // The code is never supposed to add two reassignments of the same request. Make // sure this stays true, but without imposing this expensive check on all // reassignments on all user devices. |