platform:RK3399
OS:Android 7.1
概述
简要介绍三点:
- 字符相关修改
- 方向修改
- 固件升级动画修改
配置修改
修改中英文
diff --git a/recovery.cpp b/recovery.cpp
index 10743c9..a9f41c5 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -137,7 +137,7 @@ static const int BATTERY_WITH_CHARGER_OK_PERCENTAGE = 15;
constexpr const char* RECOVERY_WIPE = "/etc/recovery.wipe";
RecoveryUI* ui = NULL;
-static const char* locale = "en_US";
+static const char* locale = "zh_CN";
char* stage = NULL;
char* reason = NULL;
bool modified_flash = false;
修改字符串资源
<?xml version="1.0" encoding="UTF-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="recovery_installing" msgid="7864047928003865598">"正在安装系统更新… 请勿断电"</string>
<string name="recovery_erasing" msgid="4612809744968710197">"正在清除… 请勿断电"</string>
<string name="recovery_no_command" msgid="1915703879031023455">"无命令。"</string>
<string name="recovery_error" msgid="4550265746256727080">"出错了!"</string>
</resources>
参考文档:
注意在Android中recovery_l10n工具目录改变为了以下路径:
bootable/recovery/tools/recovery_l10n
修改字符串资源属性(大小和颜色)
参考文档:
1.screen_ui.cpp
// Choose the right background string to display during update. +443
void ScreenRecoveryUI::SetSystemUpdateText(bool security_update) {
if (security_update) {
LoadLocalizedBitmap("installing_security_text", &installing_text);
} else {
LoadLocalizedBitmap("installing_text", &installing_text);
}
Redraw();
}
// Clear the screen and draw the currently selected background icon (if any). +145
// Should only be called with updateMutex locked.
void ScreenRecoveryUI::draw_background_locked() {
pagesIdentical = false;
gr_color(0, 0, 0, 255);
gr_clear();
if (currentIcon != NONE) {
if (max_stage != -1) {
int stage_height = gr_get_height(stageMarkerEmpty);
int stage_width = gr_get_width(stageMarkerEmpty);
int x = (gr_fb_width() - max_stage * gr_get_width(stageMarkerEmpty)) / 2;
int y = gr_fb_height() - stage_height;
for (int i = 0; i < max_stage; ++i) {
GRSurface* stage_surface = (i < stage) ? stageMarkerFill : stageMarkerEmpty;
gr_blit(stage_surface, 0, 0, stage_width, stage_height, x, y);
x += stage_width;
}
}
GRSurface* text_surface = GetCurrentText();
int text_x = (gr_fb_width() - gr_get_width(text_surface)) / 2;
int text_y = GetTextBaseline();
gr_color(255, 255, 255, 255);
gr_texticon(text_x, text_y, text_surface);
}
}
修改字库(汉化)
Android的Recovery中font_10x18.h字库文件制作
无法生效可以查看上面修改字符串资源属性链接.
修改char_width和char_height可以修改字体大小
struct {
unsigned width;
unsigned height;
unsigned char_width;
unsigned char_height;
unsigned char rundata[2973];
} font = {
.width = 960,
.height = 18,
.char_width = 10,
.char_height = 18,
.rundata = {
更换文件
https://www.jianshu.com/p/3f5cf4599db2
recovery 方向修改
device/common/rk3399
diff --git a/BoardConfig.mk b/BoardConfig.mk
index 85df401..6bdc017 100755
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -84,7 +84,7 @@ BOARD_OPENGL_AEP := true
#90: ROTATION_RIGHT
#180: ROTATION_DOWN
#270: ROTATION_LEFT
-TARGET_RECOVERY_DEFAULT_ROTATION ?= ROTATION_NONE
+TARGET_RECOVERY_DEFAULT_ROTATION ?= ROTATION_RIGHT
ENABLE_CPUSETS := true
#for optee support
固件升级动画修改
目录:
bootable/recovery/res-xxxx/images
其中xxxx表示不同的分辨率.参考:https://www.cnblogs.com/codeking100/p/10338546.html
images目录中有升级动画的图片,名称为:loop000xx.png
根据自己定义的动画,转换为png图片替换该目录下的图片即可.
网友评论