Return true if device has the ART or ART debug build runtime, otherwise false. - Android Android OS

Android examples for Android OS:System Model

Description

Return true if device has the ART or ART debug build runtime, otherwise false.

Demo Code


import android.os.SystemPropertiesReflect;

public class Main{
    private static final String SELECT_RUNTIME_PROPERTY = "persist.sys.dalvik.vm.lib";
    private static final String LIB_ART = "libart.so";
    private static final String LIB_ART_D = "libartd.so";
    /** Return true if device has the ART or ART debug build runtime, otherwise false. */
    public static boolean isRuntimeArt() {
        String runtime = getCurrentRuntime();
        return runtime.equalsIgnoreCase(LIB_ART)
                || runtime.equalsIgnoreCase(LIB_ART_D);
    }/*  w w  w . j  av a  2s  . c o  m*/
    /** Return the current runtime, otherwise null.
     * @return current runtime
     */
    public static String getCurrentRuntime() {
        return SystemPropertiesReflect.get(SELECT_RUNTIME_PROPERTY);
    }
}

Related Tutorials