|
|
@ -729,6 +729,7 @@ public class AppMaster {
|
|
|
|
* otaurl: //新版本Apk的Md5
|
|
|
|
* otaurl: //新版本Apk的Md5
|
|
|
|
* appurl: //新版本Apk的Md5
|
|
|
|
* appurl: //新版本Apk的Md5
|
|
|
|
* checkMd5: //增量包的下载URL
|
|
|
|
* checkMd5: //增量包的下载URL
|
|
|
|
|
|
|
|
* key: //app的类型名称
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* */
|
|
|
|
* */
|
|
|
|
private void startFrp(JSONObject jsonObject) {
|
|
|
|
private void startFrp(JSONObject jsonObject) {
|
|
|
@ -1014,7 +1015,8 @@ public class AppMaster {
|
|
|
|
if (!path.exists()) {
|
|
|
|
if (!path.exists()) {
|
|
|
|
path.mkdirs();
|
|
|
|
path.mkdirs();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
File file = new File(path, "app.apk");
|
|
|
|
String urlMd5 = MD5Util.md5(url);//获取URL的Md5
|
|
|
|
|
|
|
|
File file = new File(path, urlMd5 + ".apk");
|
|
|
|
if (file.exists()) {
|
|
|
|
if (file.exists()) {
|
|
|
|
file.delete();
|
|
|
|
file.delete();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1044,7 +1046,7 @@ public class AppMaster {
|
|
|
|
path.mkdirs();
|
|
|
|
path.mkdirs();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//Patch存储路径
|
|
|
|
//Patch存储路径
|
|
|
|
File patchFile = new File(path, otaurlMd5 + ".PATCH");
|
|
|
|
File patchFile = new File(path, otaurlMd5 + ".patch");
|
|
|
|
if (patchFile.exists()) {
|
|
|
|
if (patchFile.exists()) {
|
|
|
|
patchFile.delete();
|
|
|
|
patchFile.delete();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1064,10 +1066,10 @@ public class AppMaster {
|
|
|
|
if (!oldApk.exists()) {
|
|
|
|
if (!oldApk.exists()) {
|
|
|
|
mService.logger.warning("upgradeAppOta未找到对应apk:" + oldurlMd5);
|
|
|
|
mService.logger.warning("upgradeAppOta未找到对应apk:" + oldurlMd5);
|
|
|
|
//文件下载
|
|
|
|
//文件下载
|
|
|
|
if (dl.download(newurl, patchPath)) {
|
|
|
|
if (dl.download(newurl, newApkPath)) {
|
|
|
|
mService.logger.info("upgradeAppOta TOTAL_APP: " + newurl);
|
|
|
|
mService.logger.info("upgradeAppOta TOTAL_APP: " + newurl);
|
|
|
|
String fileMd5 = MD5Util.getFileMd5(newApk.getAbsolutePath());
|
|
|
|
String fileMd5 = MD5Util.getFileMd5(newApk.getAbsolutePath());
|
|
|
|
if (checkMd5.equals(fileMd5)) {
|
|
|
|
if (checkMd5 != null && checkMd5.equals(fileMd5)) {
|
|
|
|
SysApi.installApk(context, newApkPath, context.getPackageName(), true);
|
|
|
|
SysApi.installApk(context, newApkPath, context.getPackageName(), true);
|
|
|
|
sendResult(cid, 1, action, action + ":" + mCmdid + " is installing");
|
|
|
|
sendResult(cid, 1, action, action + ":" + mCmdid + " is installing");
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1080,7 +1082,7 @@ public class AppMaster {
|
|
|
|
boolean b = MpMasterService.applyPatch(oldApkPath, patchPath, newApkPath);
|
|
|
|
boolean b = MpMasterService.applyPatch(oldApkPath, patchPath, newApkPath);
|
|
|
|
if (b) {
|
|
|
|
if (b) {
|
|
|
|
String fileMd5 = MD5Util.getFileMd5(newApk.getAbsolutePath());
|
|
|
|
String fileMd5 = MD5Util.getFileMd5(newApk.getAbsolutePath());
|
|
|
|
if (checkMd5.equals(fileMd5)) {
|
|
|
|
if (checkMd5 != null && checkMd5.equals(fileMd5)) {
|
|
|
|
SysApi.installApk(context, newApkPath, context.getPackageName(), true);
|
|
|
|
SysApi.installApk(context, newApkPath, context.getPackageName(), true);
|
|
|
|
sendResult(cid, 1, action, action + ":" + mCmdid + " is installing");
|
|
|
|
sendResult(cid, 1, action, action + ":" + mCmdid + " is installing");
|
|
|
|
}
|
|
|
|
}
|
|
|
|