欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Android 11 usb调试默认打开

程序员文章站 2022-06-24 19:02:06
一. 修改ro.debuggable 默认值build\make\core\main.mkifeq (true,$(strip $(enable_target_debugging))) # Target is more debuggable and adbd is on by default #ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1 # Enable Dalvik lock contention logging. ADDITI......

一. 修改ro.debuggable 默认值

build\make\core\main.mk

ifeq (true,$(strip $(enable_target_debugging)))
  # Target is more debuggable and adbd is on by default
  #ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1
  # Enable Dalvik lock contention logging.
  ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.lockprof.threshold=500
else # !enable_target_debugging
  # Target is less debuggable and adbd is off by default
 # ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=0

ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1
endif # !enable_target_debugging
## eng ##

二. 修改授权框(默认不弹出, 设置允许)

system\core\adb\daemon\main.cpp

int adbd_main(int server_port) 

//根据宏控制配置是否默认允许

if (android::base::GetBoolProperty("xxx.xxx.usb_def_debuger", true)) {
        auth_required = false;
    } 

三. 解决  打开"开发者选项" 崩溃

avc: denied { read } for 
name="u:object_r:logpersistd_logging_prop:s0" 
dev="tmpfs" 
ino=7775 
scontext=u:r:system_app:s0 
tcontext=u:object_r:logpersistd_logging_prop:s0 
tclass=file 
permissive=0

修改权限

system\sepolicy\prebuilts\api\30.0\private\system_app.te

set_prop(system_app, log_tag_prop)
# add fix bug Settings development fatal
set_prop(system_app, logpersistd_logging_prop)

userdebug_or_eng(`set_prop(system_app, logpersistd_logging_prop)')

system\sepolicy\private\system_app.te

set_prop(system_app, log_tag_prop)
# add fix bug Settings development fatal
set_prop(system_app, logpersistd_logging_prop)

userdebug_or_eng(`set_prop(system_app, logpersistd_logging_prop)')

本文地址:https://blog.csdn.net/whatareyou123/article/details/110233866

相关标签: Android 11 android