Navigation Menu

Skip to content

Commit

Permalink
liblog: Always report as debuggable when building userdebug/eng
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bgcngm authored and Rashed97 committed Feb 3, 2021
1 parent cb2391d commit 01266f5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions liblog/Android.bp
Expand Up @@ -117,6 +117,11 @@ cc_library {
"-DLIBLOG_LOG_TAG=1006",
"-DSNET_EVENT_LOG_TAG=1397638484",
],
product_variables: {
debuggable: {
cflags: ["-DDEBUGGABLE"],
},
},
logtags: ["event.logtags"],
compile_multilib: "both",
}
Expand Down
4 changes: 4 additions & 0 deletions liblog/properties.cpp
Expand Up @@ -275,6 +275,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";
Expand Down Expand Up @@ -302,6 +305,7 @@ int __android_log_is_debuggable() {
}

return ret;
#endif
}

/*
Expand Down

0 comments on commit 01266f5

Please sign in to comment.