Java Code Examples for android.os.Build#CPU_ABI2

The following examples show how to use android.os.Build#CPU_ABI2 . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: MobileInfo   File: CpuInfo.java    License: Apache License 2.0 8 votes vote down vote up
private static String putCpuAbi() {
    String[] abis;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        abis = Build.SUPPORTED_ABIS;
    } else {
        abis = new String[]{Build.CPU_ABI, Build.CPU_ABI2};
    }
    StringBuilder stringBuilder = new StringBuilder();
    for (String abi : abis) {
        stringBuilder.append(abi);
        stringBuilder.append(",");
    }

    try {
        return stringBuilder.toString().substring(0, stringBuilder.toString().length() - 1);
    } catch (Exception e) {
        Log.i(TAG, e.toString());
    }
    return null;

}
 
Example 2
private static String writeMiniVPN(Context context) {
    String[] abis;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
        abis = getSupportedABIsLollipop();
    else
        //noinspection deprecation
        abis = new String[]{Build.CPU_ABI, Build.CPU_ABI2};

    String nativeAPI = NativeUtils.getNativeAPI();
    if (!nativeAPI.equals(abis[0])) {
        VpnStatus.logWarning(R.string.abi_mismatch, Arrays.toString(abis), nativeAPI);
        abis = new String[]{nativeAPI};
    }

    for (String abi : abis) {

        File vpnExecutable = new File(context.getCacheDir(), "c_" + getMiniVPNExecutableName() + "." + abi);
        if ((vpnExecutable.exists() && vpnExecutable.canExecute()) || writeMiniVPNBinary(context, abi, vpnExecutable)) {
            return vpnExecutable.getPath();
        }
    }

    throw new RuntimeException("Cannot find any execulte for this device's ABIs " + abis.toString());
}
 
Example 3
private static String writeMiniVPN(Context context) {
    String[] abis;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) abis = getSupportedABIsLollipop();
    else
        //noinspection deprecation
        abis = new String[]{Build.CPU_ABI, Build.CPU_ABI2};
    String nativeAPI = NativeUtils.getNativeAPI();
    if (!nativeAPI.equals(abis[0])) {
        VpnStatus.logWarning(R.string.abi_mismatch, Arrays.toString(abis), nativeAPI);
        abis = new String[]{nativeAPI};
    }
    for (String abi : abis) {
        File vpnExecutable = new File(context.getCacheDir(), getMiniVPNExecutableName() + "." + abi);
        if ((vpnExecutable.exists() && vpnExecutable.canExecute()) || writeMiniVPNBinary(context, abi, vpnExecutable)) {
            return vpnExecutable.getPath();
        }
    }
    return null;
}
 
Example 4
private static String writeMiniVPN(Context context) {
       String[] abis;
       if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
           abis = getSupportedABIsLollipop();
       else
           //noinspection deprecation
           abis = new String[]{Build.CPU_ABI, Build.CPU_ABI2};

       String nativeAPI = NativeUtils.getNativeAPI();
       if (!nativeAPI.equals(abis[0])) {
           VpnStatus.logWarning(R.string.abi_mismatch, Arrays.toString(abis), nativeAPI);
           abis = new String[] {nativeAPI};
       }

       for (String abi: abis) {

           File vpnExecutable = new File(context.getCacheDir(), getMiniVPNExecutableName() + "." + abi);
           if ((vpnExecutable.exists() && vpnExecutable.canExecute()) || writeMiniVPNBinary(context, abi, vpnExecutable)) {
               return vpnExecutable.getPath();
           }
       }

       return null;
}
 
Example 5
public static String getDeviceDetails(Context context) {

        return "Device Information\n"
                + "\nAPP.VERSION : " + getAppVersion(context)
                + "\nLAUNCHER.APP : " + getCurrentLauncherApp(context)
                + "\nTIMEZONE : " + timeZone()
                + "\nVERSION.RELEASE : " + Build.VERSION.RELEASE
                + "\nVERSION.INCREMENTAL : " + Build.VERSION.INCREMENTAL
                + "\nVERSION.SDK.NUMBER : " + Build.VERSION.SDK_INT
                + "\nBRAND : " + Build.BRAND
                + "\nCPU_ABI : " + Build.CPU_ABI
                + "\nCPU_ABI2 : " + Build.CPU_ABI2
                + "\nMANUFACTURER : " + Build.MANUFACTURER
                + "\nMODEL : " + Build.MODEL
                + "\nPRODUCT : " + Build.PRODUCT;

    }
 
