当前位置:网站首页>OTA升级
OTA升级
2022-06-10 23:58:00 【猿小帅01】
OTA升级
1.命令行脚本
echo "--update_package=/data/update.zip" > /cache/recovery/command
sync
reboot recovery
/data/update.zip 为更新包存储路径
android7.1.1以后data分区加密,所以需要进行adb shell uncrypt
uncrypt /data/media/0/update.zip /cache/recovery/block.map
echo --[email protected]/cache/recovery/block.map > /cache/recovery/command
#echo --locale=zh-CN
echo updating$path=/data/media/0/update.zip > /cache/recovery/last_flag
echo /data/media/0/update.zip > /cache/recovery/uncrypt_file
2.代码中升级
private static File RECOVERY_DIR = new File("/cache/recovery");
private static File UPDATE_FLAG_FILE = new File(RECOVERY_DIR, "last_flag");
public static void installPackage(Context context, File packageFile)throws IOException{
String filename = packageFile.getCanonicalPath();
writeFlagCommand(filename);
RecoverySystem.installPackage(context, packageFile);
}
//path 即更新包所在路径
public static void writeFlagCommand(String path) throws IOException{
RECOVERY_DIR.mkdirs();
UPDATE_FLAG_FILE.delete();
FileWriter writer = new FileWriter(UPDATE_FLAG_FILE);
try {
writer.write("updating$path=" + path);
}finally {
writer.close();
}
}
边栏推荐
猜你喜欢

招聘 | 南京 | TRIOSTUDIO 三厘社 – 室内设计师 / 施工图深化设计师 / 装置/产品设计师 / 实习生等

Deploy netron services through kubernetes and specify model files at startup

With a market value of 21.5 billion yuan, will the post-80s generation in Sichuan make TV history?

About the log traffic monitoring and early warning small project | standardized return of interaction with the database in flask

适配器模式

System interpretation: Authority Design Guide
![[network planning] 2.5 brief introduction to P2P architecture](/img/a8/74a1b44ce4d8b0b1a85043a091a91d.jpg)
[network planning] 2.5 brief introduction to P2P architecture

lucene思维导图,让搜索引擎不再难懂

WPF - timeline class

亿级搜索系统(优酷视频搜索)的基石,如何保障实时数据质量?v2020
随机推荐
【NVIDIA驱动的顽固问题】---- /dev/sdax:clean,xxx/xxx files,xxx/xxx blocks ---- 最全解决方法
Slam Kalman filter & nonlinear optimization
oracle带xy字段值的关系表同步到pg数据库转为几何字段
中小企业数字化转型为什么这么难?
The principle and source code interpretation of executor thread pool in concurrent programming
【ROS入门教程】---- 03 单片机、PC主机、ROS通信机制
【ROS入门教程】---- 01 ROS介绍
MySql 触发器
table_exists_action=append和table_exists_action=truncate
How about the CSC account of qiniu business school? Is it safe?
大厂是面对深度分页问题是如何解决的(通俗易懂)
Random points in non overlapping rectangles
DeepStream系列之鱼眼相机测试
CentOS7 实战部署MySQL8(二进制方式)
海贼oj#448.抽奖
DevOps到底是什么意思?
About log traffic monitoring and early warning small project | database management tool: migrate
"Past and present" of permission management
嵌入式学习资料和项目汇总
Can I buy annuity insurance? Is annuity insurance safe?