File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed
main/java/org/sqlite/util
test/java/org/sqlite/util Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 2424// --------------------------------------
2525package org .sqlite .util ;
2626
27+ import java .io .File ;
2728import java .io .IOException ;
2829import java .nio .file .Files ;
2930import java .nio .file .Path ;
@@ -114,7 +115,21 @@ public static String getOSName() {
114115 }
115116
116117 public static boolean isAndroid () {
117- return isAndroidRuntime () || isAndroidTermux ();
118+ return isAndroidRuntime () || isAndroidTermux () || isRunningAndroid ();
119+ }
120+
121+ private static boolean isRunningAndroid () {
122+ // This file is guaranteed to be present on every android version since 1.6 (Donut, API 4),
123+ // see https://developer.android.com/ndk/guides/stable_apis#graphics
124+ // We don't use libc/libm/libdl because that has changed what directory its pointing to and
125+ // OEMs implement the symlink that allows backwards compatibility
126+ // for apps that use the old path differently, which may cause this check to fail because
127+ // common undocumented behaviour. See
128+ // https://developer.android.com/about/versions/10/behavior-changes-all#bionic
129+ File androidGLES = new File ("/system/lib/libGLESv1_CM" );
130+ File android64GLES = new File ("/system/lib64/libGLESv1_CM" );
131+
132+ return android64GLES .exists () || androidGLES .exists ();
118133 }
119134
120135 public static boolean isAndroidRuntime () {
Original file line number Diff line number Diff line change @@ -133,8 +133,8 @@ public void testIsAndroidTermux() throws Exception {
133133 }
134134
135135 @ Nested
136- @ SetSystemProperty (key = "java.runtime.name" , value = "Java for Android" )
137- @ SetSystemProperty (key = "os.name" , value = "Linux for Android " )
136+ @ SetSystemProperty (key = "java.runtime.name" , value = "Android Runtime " )
137+ @ SetSystemProperty (key = "os.name" , value = "Linux" )
138138 class AndroidRuntime {
139139
140140 @ Test
You can’t perform that action at this time.
0 commit comments