本文整理匯總了Java中android.os.Build.CPU_ABI屬性的典型用法代碼示例。如果您正苦於以下問題:Java Build.CPU_ABI屬性的具體用法?Java Build.CPU_ABI怎麽用?Java Build.CPU_ABI使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.os.Build
的用法示例。
在下文中一共展示了Build.CPU_ABI屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: writeMiniVPN
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;
}
示例2: getFirstSupportedAbi
private static String getFirstSupportedAbi() {
String abi1 = "";
if (Build.VERSION.SDK_INT >= 21) {
String[] abis = Build.SUPPORTED_ABIS;
if (abis != null) {
String abistr = "";
//第一個是原生支持的,後麵的是兼容模式.雖然是兼容,但手動加載時很多並不兼容.
abi1 = abis[0];
for (String abi : abis) {
abistr = abistr + abi+",";
}
if(showLog)
Log.e(TAG, "[copySo] supported api:" + abistr);
}
} else {
if(showLog)
Log.e(TAG, "[copySo] supported api:" + Build.CPU_ABI + "--- " + Build.CPU_ABI2);
if (!TextUtils.isEmpty(Build.CPU_ABI)) {
abi1 = Build.CPU_ABI;
} else if (!TextUtils.isEmpty(Build.CPU_ABI2)) {
abi1 = Build.CPU_ABI2;
}
}
return abi1;
}
示例3: onCreate
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_greeter);
attachOnClickView(R.id.buttonLogin);
attachOnClickView(R.id.buttonRegister);
String ABI = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
ABI = Build.SUPPORTED_ABIS[0];
} else {
ABI = Build.CPU_ABI;
}
Log.d("ABI", ABI);
}
示例4: onCreate
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView textView = (TextView)findViewById(R.id.textView);
String cpuArch;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
cpuArch = Build.SUPPORTED_ABIS[0];
} else {
cpuArch = Build.CPU_ABI;
}
textView.setText(cpuArch);
Log.d("ryg", "onCreate cpu arch is "+ cpuArch);
this.loadPlugin(this);
Log.d("ryg", "onCreate classloader is "+ getClassLoader());
}
示例5: createSalt
/**
* 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;
}
示例6: getHandSetInfo
private static String getHandSetInfo() {
String handSetInfo = "手機型號:" + Build.MODEL
+ "\n係統版本:" + Build.VERSION.RELEASE
+ "\n產品型號:" + Build.PRODUCT
+ "\n版本顯示:" + Build.DISPLAY
+ "\n係統定製商:" + Build.BRAND
+ "\n設備參數:" + Build.DEVICE
+ "\n開發代號:" + Build.VERSION.CODENAME
+ "\nSDK版本號:" + Build.VERSION.SDK_INT
+ "\nCPU類型:" + Build.CPU_ABI
+ "\n硬件類型:" + Build.HARDWARE
+ "\n主機:" + Build.HOST
+ "\n生產ID:" + Build.ID
+ "\nROM製造商:" + Build.MANUFACTURER // 這行返回的是rom定製商的名稱
;
Log.e("tt",handSetInfo);
return handSetInfo;
}
示例7: createSalt
@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 = Build.class.getField("SERIAL").get(null).toString();
} catch (Throwable t) {
}
return fingerprint + ":" + serial;
}
示例8: getDeviceDetails
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;
}
示例9: installBinary
private boolean installBinary(Context context){
String binaryDirName = null;
String abi = Build.CPU_ABI;
if (abi.startsWith("armeabi-v7a")) {
binaryDirName = "armeabi-v7a";
}else if(abi.startsWith("x86")) {
binaryDirName = "x86";
}else{
binaryDirName = "armeabi";
}
return install(context, BINARY_DEST_DIR_NAME, binaryDirName, BINARY_FILE_NAME);
}
示例10: isTorchSupported
/**
* Torch is only supported on ARM.
*/
public boolean isTorchSupported() {
String[] abis = Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP ? Build.SUPPORTED_ABIS : new String[]{Build.CPU_ABI};
boolean armSupport = false;
for (String abi : abis) {
if (abi.matches("armeabi-v7a|arm64-v8a")) {
armSupport = true;
break;
}
}
return armSupport;
}
示例11: getValue
static Architecture getValue() {
String arch = Build.CPU_ABI;
if (TextUtils.isEmpty(arch)) {
Fabric.getLogger().d(Fabric.TAG, "Architecture#getValue()::Build.CPU_ABI returned null or empty");
return UNKNOWN;
}
Architecture value = (Architecture) matcher.get(arch.toLowerCase(Locale.US));
if (value == null) {
return UNKNOWN;
}
return value;
}
示例12: getSupportedAbis
/**
* 獲取手機支持的CPU架構
*/
public static String[] getSupportedAbis() {
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 };
}
return abis;
}
示例13: init
private void init() {
isRoot = RootUtil.isRoot();
if (!isRoot) {
tvRootStatus.setVisibility(View.VISIBLE);
return;
}
scriptStorePath = this.getCacheDir().getAbsolutePath();
ZipUtil.unzip(this.getPackageCodePath(), SCRIPT_NAME, scriptStorePath);
String cmd = "chmod 777 " + scriptStorePath + File.separator + Build.CPU_ABI + File.separator + SCRIPT_NAME;
RootUtil.execRootCmd(cmd);
}
示例14: getDeviceListing
/**
*
* @return all involved Build.* parameters and its values
*/
public static String getDeviceListing() {
return "Build.PRODUCT: " + Build.PRODUCT + "\n" +
"Build.MANUFACTURER: " + Build.MANUFACTURER + "\n" +
"Build.BRAND: " + Build.BRAND + "\n" +
"Build.DEVICE: " + Build.DEVICE + "\n" +
"Build.MODEL: " + Build.MODEL + "\n" +
"Build.HARDWARE: " + Build.HARDWARE + "\n" +
"Build.FINGERPRINT: " + Build.FINGERPRINT + "\n" +
"Build.CPU_ABI: " + Build.CPU_ABI + "\n" +
"Build.CPU_ABI2: " + Build.CPU_ABI2 + "\n" +
"Build.HOST: " + Build.HOST;
}
示例15: getCpuArch
public static CpuArch getCpuArch() {
Log.d("Build.CPU_ABI : " + Build.CPU_ABI);
switch (Build.CPU_ABI) {
case X86_CPU:
case X86_64_CPU:
return CpuArch.x86;
case ARM_64_CPU:
case ARM_V7_CPU:
return CpuArch.ARMv7;
default:
return CpuArch.NONE;
}
}