[Android] Medialibrary: Match new API

Geoffrey Métais git at videolan.org
Fri Oct 4 16:29:01 CEST 2019


vlc-android | branch: 3.2.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Oct  4 15:57:08 2019 +0200| [11821b61a77df9f9766aace65cf1d1f5a42465d5] | committer: Geoffrey Métais

Medialibrary: Match new API

(cherry picked from commit 6d98b702581f6c52a61f2a4148572604369aeef0)

> https://code.videolan.org/videolan/vlc-android/commit/11821b61a77df9f9766aace65cf1d1f5a42465d5
---

 medialibrary/jni/AndroidMediaLibrary.cpp                            | 4 ++--
 medialibrary/jni/AndroidMediaLibrary.h                              | 2 +-
 medialibrary/jni/medialibrary.cpp                                   | 2 +-
 medialibrary/src/org/videolan/medialibrary/Medialibrary.java        | 4 ++++
 .../org/videolan/medialibrary/interfaces/AbstractMedialibrary.java  | 6 +++---
 vlc-android/src/org/videolan/vlc/MediaParsingService.kt             | 2 +-
 6 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/medialibrary/jni/AndroidMediaLibrary.cpp b/medialibrary/jni/AndroidMediaLibrary.cpp
index 9ff728af4..45d77106d 100644
--- a/medialibrary/jni/AndroidMediaLibrary.cpp
+++ b/medialibrary/jni/AndroidMediaLibrary.cpp
@@ -917,12 +917,12 @@ void AndroidMediaLibrary::onMediaThumbnailReady( medialibrary::MediaPtr media, m
     }
 }
 
-bool AndroidMediaLibrary::onUnhandledException( const char* context, const char* errMsg )
+bool AndroidMediaLibrary::onUnhandledException( const char* context, const char* errMsg, bool clearSuggested )
 {
     JNIEnv *env = getEnv();
     jstring ctx = env->NewStringUTF(context);
     jstring msg = env->NewStringUTF(errMsg);
-    env->CallVoidMethod(weak_thiz, p_fields->MediaLibrary.onUnhandledExceptionId, ctx, msg);
+    env->CallVoidMethod(weak_thiz, p_fields->MediaLibrary.onUnhandledExceptionId, ctx, msg, clearSuggested);
     env->DeleteLocalRef(ctx);
     env->DeleteLocalRef(msg);
     return true;
diff --git a/medialibrary/jni/AndroidMediaLibrary.h b/medialibrary/jni/AndroidMediaLibrary.h
index 0e96c9a07..6602d228a 100644
--- a/medialibrary/jni/AndroidMediaLibrary.h
+++ b/medialibrary/jni/AndroidMediaLibrary.h
@@ -149,7 +149,7 @@ public:
                                bool success );
     void onHistoryChanged( medialibrary::HistoryType historyType );
 
-    bool onUnhandledException( const char* /* context */, const char* /* errMsg */ );
+    bool onUnhandledException( const char* /* context */, const char* /* errMsg */, bool /* clearSuggested */ );
 
 private:
     void jni_detach_thread(void *data);
diff --git a/medialibrary/jni/medialibrary.cpp b/medialibrary/jni/medialibrary.cpp
index c40216ce5..091d2f09a 100644
--- a/medialibrary/jni/medialibrary.cpp
+++ b/medialibrary/jni/medialibrary.cpp
@@ -2318,7 +2318,7 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved)
     GET_ID(GetMethodID,
            ml_fields.MediaLibrary.onUnhandledExceptionId,
            ml_fields.MediaLibrary.clazz,
-           "onUnhandledException", "(Ljava/lang/String;Ljava/lang/String;)V");
+           "onUnhandledException", "(Ljava/lang/String;Ljava/lang/String;Z)V");
 
 #undef GET_CLASS
 #undef GET_ID
diff --git a/medialibrary/src/org/videolan/medialibrary/Medialibrary.java b/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
index e8f438be4..06289f076 100644
--- a/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
+++ b/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
@@ -381,6 +381,10 @@ public class Medialibrary extends AbstractMedialibrary {
         return mIsInitiated && nativeClearHistory();
     }
 
+    public void clearDatabase(boolean restorePlaylist) {
+        if (mIsInitiated) nativeClearDatabase(restorePlaylist);
+    }
+
     public boolean addToHistory(String mrl, String title) {
         return mIsInitiated && nativeAddToHistory(Tools.encodeVLCMrl(mrl), Tools.encodeVLCMrl(title));
     }
diff --git a/medialibrary/src/org/videolan/medialibrary/interfaces/AbstractMedialibrary.java b/medialibrary/src/org/videolan/medialibrary/interfaces/AbstractMedialibrary.java
index 3bea67e21..b4d208a5f 100644
--- a/medialibrary/src/org/videolan/medialibrary/interfaces/AbstractMedialibrary.java
+++ b/medialibrary/src/org/videolan/medialibrary/interfaces/AbstractMedialibrary.java
@@ -207,7 +207,7 @@ abstract public class AbstractMedialibrary {
     }
 
     public interface MedialibraryExceptionHandler {
-        void onUnhandledException(String context, String errMsg);
+        void onUnhandledException(String context, String errMsg, boolean clearSuggested);
     }
 
     public MedialibraryExceptionHandler getExceptionHandler() {
@@ -403,8 +403,8 @@ abstract public class AbstractMedialibrary {
         }
     }
     @SuppressWarnings("unused")
-    public void onUnhandledException(String context, String errMsg) {
-        if (mExceptionHandler != null) mExceptionHandler.onUnhandledException(context, errMsg);
+    public void onUnhandledException(String context, String errMsg, boolean clearSuggested) {
+        if (mExceptionHandler != null) mExceptionHandler.onUnhandledException(context, errMsg, clearSuggested);
     }
 
     @SuppressWarnings("unused")
diff --git a/vlc-android/src/org/videolan/vlc/MediaParsingService.kt b/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
index 375e86660..86c1fc6f2 100644
--- a/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
+++ b/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
@@ -83,7 +83,7 @@ class MediaParsingService : Service(), DevicesDiscoveryCb, CoroutineScope, Lifec
     private var discoverTriggered = false
     internal val sb = StringBuilder()
 
-    private val exceptionHandler = if (BuildConfig.BETA) AbstractMedialibrary.MedialibraryExceptionHandler { context, errMsg ->
+    private val exceptionHandler = if (BuildConfig.BETA) AbstractMedialibrary.MedialibraryExceptionHandler { context, errMsg, _ ->
         val intent = Intent(applicationContext, SendCrashActivity::class.java).apply {
             putExtra(CRASH_ML_CTX, context)
             putExtra(CRASH_ML_MSG, errMsg)



More information about the Android mailing list