欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 教育 > 高考 > Android 13 使能user版本进recovery

Android 13 使能user版本进recovery

2025/11/10 6:26:34 来源:https://blog.csdn.net/weixin_44021334/article/details/147853715  浏览:    关键词: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 里加上该属性就行。

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词