[Android] NativeCrashActivity: kill the old VLC process on the restart button click

Adrien Maglo git at videolan.org
Mon May 12 14:20:15 CEST 2014


vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Mon May 12 14:12:51 2014 +0200| [63687e31f66d3ad12066d7cc4fb8c4525414d1c1] | committer: Adrien Maglo

NativeCrashActivity: kill the old VLC process on the restart button click

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=63687e31f66d3ad12066d7cc4fb8c4525414d1c1
---

 vlc-android/src/org/videolan/vlc/Util.java                    |    2 +-
 vlc-android/src/org/videolan/vlc/gui/NativeCrashActivity.java |    1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/Util.java b/vlc-android/src/org/videolan/vlc/Util.java
index 3f08bae..f13580b 100644
--- a/vlc-android/src/org/videolan/vlc/Util.java
+++ b/vlc-android/src/org/videolan/vlc/Util.java
@@ -93,8 +93,8 @@ public class Util {
                 public void onNativeCrash() {
                     Intent i = new Intent(context, NativeCrashActivity.class);
                     i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+                    i.putExtra("PID", android.os.Process.myPid());
                     context.startActivity(i);
-                    android.os.Process.killProcess(android.os.Process.myPid());
                 }
             });
         }
diff --git a/vlc-android/src/org/videolan/vlc/gui/NativeCrashActivity.java b/vlc-android/src/org/videolan/vlc/gui/NativeCrashActivity.java
index f8e653d..8e18294 100644
--- a/vlc-android/src/org/videolan/vlc/gui/NativeCrashActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/NativeCrashActivity.java
@@ -47,6 +47,7 @@ public class NativeCrashActivity extends Activity {
         mRestartButton.setOnClickListener(new Button.OnClickListener() {
             @Override
             public void onClick(View v) {
+                android.os.Process.killProcess(getIntent().getExtras().getInt("PID"));
                 Intent i = new Intent(NativeCrashActivity.this, MainActivity.class);
                 i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                 startActivity(i);



More information about the Android mailing list