Java Code Examples for android.os.Build#SUPPORTED_ABIS
The following examples show how to use
android.os.Build#SUPPORTED_ABIS .
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 File: CrashConstants.java From 920-text-editor-v2 with Apache License 2.0 | 6 votes |
/** * Helper method to create a salt for the crash identifier. * * @param context the context to use. Usually your Activity object. */ @SuppressLint("InlinedApi") @SuppressWarnings("deprecation") private static String createSalt(Context context) { String abiString; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { abiString = Build.SUPPORTED_ABIS[0]; } else { abiString = Build.CPU_ABI; } String fingerprint = "HA" + (Build.BOARD.length() % 10) + (Build.BRAND.length() % 10) + (abiString.length() % 10) + (Build.PRODUCT.length() % 10); String serial = ""; try { serial = android.os.Build.class.getField("SERIAL").get(null).toString(); } catch (Throwable t) { } return fingerprint + ":" + serial; }
Example 2
Source File: PackageManagerShellCommand.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
private static String checkAbiArgument(String abi) { if (TextUtils.isEmpty(abi)) { throw new IllegalArgumentException("Missing ABI argument"); } if ("-".equals(abi)) { return abi; } final String[] supportedAbis = Build.SUPPORTED_ABIS; for (String supportedAbi : supportedAbis) { if (supportedAbi.equals(abi)) { return abi; } } throw new IllegalArgumentException("ABI " + abi + " not supported on this device"); }
Example 3
Source File: PluginManagerService.java From Android-Plugin-Framework with MIT License | 6 votes |
private static ArrayList<String> getSupportedAbis() { ArrayList<String> abiList = new ArrayList<>(); String defaultAbi = (String) RefInvoker.getField(FairyGlobal.getHostApplication().getApplicationInfo(), ApplicationInfo.class, "primaryCpuAbi"); abiList.add(defaultAbi); if (Build.VERSION.SDK_INT >= 21) { String[] abis = Build.SUPPORTED_ABIS; if (abis != null) { for (String abi: abis) { abiList.add(abi); } } } else { abiList.add(Build.CPU_ABI); abiList.add(Build.CPU_ABI2); abiList.add("armeabi"); } return abiList; }
Example 4
Source File: AndroidFFMPEGLocator.java From cythara with GNU General Public License v3.0 | 5 votes |
private boolean isCPUArchitectureSupported(String alias) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { for (String supportedAlias : Build.SUPPORTED_ABIS) { if (supportedAlias.equals(alias)) return true; } return false; } else { return Build.CPU_ABI.equals(alias); } }
Example 5
Source File: SysUtil.java From SoLoader with Apache License 2.0 | 5 votes |
@DoNotOptimize public static String[] getSupportedAbis() { String[] supportedAbis = Build.SUPPORTED_ABIS; TreeSet<String> allowedAbis = new TreeSet<>(); try { // Some devices report both 64-bit and 32-bit ABIs but *actually* run // the process in 32-bit mode. // // Determine the current process bitness and use that to filter // out incompatible ABIs from SUPPORTED_ABIS. if (is64Bit()) { allowedAbis.add(MinElf.ISA.AARCH64.toString()); allowedAbis.add(MinElf.ISA.X86_64.toString()); } else { allowedAbis.add(MinElf.ISA.ARM.toString()); allowedAbis.add(MinElf.ISA.X86.toString()); } } catch (ErrnoException e) { Log.e( TAG, String.format( "Could not read /proc/self/exe. Falling back to default ABI list: %s. errno: %d Err msg: %s", Arrays.toString(supportedAbis), e.errno, e.getMessage())); return Build.SUPPORTED_ABIS; } // Filter out the incompatible ABIs from the list of supported ABIs, // retaining the original order. ArrayList<String> compatibleSupportedAbis = new ArrayList<>(); for (String abi : supportedAbis) { if (allowedAbis.contains(abi)) { compatibleSupportedAbis.add(abi); } } String[] finalAbis = new String[compatibleSupportedAbis.size()]; finalAbis = compatibleSupportedAbis.toArray(finalAbis); return finalAbis; }
Example 6
Source File: CpuAbiUtils.java From Neptune with Apache License 2.0 | 5 votes |
/** * 获取设备支持的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 7
Source File: DeviceUtils.java From AndroidUtilCode with Apache License 2.0 | 5 votes |
/** * 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 8
Source File: DeviceUtils.java From DevUtils with Apache License 2.0 | 5 votes |
/** * 获取支持的指令集 如: [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 9
Source File: DeviceUtils.java From Android-utils with Apache License 2.0 | 5 votes |
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 10
Source File: VLCUtil.java From vlc-example-streamplayer with GNU General Public License v3.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public static String[] getABIList21() { final String[] abis = Build.SUPPORTED_ABIS; if (abis == null || abis.length == 0) return getABIList(); return abis; }
Example 11
Source File: Installer.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
private static void assertValidInstructionSet(String instructionSet) throws InstallerException { for (String abi : Build.SUPPORTED_ABIS) { if (VMRuntime.getInstructionSet(abi).equals(instructionSet)) { return; } } throw new InstallerException("Invalid instruction set: " + instructionSet); }
Example 12
Source File: PackageManagerServiceUtils.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * Verifies that the given string {@code isa} is a valid supported isa on * the running device. */ public static boolean checkISA(String isa) { for (String abi : Build.SUPPORTED_ABIS) { if (VMRuntime.getInstructionSet(abi).equals(isa)) { return true; } } return false; }
Example 13
Source File: InstructionSets.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
public static List<String> getAllInstructionSets() { final String[] allAbis = Build.SUPPORTED_ABIS; final List<String> allInstructionSets = new ArrayList<String>(allAbis.length); for (String abi : allAbis) { final String instructionSet = VMRuntime.getInstructionSet(abi); if (!allInstructionSets.contains(instructionSet)) { allInstructionSets.add(instructionSet); } } return allInstructionSets; }
Example 14
Source File: VPNLaunchHelper.java From Cake-VPN with GNU General Public License v2.0 | 4 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private static String[] getSupportedABIsLollipop() { return Build.SUPPORTED_ABIS; }
Example 15
Source File: CpuInfoActivity.java From DKVideoPlayer with Apache License 2.0 | 4 votes |
@Override protected void initView() { super.initView(); StringBuilder sb = new StringBuilder(); sb.append("\n\n"); sb.append("===================\n"); sb.append(Build.MANUFACTURER).append(" ").append(Build.MODEL).append("\n"); sb.append("===================\n\n"); sb.append("===== CPU =====\n\n"); String str; try { FileReader fr = new FileReader("/proc/cpuinfo"); BufferedReader br = new BufferedReader(fr); while ((str = br.readLine()) != null) { sb.append(str).append("\n"); } br.close(); } catch (IOException e) { //ignore } sb.append("\n"); sb.append("===== ABI =====\n\n"); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { String[] abis = Build.SUPPORTED_ABIS; for (int i = 0; i < abis.length; i++) { sb.append("CPU ABI").append(i).append(":").append(abis[i]).append("\n"); } } sb.append("\n"); sb.append("===== Codecs =====\n\n"); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { int numCodecs = MediaCodecList.getCodecCount(); for (int i = 0; i < numCodecs; i++) { MediaCodecInfo codecInfo = MediaCodecList.getCodecInfoAt(i); String[] types = codecInfo.getSupportedTypes(); for (String type : types) { sb.append(type).append("\n"); sb.append(codecInfo.getName()).append("\n\n"); } } } mCpuInfo.setText(sb.toString()); }
Example 16
Source File: VPNLaunchHelper.java From Cybernet-VPN with GNU General Public License v3.0 | 4 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private static String[] getSupportedABIsLollipop() { return Build.SUPPORTED_ABIS; }
Example 17
Source File: PluginUtils.java From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 | 4 votes |
public static String unzipLibraryFile(String zipFile, String targetDir) { StringBuilder builder = new StringBuilder(); String cpu = '/' + Build.SUPPORTED_ABIS[0] + '/'; int buffer = 4096; // 这里缓冲区我们使用4KB, String strEntry; // 保存每个zip的条目名称 try (FileInputStream fis = new FileInputStream(zipFile); ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis))) { ZipEntry entry; // 每个zip条目的实例 while ((entry = zis.getNextEntry()) != null) { int count; byte[] data = new byte[buffer]; strEntry = entry.getName(); if (!strEntry.endsWith(".so") || !strEntry.contains(cpu)) { continue; } File entryFile = new File(targetDir + strEntry); File entryDir = new File(entryFile.getParent()); if (!entryDir.exists()) { entryDir.mkdirs(); } try (FileOutputStream fos = new FileOutputStream(entryFile); BufferedOutputStream dest = new BufferedOutputStream(fos, buffer)) { while ((count = zis.read(data, 0, buffer)) != -1) { dest.write(data, 0, count); } dest.flush(); builder.append(entryDir.getAbsolutePath()); builder.append(","); } } builder.deleteCharAt(builder.length() - 1); return builder.toString(); } catch (Exception e) { e.printStackTrace(); } return null; }
Example 18
Source File: DefaultCrashProcess.java From BaseProject with MIT License | 4 votes |
private void savePhoneInfo(PrintWriter pw) throws Exception { // 应用的版本名称和版本号 PackageManager pm = mContext.getPackageManager(); PackageInfo pi = pm.getPackageInfo(mContext.getPackageName(), PackageManager.GET_ACTIVITIES); pw.println("Device info:"); pw.print("App Version Name: "); pw.println(pi.versionName); pw.print("App Version Code: "); pw.println(pi.versionCode); // android版本号 pw.print("SDK: "); pw.println(Build.VERSION.SDK_INT); pw.print("OS Version: "); pw.println(Build.VERSION.RELEASE); // 手机制造商 pw.print("Vendor: "); pw.println(Build.MANUFACTURER); // 手机型号 pw.print("Model: "); pw.println(Build.MODEL); // cpu架构 pw.print("CPU ABI: "); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { //noinspection SpellCheckingInspection final String[] abis = Build.SUPPORTED_ABIS; if (null != abis && abis.length > 0) { StringBuilder sb = new StringBuilder(); for (String abi : abis) { sb.append(abi).append(" "); } pw.println(sb.toString()); } } else { //noinspection deprecation pw.println(Build.CPU_ABI); } pw.println("------------------------------------"); pw.println(); }
Example 19
Source File: DeviceUtils.java From Box with Apache License 2.0 | 4 votes |
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public static String[] getSupportedAbis() { return Build.SUPPORTED_ABIS; }
Example 20
Source File: DevicesUtils.java From GravityBox with Apache License 2.0 | 4 votes |
public static String[] getAbis() { return Build.SUPPORTED_ABIS; }