Skip to content

Commit e5103b0

Browse files
authored
[monodroid] Remove dead JNI weak-ref checking code (#6074)
Context: https://code.google.com/p/android/issues/detail?id=63929 Context: https://android-review.googlesource.com/c/platform/art/+/73142 ART issue this code worked around was fixed in December 2019 and released in one of the Android 4.4 (KitKat, API 19) updates, most likely 4.4.3 on June 2, 2014. Additionally, the `persist.sys.dalvik.vm.lib` system property doesn't appear to be present any longer on newer Android versions. Remove the dead code from `OSBridge::platform_supports_weak_refs()`.
1 parent c705bf5 commit e5103b0

File tree

1 file changed

+1
-27
lines changed

1 file changed

+1
-27
lines changed

src/monodroid/jni/osbridge.cc

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,33 +1010,7 @@ OSBridge::platform_supports_weak_refs (void)
10101010
return use_weak_refs;
10111011
}
10121012

1013-
if (androidSystem.monodroid_get_system_property ("persist.sys.dalvik.vm.lib", &value) > 0) {
1014-
int art = 0;
1015-
if (!strcmp ("libart.so", value))
1016-
art = 1;
1017-
free (value);
1018-
if (art) {
1019-
int use_java = 0;
1020-
if (androidSystem.monodroid_get_system_property ("ro.build.version.release", &value) > 0) {
1021-
// Android 4.x ART is busted; see https://code.google.com/p/android/issues/detail?id=63929
1022-
if (value [0] != 0 && value [0] == '4' && value [1] != 0 && value [1] == '.') {
1023-
use_java = 1;
1024-
}
1025-
free (value);
1026-
}
1027-
if (use_java) {
1028-
log_warn (LOG_GC, "JNI weak global refs are broken on Android with the ART runtime.");
1029-
log_warn (LOG_GC, "Trying to use java.lang.WeakReference instead, but this may fail as well.");
1030-
log_warn (LOG_GC, "App stability may be compromised.");
1031-
log_warn (LOG_GC, "See: https://code.google.com/p/android/issues/detail?id=63929");
1032-
return 0;
1033-
}
1034-
}
1035-
}
1036-
1037-
if (api_level > 7)
1038-
return 1;
1039-
return 0;
1013+
return 1;
10401014
}
10411015

10421016
void

0 commit comments

Comments
 (0)