Skip to content

Commit 59ba3b0

Browse files
committed
Refactor force update logic: Delay exit logic when is force update
1 parent ee89ac8 commit 59ba3b0

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

updatepluginlib/src/main/java/org/lzh/framework/updatepluginlib/strategy/DefaultInstallStrategy.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,18 @@ protected void exitIfForceUpdate(Update update) {
7272
if (!update.isForced()) {
7373
return;
7474
}
75-
// 释放Activity资源。避免进程被杀后导致自动重启
76-
ActivityManager.get().finishAll();
77-
// 两种kill进程方式一起使用。双管齐下!
78-
Process.killProcess(Process.myPid());
79-
System.exit(0);
75+
// 延迟强制更新时的退出操作。因为部分机型上安装程序读取安装包的时机有延迟。
76+
Utils.getMainHandler().postDelayed(new Runnable() {
77+
@Override
78+
public void run() {
79+
// 释放Activity资源。避免进程被杀后导致自动重启
80+
ActivityManager.get().finishAll();
81+
// 两种kill进程方式一起使用。双管齐下!
82+
Process.killProcess(Process.myPid());
83+
System.exit(0);
84+
}
85+
}, 1500);
86+
8087
}
8188

8289
private String getAuthor(Context context) {

0 commit comments

Comments
 (0)