Skip to content

Commit

Permalink
Refactor force update logic: Delay exit logic when is force update
Browse files Browse the repository at this point in the history
  • Loading branch information
yjfnypeu committed Oct 23, 2017
1 parent ee89ac8 commit 59ba3b0
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,18 @@ protected void exitIfForceUpdate(Update update) {
if (!update.isForced()) {
return;
}
// 释放Activity资源。避免进程被杀后导致自动重启
ActivityManager.get().finishAll();
// 两种kill进程方式一起使用。双管齐下!
Process.killProcess(Process.myPid());
System.exit(0);
// 延迟强制更新时的退出操作。因为部分机型上安装程序读取安装包的时机有延迟。
Utils.getMainHandler().postDelayed(new Runnable() {
@Override
public void run() {
// 释放Activity资源。避免进程被杀后导致自动重启
ActivityManager.get().finishAll();
// 两种kill进程方式一起使用。双管齐下!
Process.killProcess(Process.myPid());
System.exit(0);
}
}, 1500);

}

private String getAuthor(Context context) {
Expand Down

0 comments on commit 59ba3b0

Please sign in to comment.