@Override public String getRegion() { return getProperty(IDevice.PROP_DEVICE_REGION); } }
@Override public int getDensity() { String densityValue = getProperty(IDevice.PROP_DEVICE_DENSITY); if (densityValue == null) { densityValue = getProperty(IDevice.PROP_DEVICE_EMULATOR_DENSITY); } if (densityValue != null) { try { return Integer.parseInt(densityValue); } catch (NumberFormatException e) { return -1; } } return -1; }
/** * Returns the density bucket of the device screen. * * @return the density, or 0 if it's unknown. */ public int getDensity() { String densityValue = getProperty(PROP_DEVICE_DENSITY); if (densityValue != null) { return Integer.parseInt(densityValue); } return 0; }
/** * Returns the ABIs supported by this device. The ABIs are sorted in preferred order, with the * first ABI being the most preferred. * @return the list of ABIs. */ @NonNull public List<String> getAbis() { List<String> abis = new ArrayList<>(2); String abi = getProperty(PROP_DEVICE_CPU_ABI); if (abi != null) { abis.add(abi); } abi = getProperty(PROP_DEVICE_CPU_ABI2); if (abi != null) { abis.add(abi); } return abis; }
DeviceFwProvider(Device device) { mDevice = device; mBootJars = AdbUtil.getBootClassPath(mDevice); String deviceAbi = device.getProperty(Device.PROP_DEVICE_CPU_ABI); if (deviceAbi != null) { for (String abi : ABIS) { if (deviceAbi.contains("abi")) { mAbiFolder = abi + "/"; break; } } } }
@NonNull @Override public List<String> getAbis() { /* Try abiList (implemented in L onwards) otherwise fall back to abi and abi2. */ String abiList = getProperty(IDevice.PROP_DEVICE_CPU_ABI_LIST); if(abiList != null) { return Lists.newArrayList(abiList.split(",")); } else { List<String> abis = Lists.newArrayListWithExpectedSize(2); String abi = getProperty(IDevice.PROP_DEVICE_CPU_ABI); if (abi != null) { abis.add(abi); } abi = getProperty(IDevice.PROP_DEVICE_CPU_ABI2); if (abi != null) { abis.add(abi); } return abis; } }
@NonNull @Override public AndroidVersion getVersion() { if (mVersion != null) { return mVersion; } try { String buildApi = getProperty(PROP_BUILD_API_LEVEL); if (buildApi == null) { return AndroidVersion.DEFAULT; } int api = Integer.parseInt(buildApi); String codeName = getProperty(PROP_BUILD_CODENAME); mVersion = new AndroidVersion(api, codeName); return mVersion; } catch (Exception e) { return AndroidVersion.DEFAULT; } }
@Override public boolean supportsFeature(@NonNull HardwareFeature feature) { if (mHardwareCharacteristics == null) { try { String characteristics = getProperty(PROP_BUILD_CHARACTERISTICS); if (characteristics == null) { return false; } mHardwareCharacteristics = Sets.newHashSet(Splitter.on(',').split(characteristics)); } catch (Exception e) { mHardwareCharacteristics = Collections.emptySet(); } } return mHardwareCharacteristics.contains(feature.getCharacteristic()); }
manufacturer = cleanupStringForDisplay(getProperty(PROP_DEVICE_MANUFACTURER)); model = cleanupStringForDisplay(getProperty(PROP_DEVICE_MODEL)); } catch (Exception e) {