[Android] Throw exception if build is not compatible with device

Satish MR git at videolan.org
Sat Nov 10 06:16:27 CET 2012


vlc-ports/android | branch: master | Satish MR <satishmr123 at gmail.com> | Fri Nov  9 21:27:35 2012 +0530| [72f90f136924ca461f0fda3431131b46ec43736a] | committer: Edward Wang

Throw exception if build is not compatible with device

Throw exception if device is not compatible with libvlc.so build. Don't create the video player activity if this condition fails.

Signed-off-by: Edward Wang <edward.c.wang at compdigitec.com>

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

 vlc-android/src/org/videolan/vlc/LibVLC.java                        |    2 +-
 vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java |    2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/LibVLC.java b/vlc-android/src/org/videolan/vlc/LibVLC.java
index 8ad1a49..723c198 100644
--- a/vlc-android/src/org/videolan/vlc/LibVLC.java
+++ b/vlc-android/src/org/videolan/vlc/LibVLC.java
@@ -201,7 +201,7 @@ public class LibVLC {
         if (!mIsInitialized) {
             if(!Util.hasCompatibleCPU()) {
                 Log.e(TAG, Util.getErrorMsg());
-                return;
+                throw new LibVlcException();
             }
             Context context = VLCApplication.getAppContext();
             SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context);
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index e7cb133..b35a1b8 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -266,6 +266,8 @@ public class VideoPlayerActivity extends Activity {
             mLibVLC = LibVLC.getInstance();
         } catch (LibVlcException e) {
             e.printStackTrace();
+            Log.d(TAG, "LibVLC initialisation failed");
+            return;
         }
 
         EventManager em = EventManager.getInstance();



More information about the Android mailing list