[Android] [PATCH 10/10] Respect the user's privacy for album art

Edward Wang edward.c.wang at compdigitec.com
Wed Aug 29 04:21:58 CEST 2012


---
 vlc-android/jni/libvlcjni.c                  |    4 ++++
 vlc-android/res/values/strings.xml           |    2 ++
 vlc-android/res/xml/preferences.xml          |    5 +++++
 vlc-android/src/org/videolan/vlc/LibVLC.java |    5 +++++
 4 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/vlc-android/jni/libvlcjni.c b/vlc-android/jni/libvlcjni.c
index ef2ed0a..2d16a47 100644
--- a/vlc-android/jni/libvlcjni.c
+++ b/vlc-android/jni/libvlcjni.c
@@ -460,6 +460,9 @@ void Java_org_videolan_vlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz, jboolean
     methodId = (*env)->GetMethodID(env, cls, "timeStretchingEnabled", "()Z");
     bool enable_time_stretch = (*env)->CallBooleanMethod(env, thiz, methodId);
 
+    methodId = (*env)->GetMethodID(env, cls, "allowAlbumArtEnabled", "()Z");
+    bool album_art = (*env)->CallBooleanMethod(env, thiz, methodId);
+
     verbosity = verbose;
     libvlc_log_subscribe(&debug_subscriber, debug_log, &verbosity);
 
@@ -481,6 +484,7 @@ void Java_org_videolan_vlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz, jboolean
         "--preferred-resolution", "360",
         enable_time_stretch ? "--audio-time-stretch" : "--no-audio-time-stretch",
         use_opensles ? "--aout=opensles" : "--aout=android_audiotrack",
+        "--album-art", album_art ? "2" : "0",
     };
     libvlc_instance_t *instance = libvlc_new(sizeof(argv) / sizeof(*argv), argv);
 
diff --git a/vlc-android/res/values/strings.xml b/vlc-android/res/values/strings.xml
index 7c9d0d3..ea28cf3 100644
--- a/vlc-android/res/values/strings.xml
+++ b/vlc-android/res/values/strings.xml
@@ -123,6 +123,8 @@
     <string name="main_prefs_category">Main</string>
     <string name="privacy_prefs_category">Privacy</string>
     <string name="clear_history">Clear search history</string>
+    <string name="allow_album_art">Enable auto album art</string>
+    <string name="allow_album_art_detail">Enable fetching album art automatically from the Internet</string>
     <string name="advanced_prefs_category">Advanced</string>
     <string name="enable_iomx">Enable hardware accelerated decoding</string>
     <string name="advanced_debugging">Advanced debugging</string>
diff --git a/vlc-android/res/xml/preferences.xml b/vlc-android/res/xml/preferences.xml
index 80b0d5b..7cd4a9a 100644
--- a/vlc-android/res/xml/preferences.xml
+++ b/vlc-android/res/xml/preferences.xml
@@ -40,6 +40,11 @@
             android:key="clear_history"
             android:title="@string/clear_history">
         </PreferenceScreen>
+        <CheckBoxPreference
+            android:key="allow_auto_albumart"
+            android:title="@string/allow_album_art"
+            android:summary="@string/allow_album_art_detail"
+            android:defaultValue="false" />
     </PreferenceCategory>
     <PreferenceCategory android:title="@string/advanced_prefs_category">
         <CheckBoxPreference
diff --git a/vlc-android/src/org/videolan/vlc/LibVLC.java b/vlc-android/src/org/videolan/vlc/LibVLC.java
index e71aa95..6138132 100644
--- a/vlc-android/src/org/videolan/vlc/LibVLC.java
+++ b/vlc-android/src/org/videolan/vlc/LibVLC.java
@@ -229,6 +229,11 @@ public class LibVLC {
         return p.getBoolean("enable_time_stretching_audio", false);
     }
 
+    public boolean allowAlbumArtEnabled() {
+        SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(VLCApplication.getAppContext());
+        return p.getBoolean("allow_auto_albumart", false);
+    }
+
     /**
      * Initialize the libVLC class
      */
-- 
1.7.5.4



More information about the Android mailing list