[Android] LibVlcUtil: fix path of libvlcjni.so when VLC is installed as a system app

Felix Abecassis git at videolan.org
Tue Aug 26 05:24:15 CEST 2014


vlc-ports/android | branch: master | Felix Abecassis <felix.abecassis at gmail.com> | Mon Aug 25 14:59:47 2014 +0200| [7159b8013f0a6e72986d02f99634a9d75838b721] | committer: Jean-Baptiste Kempf

LibVlcUtil: fix path of libvlcjni.so when VLC is installed as a system app

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 vlc-android/src/org/videolan/libvlc/LibVlcUtil.java |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/libvlc/LibVlcUtil.java b/vlc-android/src/org/videolan/libvlc/LibVlcUtil.java
index 2c7fb70..8addfbd 100644
--- a/vlc-android/src/org/videolan/libvlc/LibVlcUtil.java
+++ b/vlc-android/src/org/videolan/libvlc/LibVlcUtil.java
@@ -31,6 +31,7 @@ import java.nio.ByteOrder;
 import java.util.Locale;
 
 import android.content.Context;
+import android.content.pm.ApplicationInfo;
 import android.net.Uri;
 import android.os.Build;
 import android.util.Log;
@@ -99,7 +100,13 @@ public class LibVlcUtil {
         // If already checked return cached result
         if(errorMsg != null || isCompatible) return isCompatible;
 
-        ElfData elf = readLib(context.getApplicationInfo().dataDir + "/lib/libvlcjni.so");
+        ApplicationInfo applicationInfo = context.getApplicationInfo();
+        String libBasePath;
+        if ((applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0)
+            libBasePath = "/system";
+        else
+            libBasePath = applicationInfo.dataDir;
+        ElfData elf = readLib(libBasePath + "/lib/libvlcjni.so");
         if(elf == null) {
             Log.e(TAG, "WARNING: Unable to read libvlcjni.so; cannot check device ABI!");
             Log.e(TAG, "WARNING: Cannot guarantee correct ABI for this build (may crash)!");



More information about the Android mailing list