Example usage for android.os Build CPU_ABI

List of usage examples for android.os Build CPU_ABI

Introduction

In this page you can find the example usage for android.os Build CPU_ABI.

Prototype

String CPU_ABI

To view the source code for android.os Build CPU_ABI.

Click Source Link

Document

The name of the instruction set (CPU type + ABI convention) of native code.

Usage

From source file:Main.java

public static String getCPU() {
    return Build.CPU_ABI;
}

From source file:Main.java

@TargetApi(4)
public static String getCpuType() {
    return Build.CPU_ABI;
}

From source file:Main.java

public static String getFullSoName(String libname) {
    return libname + "-" + Build.CPU_ABI + ".so";
}

From source file:Main.java

public static String getUniqueId() {
    String m_szDevIDShort = "35" + //we make this look like a valid IMEI
            Build.BOARD.length() % 10 + Build.BRAND.length() % 10 + Build.CPU_ABI.length() % 10
            + Build.DEVICE.length() % 10 + Build.DISPLAY.length() % 10 + Build.HOST.length() % 10
            + Build.ID.length() % 10 + Build.MANUFACTURER.length() % 10 + Build.MODEL.length() % 10
            + Build.PRODUCT.length() % 10 + Build.TAGS.length() % 10 + Build.TYPE.length() % 10
            + Build.USER.length() % 10;//from  w  w w . j  ava2  s. c o  m
    return m_szDevIDShort;
}

From source file:Main.java

/**
 * Whether or not this CPU is using the x86 architecture.
 * //  ww  w  . ja v a 2s  .  com
 * @return true if this CPU uses the x86 architecture; false otherwise.
 */
public static boolean isX86() {
    return Build.CPU_ABI.contains("x86");
}

From source file:Main.java

/**
 * Whether or not this CPU is using the ARM architecture.
 * /*from w  w w.j a va2 s  .c  o m*/
 * @return true if this CPU uses the ARM architecture; false otherwise.
 */
public static boolean isARM() {
    return Build.CPU_ABI.contains("arm");
}

From source file:Main.java

/**
 * Whether or not this CPU is using the MIPS architecture.
 * //from w w w  . ja  va 2s .c  o m
 * @return true if this CPU uses the MIPS architecture; false otherwise.
 */
public static boolean isMIPS() {
    return Build.CPU_ABI.contains("mips");
}

From source file:Main.java

/**
 * Whether or not this CPU is using the ARM64 architecture.
 *
 * @return true if this CPU uses the ARM64 architecture; false otherwise.
 *//* w w w  .  ja v a2s. co  m*/
public static boolean isARM64() {
    return Build.CPU_ABI.contains("arm64");
}

From source file:Main.java

@TargetApi(4)
public static String getCpuInfo() {
    StringBuffer sb = new StringBuffer();
    sb.append("abi: ").append(Build.CPU_ABI).append("\n");
    if (new File("/proc/cpuinfo").exists()) {
        try {//from   w w  w.ja  v  a 2  s  .c o  m
            BufferedReader br = new BufferedReader(new FileReader(new File("/proc/cpuinfo")));
            String aLine;
            while ((aLine = br.readLine()) != null) {
                sb.append(aLine + "\n");
            }
            if (br != null) {
                br.close();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    return sb.toString();
}

From source file:Main.java

/**
 * Generates a pseudo-unique ID according to http://www.pocketmagic.net/android-unique-device-id/
 *///  w ww  .  j a v a2  s  .  c om
static String generateDeviceId() {
    return "35" + //we make this look like a valid IMEI
            Build.BOARD.length() % 10 + Build.BRAND.length() % 10 + Build.CPU_ABI.length() % 10
            + Build.DEVICE.length() % 10 + Build.DISPLAY.length() % 10 + Build.HOST.length() % 10
            + Build.ID.length() % 10 + Build.MANUFACTURER.length() % 10 + Build.MODEL.length() % 10
            + Build.PRODUCT.length() % 10 + Build.TAGS.length() % 10 + Build.TYPE.length() % 10
            + Build.USER.length() % 10; //13 digits
}