summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Martins <bgcngm@gmail.com>2020-04-19 15:14:42 +0100
committerRashed Abdel-Tawab <rashedabdeltawab@gmail.com>2021-02-03 22:27:54 +0100
commit79f606ece6b74652d374eb4f79de309a0aa81360 (patch)
treec1c2a7532839576e10cdcd5e8afe69b1b79b7988
parent0a3ac9b6969b47ac58aaf3b2b27dce1d1c83f4af (diff)
liblog: Always report as debuggable when building userdebug/eng
This doesn't affect the normal behavior of our builds, because ro.debuggable is set to 1 on userdebug/eng anyway. However, it's helpful because making __android_log_is_debuggable return a compile time value rather than the value of runtime prop lets us pass checks that'd otherwise prevent us from using adb root when Magisk is installed. Change-Id: I36f53976162e652a38008ced459ca02fd6c0af51
-rw-r--r--liblog/Android.bp5
-rw-r--r--liblog/properties.cpp4
2 files changed, 9 insertions, 0 deletions
diff --git a/liblog/Android.bp b/liblog/Android.bp
index 6051ac7fa..97ea37dc9 100644
--- a/liblog/Android.bp
+++ b/liblog/Android.bp
@@ -119,6 +119,11 @@ cc_library {
"-DLIBLOG_LOG_TAG=1006",
"-DSNET_EVENT_LOG_TAG=1397638484",
],
+ product_variables: {
+ debuggable: {
+ cflags: ["-DDEBUGGABLE"],
+ },
+ },
logtags: ["event.logtags"],
compile_multilib: "both",
apex_available: [
diff --git a/liblog/properties.cpp b/liblog/properties.cpp
index 37670ecd6..2bcc410ea 100644
--- a/liblog/properties.cpp
+++ b/liblog/properties.cpp
@@ -294,6 +294,9 @@ int __android_log_is_loggable(int prio, const char* tag, int default_prio) {
}
int __android_log_is_debuggable() {
+#ifdef DEBUGGABLE
+ return 1;
+#else
static uint32_t serial;
static struct cache_char tag_cache;
static const char key[] = "ro.debuggable";
@@ -321,6 +324,7 @@ int __android_log_is_debuggable() {
}
return ret;
+#endif
}
/*