Return the name of the current runtime, otherwise null. - Android Android OS

Android examples for Android OS:Shell

Description

Return the name of the current runtime, otherwise null.

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_DALVIK = "libdvm.so";
    private static final String LIB_ART = "libart.so";
    private static final String LIB_ART_D = "libartd.so";
    private static final String TAG_DALVIK = "Dalvik";
    private static final String TAG_ART = "ART";
    private static final String TAG_ART_DEBUG_BUILD = "ART debug build";
    /** Return the name of the current runtime, otherwise null.
     * @return current runtime//from  w ww .  ja v  a 2  s .  co  m
     */
    public static String getCurrentRuntimeName() {
        String runtime = getCurrentRuntime();
        switch (runtime) {
        case LIB_ART:
            return TAG_ART;
        case LIB_ART_D:
            return TAG_ART_DEBUG_BUILD;
        case LIB_DALVIK:
            return TAG_DALVIK;
        default:
            return runtime;
        }
    }
    /** Return the current runtime, otherwise null.
     * @return current runtime
     */
    public static String getCurrentRuntime() {
        return SystemPropertiesReflect.get(SELECT_RUNTIME_PROPERTY);
    }
}

Related Tutorials