[Android] libvlc: remove obsolete code for api level <= 13
Zhao Zhili
git at videolan.org
Thu Nov 21 17:06:03 CET 2019
vlc-android | branch: master | Zhao Zhili <quinkblack at foxmail.com> | Fri Nov 15 23:27:54 2019 +0800| [5077545ecb09789599b61049af5c0a412dde95a2] | committer: Geoffrey Métais
libvlc: remove obsolete code for api level <= 13
> https://code.videolan.org/videolan/vlc-android/commit/5077545ecb09789599b61049af5c0a412dde95a2
---
libvlc/jni/libvlcjni-vlcobject.c | 23 ++---------------------
libvlc/jni/libvlcjni.c | 17 -----------------
libvlc/jni/utils.h | 2 --
3 files changed, 2 insertions(+), 40 deletions(-)
diff --git a/libvlc/jni/libvlcjni-vlcobject.c b/libvlc/jni/libvlcjni-vlcobject.c
index 841fa34ad..02ca8327b 100644
--- a/libvlc/jni/libvlcjni-vlcobject.c
+++ b/libvlc/jni/libvlcjni-vlcobject.c
@@ -31,7 +31,6 @@ extern JNIEnv *jni_get_env(const char *name);
struct vlcjni_object_owner
{
jweak weak;
- jobject weakCompat;
libvlc_event_manager_t *p_event_manager;
const int *p_events;
@@ -99,18 +98,8 @@ VLCJniObject_newFromLibVlc(JNIEnv *env, jobject thiz,
p_obj->p_libvlc = p_libvlc;
libvlc_retain(p_libvlc);
- if (fields.VLCObject.getWeakReferenceID)
- {
- jobject weakCompat = (*env)->CallObjectMethod(env, thiz,
- fields.VLCObject.getWeakReferenceID);
- if (weakCompat)
- {
- p_obj->p_owner->weakCompat = (*env)->NewGlobalRef(env, weakCompat);
- (*env)->DeleteLocalRef(env, weakCompat);
- }
- } else
- p_obj->p_owner->weak = (*env)->NewWeakGlobalRef(env, thiz);
- if (!p_obj->p_owner->weak && !p_obj->p_owner->weakCompat)
+ p_obj->p_owner->weak = (*env)->NewWeakGlobalRef(env, thiz);
+ if (!p_obj->p_owner->weak)
{
ex = VLCJNI_EX_ILLEGAL_STATE;
p_error = "No VLCObject weak reference";
@@ -160,8 +149,6 @@ VLCJniObject_release(JNIEnv *env, jobject thiz, vlcjni_object *p_obj)
{
if (p_obj->p_owner->weak)
(*env)->DeleteWeakGlobalRef(env, p_obj->p_owner->weak);
- else if (p_obj->p_owner->weakCompat)
- (*env)->DeleteGlobalRef(env, p_obj->p_owner->weakCompat);
}
free(p_obj->p_owner);
@@ -193,12 +180,6 @@ VLCJniObject_eventCallback(const libvlc_event_t *ev, void *data)
fields.VLCObject.dispatchEventFromNativeID,
jevent.type, jevent.arg1, jevent.arg2,
jevent.argf1, string);
- else
- (*env)->CallStaticVoidMethod(env, fields.VLCObject.clazz,
- fields.VLCObject.dispatchEventFromWeakNativeID,
- p_obj->p_owner->weakCompat,
- jevent.type, jevent.arg1, jevent.arg2,
- jevent.argf1, string);
if (string)
(*env)->DeleteLocalRef(env, string);
}
diff --git a/libvlc/jni/libvlcjni.c b/libvlc/jni/libvlcjni.c
index 6884432f9..fda2f8848 100644
--- a/libvlc/jni/libvlcjni.c
+++ b/libvlc/jni/libvlcjni.c
@@ -208,23 +208,6 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved)
fields.VLCObject.clazz,
"dispatchEventFromNative", "(IJJFLjava/lang/String;)V");
- if (fields.SDK_INT <= 13)
- {
- LOGE("fields.SDK_INT is less than 13 (honeycomb_mr2): using compat WeakReference");
- GET_ID(GetMethodID,
- fields.VLCObject.getWeakReferenceID,
- fields.VLCObject.clazz,
- "getWeakReference", "()Ljava/lang/Object;");
- GET_ID(GetStaticMethodID,
- fields.VLCObject.dispatchEventFromWeakNativeID,
- fields.VLCObject.clazz,
- "dispatchEventFromWeakNative", "(Ljava/lang/Object;IJJFLjava/lang/String;)V");
- } else
- {
- fields.VLCObject.getWeakReferenceID = NULL;
- fields.VLCObject.dispatchEventFromWeakNativeID = NULL;
- }
-
GET_ID(GetStaticMethodID,
fields.Media.createAudioTrackFromNativeID,
fields.Media.clazz,
diff --git a/libvlc/jni/utils.h b/libvlc/jni/utils.h
index 155c2bc76..1ce8beacb 100644
--- a/libvlc/jni/utils.h
+++ b/libvlc/jni/utils.h
@@ -50,8 +50,6 @@ struct fields {
jclass clazz;
jfieldID mInstanceID;
jmethodID dispatchEventFromNativeID;
- jmethodID getWeakReferenceID;
- jmethodID dispatchEventFromWeakNativeID;
} VLCObject;
struct {
struct {
More information about the Android
mailing list