[Android] Fix crash on startup when abi mismatch

Geoffrey Métais git at videolan.org
Thu Aug 4 14:20:26 CEST 2016


vlc-android | branch: 2.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Aug  4 14:18:55 2016 +0200| [00913fbad990f3ff4ac99ab9f10f97623b68623b] | committer: Geoffrey Métais

Fix crash on startup when abi mismatch

(cherry picked from commit 7504675f080e0c1ed77792de34a2d42dc5fd7290)

> https://code.videolan.org/videolan/vlc-android/commit/00913fbad990f3ff4ac99ab9f10f97623b68623b
---

 vlc-android/src/org/videolan/vlc/VLCApplication.java   | 2 ++
 vlc-android/src/org/videolan/vlc/util/VLCInstance.java | 7 +++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/VLCApplication.java b/vlc-android/src/org/videolan/vlc/VLCApplication.java
index 613fd86..f3713b0 100644
--- a/vlc-android/src/org/videolan/vlc/VLCApplication.java
+++ b/vlc-android/src/org/videolan/vlc/VLCApplication.java
@@ -119,6 +119,8 @@ public class VLCApplication extends Application {
 
         sTV = AndroidDevices.isAndroidTv() || !AndroidDevices.hasTsp();
 
+        if (!VLCInstance.testCompatibleCPU(this))
+            return;
         Dialog.setCallbacks(VLCInstance.get(), mDialogCallbacks);
 
         // Disable remote control receiver on Fire TV.
diff --git a/vlc-android/src/org/videolan/vlc/util/VLCInstance.java b/vlc-android/src/org/videolan/vlc/util/VLCInstance.java
index 140720e..35129a9 100644
--- a/vlc-android/src/org/videolan/vlc/util/VLCInstance.java
+++ b/vlc-android/src/org/videolan/vlc/util/VLCInstance.java
@@ -20,6 +20,7 @@
 
 package org.videolan.vlc.util;
 
+import android.app.Activity;
 import android.content.Context;
 import android.content.Intent;
 import android.content.res.AssetManager;
@@ -136,8 +137,10 @@ public class VLCInstance {
 
     public static synchronized boolean testCompatibleCPU(Context context) {
         if (sLibVLC == null && !VLCUtil.hasCompatibleCPU(context)) {
-            final Intent i = new Intent(context, CompatErrorActivity.class);
-            context.startActivity(i);
+            if (context instanceof Activity) {
+                final Intent i = new Intent(context, CompatErrorActivity.class);
+                context.startActivity(i);
+            }
             return false;
         } else
             return true;



More information about the Android mailing list