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

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 里加上该属性就行。

相关文章:

  • 智能商品推荐系统技术路线图
  • Python与C语言的区别
  • stm32 lcd绘制波形和频谱
  • 数仓-缓慢变化维是什么,如何解决
  • 双目视觉系统中,极线校正(Epipolar Rectification)与单应性矩阵/多平面单应性模型
  • 【LangChain全景指南】构建下一代AI应用的开发框架
  • linux中常用的命令(三)
  • Docker镜像搬运工:save与load命令的实战指南
  • 软考 系统架构设计师系列知识点之杂项集萃(55)
  • 大模型微调指南之 LLaMA-Factory 篇:一键启动LLaMA系列模型高效微调
  • linux搭建hadoop学习
  • 【Linux】线程POSIX信号量
  • 【Linux基础】程序和软件安装管理命令
  • MindSpore框架学习项目-ResNet药物分类-模型评估
  • 天线的PCB设计
  • 理性地倾听与表达:检索算法的语言学改进
  • SpringBoot学习(上) , SpringBoot项目的创建(IDEA2024版本)
  • [架构之美]IntelliJ IDEA创建Maven项目全流程(十四)
  • OpenVLA:开源的视觉-语言-动作模型
  • torch.nn.init.uniform_
  • 体坛联播|穆勒主场完成拜仁谢幕战,山西车队再登环塔拉力赛
  • 解放军仪仗分队参加白俄罗斯纪念苏联伟大卫国战争胜利80周年阅兵活动
  • 人民日报钟声:平等对话是解决大国间问题的正确之道
  • 河南省平顶山市副市长许红兵主动投案,接受审查调查
  • 巴基斯坦称约50名印度士兵在克什米尔实控线丧生
  • 印巴局势快速升级,外交部:呼吁印巴以和平稳定的大局为重