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

Android 13 使能user版本进recovery

在 debug 版本上,可以在关机状态下,同时按 电源键 和 音量加键 进 recovery 。

user 版本上不行。

参考 使用 build 变体
debug 版本和 user 版本的差别之一就是 ro.debuggable 属性不同。
在这里插入图片描述

顺着这个思路追踪,找到 bootable/recovery/recovery.cpp

添加如下修改即可,

--- a/bootable/recovery/recovery.cpp
+++ b/bootable/recovery/recovery.cpp
@@ -130,6 +130,10 @@ static bool IsRoDebuggable() {return android::base::GetBoolProperty("ro.debuggable", false);}+// refer to device.mk , we have set user.enable.recovery=true
+static bool IsUserEnableRecovery() {
+  return android::base::GetBoolProperty("user.enable.recovery", false);
+}// Clear the recovery command and prepare to boot a (hopefully working) system,// copy our log file to cache as well (for the system to read). This function is
@@ -1272,7 +1276,7 @@ Device::BuiltinAction start_recovery(Device* device, const std::vector<std::stri// If this is an eng or userdebug build, then automatically// turn the text display on if the script fails so the error// message is visible.
-        if (IsRoDebuggable()) {
+        if (IsRoDebuggable() || IsUserEnableRecovery()) {ui->ShowText(true);}}else{
@@ -1389,7 +1393,7 @@ Device::BuiltinAction start_recovery(Device* device, const std::vector<std::stri// If this is an eng or userdebug build, automatically turn on the text display if no command// is specified. Note that this should be called before setting the background to avoid// flickering the background image.
-        if (IsRoDebuggable()) {
+        if (IsRoDebuggable() || IsUserEnableRecovery()) {ui->ShowText(true);}status = INSTALL_NONE;  // No command specified

为了不同 device 可复用,根据属性判断,如果其他客户也需要,在对应的 device.mk 里加上该属性就行。

http://www.xdnf.cn/news/5093.html

相关文章:

  • 激活函数(sigmoid、Tanh、ReLu、softmax、softmin、LogSoftma)公式,作用,使用场景和python代码(包含示例)详解
  • 游戏引擎学习第268天:合并调试链表与分组
  • STM32中断
  • 数据集-目标检测系列- 烟雾 检测数据集 smoke >> DataBall
  • 逐步理解Qt信号与槽机制
  • 【部署满血Deepseek-R1/V3】大型语言模型部署实战:多机多卡DeepSeek-R1配置指南
  • Web3 实战项目项目部署到 GitHub 和上线预览的完整指南
  • django的权限角色管理(RBAC)
  • PyTorch API 4 - 分布式通信、分布式张量
  • 【递归、搜索和回溯】二叉树中的深搜
  • Docker中运行的Chrome崩溃问题解决
  • leetcode-hot-100(哈希)
  • 产品需求分析:需求收集方法(锻造产品内核)
  • 【OpenCV】imread函数的简单分析
  • PyTorch API 8 - 工具集、onnx、option、复数、DDP、量化、分布式 RPC、NeMo
  • 【金仓数据库征文】政府项目数据库迁移:从MySQL 5.7到KingbaseES的蜕变之路
  • STM32-ADC模数转换器(7)
  • 华为云Git使用与GitCode操作指南
  • 湖仓一体架构在金融典型数据分析场景中的实践
  • 多线程 2 - 死锁问题
  • 中国古代史2
  • P1065 [NOIP 2006 提高组] 作业调度方案 详解
  • 【计算机视觉】OpenCV实战项目:Deep Machine Learning Tutors:基于OpenCV的实时面部识别系统深度解析
  • 机器学习第四讲:无监督学习 → 给无标签积木自由组合,发现隐藏规律
  • Lambda表达式解读
  • inotify 文件监控机制
  • C# 参数
  • Kubernetes资源管理之Request与Limit配置黄金法则
  • 《向上生长》读书笔记day5
  • Flutter - UIKit开发相关指南 - 概览