File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
updatepluginlib/src/main/java/org/lzh/framework/updatepluginlib Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 18
18
import android .app .Activity ;
19
19
import android .app .AlertDialog ;
20
20
import android .app .ProgressDialog ;
21
- import android .content .Context ;
22
21
import android .content .DialogInterface ;
23
- import android .os .Process ;
24
22
25
23
import org .lzh .framework .updatepluginlib .base .DownloadCallback ;
26
24
import org .lzh .framework .updatepluginlib .base .DownloadNotifier ;
@@ -77,8 +75,7 @@ private void createRestartDialog() {
77
75
@ Override
78
76
public void onClick (DialogInterface dialog , int which ) {
79
77
if (update .isForced ()) {
80
- System .exit (0 );
81
- Process .killProcess (Process .myPid ());
78
+ ActivityManager .get ().exit ();
82
79
} else {
83
80
dialog .dismiss ();
84
81
}
Original file line number Diff line number Diff line change 19
19
import android .app .Application ;
20
20
import android .content .Context ;
21
21
import android .os .Bundle ;
22
+ import android .os .Process ;
22
23
23
24
import java .util .LinkedList ;
24
25
@@ -92,4 +93,14 @@ void registerSelf(Context context) {
92
93
this .applicationContext = context .getApplicationContext ();
93
94
}
94
95
96
+ public void exit () {
97
+ Activity activity ;
98
+ while ((activity = stack .pop ()) != null ) {
99
+ if (!activity .isFinishing ()) {
100
+ activity .finish ();
101
+ }
102
+ }
103
+ System .exit (0 );
104
+ Process .killProcess (Process .myPid ());
105
+ }
95
106
}
You can’t perform that action at this time.
0 commit comments