Merge changes Ibf4774f7,I6568eea0,I35e83679,I9faf8826,I8ee9d999
* changes: fs_mgr: use __android_log_is_debuggable() adb: use __android_log_is_debuggable() debuggerd: use __android_log_is_debuggable() logd: use __android_log_is_debuggable() libcutils: use __android_log_is_debuggable()
This commit is contained in:
commit
c1f74ca5aa
|
@ -35,7 +35,8 @@
|
|||
#include <scoped_minijail.h>
|
||||
|
||||
#include "debuggerd/client.h"
|
||||
#include "private/android_filesystem_config.h"
|
||||
#include <private/android_filesystem_config.h>
|
||||
#include <private/android_logger.h>
|
||||
#include "selinux/android.h"
|
||||
|
||||
#include "adb.h"
|
||||
|
@ -48,7 +49,7 @@ static const char* root_seclabel = nullptr;
|
|||
|
||||
static void drop_capabilities_bounding_set_if_needed(struct minijail *j) {
|
||||
#if defined(ALLOW_ADBD_ROOT)
|
||||
if (android::base::GetBoolProperty("ro.debuggable", false)) {
|
||||
if (__android_log_is_debuggable()) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -68,7 +69,7 @@ static bool should_drop_privileges() {
|
|||
// ro.secure:
|
||||
// Drop privileges by default. Set to 1 on userdebug and user builds.
|
||||
bool ro_secure = android::base::GetBoolProperty("ro.secure", true);
|
||||
bool ro_debuggable = android::base::GetBoolProperty("ro.debuggable", false);
|
||||
bool ro_debuggable = __android_log_is_debuggable();
|
||||
|
||||
// Drop privileges if ro.secure is set...
|
||||
bool drop = ro_secure;
|
||||
|
|
|
@ -38,8 +38,9 @@
|
|||
#include <cutils/sockets.h>
|
||||
|
||||
#if !ADB_HOST
|
||||
#include "cutils/android_reboot.h"
|
||||
#include <android-base/properties.h>
|
||||
#include <cutils/android_reboot.h>
|
||||
#include <private/android_logger.h>
|
||||
#endif
|
||||
|
||||
#include "adb.h"
|
||||
|
@ -73,7 +74,7 @@ void restart_root_service(int fd, void *cookie) {
|
|||
WriteFdExactly(fd, "adbd is already running as root\n");
|
||||
adb_close(fd);
|
||||
} else {
|
||||
if (!android::base::GetBoolProperty("ro.debuggable", false)) {
|
||||
if (!__android_log_is_debuggable()) {
|
||||
WriteFdExactly(fd, "adbd cannot run as root in production builds\n");
|
||||
adb_close(fd);
|
||||
return;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "android-base/properties.h"
|
||||
#include "android-base/stringprintf.h"
|
||||
#include <private/android_logger.h>
|
||||
|
||||
#include "adb.h"
|
||||
#include "adb_io.h"
|
||||
|
@ -102,8 +103,7 @@ void set_verity_enabled_state_service(int fd, void* cookie) {
|
|||
WriteFdFmt(fd, "verity not enabled - ENG build\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!android::base::GetBoolProperty("ro.debuggable", false)) {
|
||||
if (!__android_log_is_debuggable()) {
|
||||
WriteFdFmt(fd, "verity cannot be disabled/enabled - USER build\n");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
#if !ADB_HOST
|
||||
#include <android-base/properties.h>
|
||||
#include <private/android_logger.h>
|
||||
#endif
|
||||
|
||||
#include "adb.h"
|
||||
|
@ -416,12 +417,7 @@ asocket* create_local_service_socket(const char* name, const atransport* transpo
|
|||
D("LS(%d): bound to '%s' via %d", s->id, name, fd);
|
||||
|
||||
#if !ADB_HOST
|
||||
bool debuggable = false;
|
||||
if (!strncmp(name, "root:", 5)) {
|
||||
debuggable = android::base::GetBoolProperty("ro.debuggable", false);
|
||||
}
|
||||
|
||||
if ((!strncmp(name, "root:", 5) && getuid() != 0 && debuggable) ||
|
||||
if ((!strncmp(name, "root:", 5) && getuid() != 0 && __android_log_is_debuggable()) ||
|
||||
(!strncmp(name, "unroot:", 7) && getuid() == 0) ||
|
||||
!strncmp(name, "usb:", 4) ||
|
||||
!strncmp(name, "tcpip:", 6)) {
|
||||
|
|
|
@ -120,6 +120,7 @@ debuggerd_shared_libraries := \
|
|||
libbacktrace \
|
||||
libbase \
|
||||
libcutils \
|
||||
liblog
|
||||
|
||||
debuggerd_c_includes := \
|
||||
$(LOCAL_PATH)/test \
|
||||
|
|
|
@ -32,13 +32,13 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <android-base/stringprintf.h>
|
||||
#include <backtrace/Backtrace.h>
|
||||
#include <backtrace/BacktraceMap.h>
|
||||
#include <cutils/properties.h>
|
||||
#include <log/logprint.h>
|
||||
#include <private/android_filesystem_config.h>
|
||||
#include <private/android_logger.h>
|
||||
|
||||
#include <selinux/android.h>
|
||||
|
||||
|
@ -622,9 +622,7 @@ static void dump_logs(log_t* log, pid_t pid, unsigned int tail) {
|
|||
static void dump_crash(log_t* log, BacktraceMap* map, pid_t pid, pid_t tid,
|
||||
const std::set<pid_t>& siblings, uintptr_t abort_msg_address) {
|
||||
// don't copy log messages to tombstone unless this is a dev device
|
||||
char value[PROPERTY_VALUE_MAX];
|
||||
property_get("ro.debuggable", value, "0");
|
||||
bool want_logs = (value[0] == '1');
|
||||
bool want_logs = __android_log_is_debuggable();
|
||||
|
||||
_LOG(log, logtype::HEADER,
|
||||
"*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***\n");
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include <linux/loop.h>
|
||||
#include <logwrap/logwrap.h>
|
||||
#include <private/android_filesystem_config.h>
|
||||
#include <private/android_logger.h>
|
||||
|
||||
#include "fs_mgr_priv.h"
|
||||
#include "fs_mgr_priv_verity.h"
|
||||
|
@ -260,15 +261,6 @@ static int fs_match(char *in1, char *in2)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int device_is_debuggable() {
|
||||
int ret = -1;
|
||||
char value[PROP_VALUE_MAX];
|
||||
ret = __system_property_get("ro.debuggable", value);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
return strcmp(value, "1") ? 0 : 1;
|
||||
}
|
||||
|
||||
static int device_is_secure() {
|
||||
int ret = -1;
|
||||
char value[PROP_VALUE_MAX];
|
||||
|
@ -537,7 +529,7 @@ int fs_mgr_mount_all(struct fstab *fstab, int mount_mode)
|
|||
|
||||
if ((fstab->recs[i].fs_mgr_flags & MF_VERIFY) && device_is_secure()) {
|
||||
int rc = fs_mgr_setup_verity(&fstab->recs[i]);
|
||||
if (device_is_debuggable() && rc == FS_MGR_SETUP_VERITY_DISABLED) {
|
||||
if (__android_log_is_debuggable() && rc == FS_MGR_SETUP_VERITY_DISABLED) {
|
||||
INFO("Verity disabled");
|
||||
} else if (rc != FS_MGR_SETUP_VERITY_SUCCESS) {
|
||||
ERROR("Could not set up verified partition, skipping!\n");
|
||||
|
@ -699,7 +691,7 @@ int fs_mgr_do_mount(struct fstab *fstab, char *n_name, char *n_blk_device,
|
|||
|
||||
if ((fstab->recs[i].fs_mgr_flags & MF_VERIFY) && device_is_secure()) {
|
||||
int rc = fs_mgr_setup_verity(&fstab->recs[i]);
|
||||
if (device_is_debuggable() && rc == FS_MGR_SETUP_VERITY_DISABLED) {
|
||||
if (__android_log_is_debuggable() && rc == FS_MGR_SETUP_VERITY_DISABLED) {
|
||||
INFO("Verity disabled");
|
||||
} else if (rc != FS_MGR_SETUP_VERITY_SUCCESS) {
|
||||
ERROR("Could not set up verified partition, skipping!\n");
|
||||
|
@ -903,7 +895,7 @@ int fs_mgr_early_setup_verity(struct fstab_rec *fstab_rec)
|
|||
{
|
||||
if ((fstab_rec->fs_mgr_flags & MF_VERIFY) && device_is_secure()) {
|
||||
int rc = fs_mgr_setup_verity(fstab_rec);
|
||||
if (device_is_debuggable() && rc == FS_MGR_SETUP_VERITY_DISABLED) {
|
||||
if (__android_log_is_debuggable() && rc == FS_MGR_SETUP_VERITY_DISABLED) {
|
||||
INFO("Verity disabled");
|
||||
return FS_MGR_EARLY_SETUP_VERITY_NO_VERITY;
|
||||
} else if (rc == FS_MGR_SETUP_VERITY_SUCCESS) {
|
||||
|
|
|
@ -26,10 +26,10 @@
|
|||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <android/log.h>
|
||||
#include <cutils/compiler.h>
|
||||
#include <cutils/properties.h>
|
||||
#include <cutils/trace.h>
|
||||
#include <private/android_logger.h>
|
||||
|
||||
/**
|
||||
* Maximum size of a message that can be logged to the trace buffer.
|
||||
|
@ -86,16 +86,9 @@ static bool atrace_is_cmdline_match(const char* cmdline)
|
|||
// Determine whether application-level tracing is enabled for this process.
|
||||
static bool atrace_is_app_tracing_enabled()
|
||||
{
|
||||
bool sys_debuggable = false;
|
||||
char value[PROPERTY_VALUE_MAX];
|
||||
bool sys_debuggable = __android_log_is_debuggable();
|
||||
bool result = false;
|
||||
|
||||
// Check whether the system is debuggable.
|
||||
property_get("ro.debuggable", value, "0");
|
||||
if (value[0] == '1') {
|
||||
sys_debuggable = true;
|
||||
}
|
||||
|
||||
if (sys_debuggable || atrace_is_debuggable) {
|
||||
// Check whether tracing is enabled for this process.
|
||||
FILE * file = fopen("/proc/self/cmdline", "re");
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include <log/event_tag_map.h>
|
||||
#include <packagelistparser/packagelistparser.h>
|
||||
#include <private/android_filesystem_config.h>
|
||||
#include <private/android_logger.h>
|
||||
#include <scoped_minijail.h>
|
||||
#include <utils/threads.h>
|
||||
|
||||
|
@ -174,11 +175,8 @@ bool property_get_bool(const char *key, int flag) {
|
|||
BOOL_DEFAULT_FALSE)) {
|
||||
return false;
|
||||
}
|
||||
if (flag & BOOL_DEFAULT_FLAG_ENG) {
|
||||
property_get("ro.debuggable", property, "");
|
||||
if (strcmp(property, "1")) {
|
||||
return false;
|
||||
}
|
||||
if ((flag & BOOL_DEFAULT_FLAG_ENG) && !__android_log_is_debuggable()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (flag & BOOL_DEFAULT_FLAG_TRUE_FALSE) != BOOL_DEFAULT_FALSE;
|
||||
|
|
Loading…
Reference in New Issue