Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use system property to detect Android #33

Merged
merged 1 commit into from Mar 26, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 14 additions & 9 deletions src/java/com/jogamp/common/os/AndroidVersion.java
Expand Up @@ -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);
Expand Down