Example 6
private static String writeMiniVPN(Context context) {
    String[] abis;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) abis = getSupportedABIsLollipop();
    else
        //noinspection deprecation
        abis = new String[]{Build.CPU_ABI, Build.CPU_ABI2};
    String nativeAPI = NativeUtils.getNativeAPI();
    if (!nativeAPI.equals(abis[0])) {
        VpnStatus.logWarning(R.string.abi_mismatch, Arrays.toString(abis), nativeAPI);
        abis = new String[]{nativeAPI};
    }
    for (String abi : abis) {
        File vpnExecutable = new File(context.getCacheDir(), getMiniVPNExecutableName() + "." + abi);
        if ((vpnExecutable.exists() && vpnExecutable.canExecute()) || writeMiniVPNBinary(context, abi, vpnExecutable)) {
            return vpnExecutable.getPath();
        }
    }
    return null;
}
 
Example 7
private static String writeMiniVPN(Context context) {
       String[] abis;
       if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
           abis = getSupportedABIsLollipop();
       else
           //noinspection deprecation
           abis = new String[]{Build.CPU_ABI, Build.CPU_ABI2};

       String nativeAPI = NativeUtils.getNativeAPI();
       if (!nativeAPI.equals(abis[0])) {
           VpnStatus.logWarning(R.string.abi_mismatch, Arrays.toString(abis), nativeAPI);
           abis = new String[] {nativeAPI};
       }

       for (String abi: abis) {

           File vpnExecutable = new File(context.getCacheDir(), getMiniVPNExecutableName() + "." + abi);
           if ((vpnExecutable.exists() && vpnExecutable.canExecute()) || writeMiniVPNBinary(context, abi, vpnExecutable)) {
               return vpnExecutable.getPath();
           }
       }

       return null;
}
 
Example 8
private static @NonNull Iterable<String> getSupportedAbis() {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    return Arrays.asList(Build.SUPPORTED_ABIS);
  } else {
    LinkedList<String> abis = new LinkedList<>();
    abis.add(Build.CPU_ABI);
    if (Build.CPU_ABI2 != null && !"unknown".equals(Build.CPU_ABI2)) {
      abis.add(Build.CPU_ABI2);
    }
    return abis;
  }
}
 
Example 9
Source Project: SoLoader   File: SysUtil.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Return an list of ABIs we supported on this device ordered according to preference. Use a
 * separate inner class to isolate the version-dependent call where it won't cause the whole class
 * to fail preverification.
 *
 * @return Ordered array of supported ABIs
 */
public static String[] getSupportedAbis() {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    return MarshmallowSysdeps.getSupportedAbis();
  } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    return LollipopSysdeps.getSupportedAbis();
  } else {
    return new String[] {Build.CPU_ABI, Build.CPU_ABI2};
  }
}
 
Example 10
Source Project: Android-utils   File: DeviceUtils.java    License: Apache License 2.0 5 votes vote down vote up
public static String[] getABIs() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        return Build.SUPPORTED_ABIS;
    } else {
        if (!TextUtils.isEmpty(Build.CPU_ABI2)) {
            return new String[]{Build.CPU_ABI, Build.CPU_ABI2};
        }
        return new String[]{Build.CPU_ABI};
    }
}
 
Example 11
Source Project: QPM   File: BasicInfoUtils.java    License: Apache License 2.0 5 votes vote down vote up
private static String getCPUType() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        return join(",", Build.SUPPORTED_ABIS);
    } else {
        if (!TextUtils.isEmpty(Build.CPU_ABI2)) {
            return Build.CPU_ABI + "," + Build.CPU_ABI2;
        }
        return Build.CPU_ABI;
    }
}
 
Example 12
Source Project: ReLinker   File: SystemLibraryLoader.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public String[] supportedAbis() {
    if (Build.VERSION.SDK_INT >= 21 && Build.SUPPORTED_ABIS.length > 0) {
        return Build.SUPPORTED_ABIS;
    } else if (!TextUtils.isEmpty(Build.CPU_ABI2)) {
        return new String[] {Build.CPU_ABI, Build.CPU_ABI2};
    } else {
        return new String[] {Build.CPU_ABI};
    }
}
 
Example 13
Source Project: DevUtils   File: DeviceUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 获取支持的指令集 如: [arm64-v8a, armeabi-v7a, armeabi]
 * @return 支持的指令集
 */
public static String[] getABIs() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        return Build.SUPPORTED_ABIS;
    } else {
        if (!TextUtils.isEmpty(Build.CPU_ABI2)) {
            return new String[]{Build.CPU_ABI, Build.CPU_ABI2};
        }
        return new String[]{Build.CPU_ABI};
    }
}
 
