diff options
author | Diego Perez <[email protected]> | 2016-04-06 16:06:27 +0100 |
---|---|---|
committer | Diego Perez <[email protected]> | 2016-04-06 17:14:27 +0100 |
commit | f24a8b675a0b3d7e73870c46239792a31cf81491 (patch) | |
tree | 8b9d33526d307f47dfb9b689d74cfac5dc9dfc93 /src/java/com/jogamp/common | |
parent | 7a12c273df90f41485f16e69d9680cb08fc7672f (diff) |
Use system property to detect Android
Diffstat (limited to 'src/java/com/jogamp/common')
-rw-r--r-- | src/java/com/jogamp/common/os/AndroidVersion.java | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/java/com/jogamp/common/os/AndroidVersion.java b/src/java/com/jogamp/common/os/AndroidVersion.java index 840933f..c2c2159 100644 --- a/src/java/com/jogamp/common/os/AndroidVersion.java +++ b/src/java/com/jogamp/common/os/AndroidVersion.java @@ -74,15 +74,20 @@ public class AndroidVersion { Object abvObject= null; Class<?> abvcClass = null; Object abvcObject= null; - try { - abClass = ReflectionUtil.getClass(androidBuild, true, cl); - abObject = abClass.newInstance(); - abvClass = ReflectionUtil.getClass(androidBuildVersion, true, cl); - abvObject = abvClass.newInstance(); - abvcClass = ReflectionUtil.getClass(androidBuildVersionCodes, true, cl); - abvcObject = abvcClass.newInstance(); - } catch (final Exception e) { /* n/a */ } - isAvailable = null != abObject && null != abvObject; + + boolean isDalvikVm = "Dalvik".equals(System.getProperty("java.vm.name")); + + if (isDalvikVm) { + try { + abClass = ReflectionUtil.getClass(androidBuild, true, cl); + abObject = abClass.newInstance(); + abvClass = ReflectionUtil.getClass(androidBuildVersion, true, cl); + abvObject = abvClass.newInstance(); + abvcClass = ReflectionUtil.getClass(androidBuildVersionCodes, true, cl); + abvcObject = abvcClass.newInstance(); + } catch (final Exception e) { /* n/a */ } + } + isAvailable = isDalvikVm && null != abObject && null != abvObject; if(isAvailable) { CPU_ABI = getString(abClass, abObject, "CPU_ABI", true); CPU_ABI2 = getString(abClass, abObject, "CPU_ABI2", true); |