当前位置: 首页 > news >正文

Android12 user版本默认开启adb调试

做无屏幕设备时,需要设备投屏做调试,这个时候在user版本情况下,插入电脑能够默认开启adb调试模式,不然手动无法操作,不能看,也没有方向按键之类。这个问题怎样解决呢

一问题描述:

user版本下,默认开启adb调试模式,方便客户直接投屏

二方案:

Author: admin 
Date:   Wed Aug 27 09:56:31 2025 +0800user版本,默认开启adb调试Change-Id: I11a11e75c919ff1ea4f57a36497492b3992264f8diff --git a/core/main.mk b/core/main.mk
index 839dc93bf..83869e7a6 100755
--- a/core/main.mk
+++ b/core/main.mk
@@ -377,11 +377,11 @@ enable_target_debugging := truetags_to_install :=ifneq (,$(user_variant))# Target is secure in user builds.
-  ADDITIONAL_SYSTEM_PROPERTIES += ro.secure=1
+  ADDITIONAL_SYSTEM_PROPERTIES += ro.secure=0ADDITIONAL_SYSTEM_PROPERTIES += security.perf_harden=1ifeq ($(user_variant),user)
-    ADDITIONAL_SYSTEM_PROPERTIES += ro.adb.secure=1
+    ADDITIONAL_SYSTEM_PROPERTIES += ro.adb.secure=0endififeq ($(user_variant),userdebug)
diff --git a/tools/post_process_props.py b/tools/post_process_props.py
index efbf614fd..470c7d919 100755
--- a/tools/post_process_props.py
+++ b/tools/post_process_props.py
@@ -30,14 +30,14 @@ PROP_VALUE_MAX = 91
diff --git a/tools/post_process_props.py b/tools/post_process_props.py
index efbf614fd..470c7d919 100755
--- a/tools/post_process_props.py
+++ b/tools/post_process_props.py
@@ -30,14 +30,14 @@ PROP_VALUE_MAX = 91def mangle_build_prop(prop_list):# If ro.debuggable is 1, then enable adb on USB by default# (this is for userdebug builds)
-  if prop_list.get_value("ro.debuggable") == "1":
-    val = prop_list.get_value("persist.sys.usb.config")
-    if "adb" not in val:
-      if val == "":
-        val = "adb"
-      else:
-        val = val + ",adb"
-      prop_list.put("persist.sys.usb.config", val)
+  #if prop_list.get_value("ro.debuggable") == "1":
+  val = prop_list.get_value("persist.sys.usb.config")
+  if "adb" not in val:
+    if val == "":
+      val = "adb"
+    else:
+      val = val + ",adb"
+    prop_list.put("persist.sys.usb.config", val)# UsbDeviceManager expects a value here.  If it doesn't get it, it will# default to "adb". That might not the right policy there, but it's better# to be explicit.

测试在A10 A12测试通过~

http://www.dtcms.com/a/353459.html

相关文章:

  • centos7安装java mysql redis nginx
  • docker 所有常用命令,配上思维导图,加图表显示
  • 713 乘积小于k的子数组
  • Mysql数据挂载
  • Leetcode+Java+动态规划IV
  • electron离线开发环境变量ELECTRON_OVERRIDE_DIST_PATH
  • [MT6835] MT6835开启secureboot导致写入分区提示Security deny for [customer].
  • 【图像算法 - 25】基于深度学习 YOLOv11 与 OpenCV 实现人员跌倒识别系统(人体姿态估计版本)
  • 达梦数据库配置文件-COMPATIBLE_MODE
  • LangChain4j入门一:LangChain4j简介及核心概念
  • 路由基础(一):IP地址规划
  • 基于单片机空调温度控制测温ds18b20系统Proteus仿真(含全部资料)
  • React 组件命名规范:为什么必须大写首字母蛊傲
  • HarmonyOS安全开发实战:一套好用的数据加密方案
  • SQL Server 批量插入脚本
  • 中資券商櫃台系統搭建與開發技術分析
  • AI 大模型 “幻觉” 难题:为何会 “一本正经地说错话”,如何让它更靠谱?
  • 基于Cursor AI IDE的Vue3留言板系统实战:从零搭建到智能优化全流程
  • java数据类型获取长度方式总结
  • 【C++】C++11新特性第一弹(列表初始化、新式声明、范围for和STL中的变化)
  • Flutter 开发技巧 AI 快速构建 json_annotation model 的提示词
  • 使用git上传项目的步骤
  • 煤矸石检测数据集VOC+YOLO格式3090张2类别
  • This method can cause UI unresponsiveness if invoked on the main thread.
  • week5-[字符数组]数和
  • 【技巧】PostgreSQL自动转换类型 int转bool 转int
  • 苍穹外卖项目实战(日记十一)-记录实战教程及问题的解决方法-(day3-3)完善菜品分页查询功能
  • 怎么理解API?
  • 用户体验设计 | 什么是 AX?从 UX 到 AX 的演进
  • 数据结构——算法效率的度量(时间复杂度与空间复杂度)