Example 14
Source Project: Common   File: DeviceUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Return an ordered list of ABIs supported by this device. The most preferred ABI is the first
 * element in the list.
 *
 * @return an ordered list of ABIs supported by this device
 */
public static String[] getABIs() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        return Build.SUPPORTED_ABIS;
    } else {
        if (!TextUtils.isEmpty(Build.CPU_ABI2)) {
            return new String[]{Build.CPU_ABI, Build.CPU_ABI2};
        }
        return new String[]{Build.CPU_ABI};
    }
}
 
Example 15
Source Project: Neptune   File: CpuAbiUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 获取设备支持的abi列表
 */
public static String[] getSupportAbis() {
    String[] cpuAbis;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        cpuAbis = Build.SUPPORTED_ABIS;
    } else {
        cpuAbis = new String[]{Build.CPU_ABI, Build.CPU_ABI2};
    }
    // avoid NPE
    if (cpuAbis == null) {
        cpuAbis = new String[0];
    }

    return cpuAbis;
}
 
Example 16
/**
 * The most preferred ABI is the first element in the list.
 */
@TargetApi(21)
@SuppressWarnings("deprecation")
public static String[] getAbis() {
    if (Build.VERSION.SDK_INT >= 21) {
        return Build.SUPPORTED_ABIS;
    }
    return new String[]{Build.CPU_ABI, Build.CPU_ABI2};
}
 
Example 17
Source Project: CrashReporter   File: AppUtils.java    License: Apache License 2.0 5 votes vote down vote up
public static String getDeviceDetails(Context context) {

        return "Device Information\n"
                + "\nDEVICE.ID : " + getDeviceId(context)
                + "\nUSER.ID : " + getUserIdentity(context)
                + "\nAPP.VERSION : " + getAppVersion(context)
                + "\nLAUNCHER.APP : " + getCurrentLauncherApp(context)
                + "\nTIMEZONE : " + timeZone()
                + "\nVERSION.RELEASE : " + Build.VERSION.RELEASE
                + "\nVERSION.INCREMENTAL : " + Build.VERSION.INCREMENTAL
                + "\nVERSION.SDK.NUMBER : " + Build.VERSION.SDK_INT
                + "\nBOARD : " + Build.BOARD
                + "\nBOOTLOADER : " + Build.BOOTLOADER
                + "\nBRAND : " + Build.BRAND
                + "\nCPU_ABI : " + Build.CPU_ABI
                + "\nCPU_ABI2 : " + Build.CPU_ABI2
                + "\nDISPLAY : " + Build.DISPLAY
                + "\nFINGERPRINT : " + Build.FINGERPRINT
                + "\nHARDWARE : " + Build.HARDWARE
                + "\nHOST : " + Build.HOST
                + "\nID : " + Build.ID
                + "\nMANUFACTURER : " + Build.MANUFACTURER
                + "\nMODEL : " + Build.MODEL
                + "\nPRODUCT : " + Build.PRODUCT
                + "\nSERIAL : " + Build.SERIAL
                + "\nTAGS : " + Build.TAGS
                + "\nTIME : " + Build.TIME
                + "\nTYPE : " + Build.TYPE
                + "\nUNKNOWN : " + Build.UNKNOWN
                + "\nUSER : " + Build.USER;
    }
 
Example 18
Source Project: AndroidUtilCode   File: DeviceUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Return an ordered list of ABIs supported by this device. The most preferred ABI is the first
 * element in the list.
 *
 * @return an ordered list of ABIs supported by this device
 */
public static String[] getABIs() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        return Build.SUPPORTED_ABIS;
    } else {
        if (!TextUtils.isEmpty(Build.CPU_ABI2)) {
            return new String[]{Build.CPU_ABI, Build.CPU_ABI2};
        }
        return new String[]{Build.CPU_ABI};
    }
}
 
Example 19
private String donexteabi() {
    switch (currentEabi++) {
        case 0:
            return Build.CPU_ABI;
        case 1:
            return Build.CPU_ABI2;
    }
    return null;
}
 
Example 20
Source Project: QPM   File: DeviceUtils.java    License: Apache License 2.0 3 votes vote down vote up
public static String getABI() {
	String CPU_ABI = Build.CPU_ABI;
	String CPU_ABI2 = Build.CPU_ABI2;
	
	

	return CPU_ABI + " " + CPU_ABI2;
}