Java Code Examples for android.os.SystemProperties#get()
The following examples show how to use
android.os.SystemProperties#get() .
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: ApplicationPackageManager.java From AndroidComponentPlugin with Apache License 2.0 | 6 votes |
private static ApplicationInfo maybeAdjustApplicationInfo(ApplicationInfo info) { // If we're dealing with a multi-arch application that has both // 32 and 64 bit shared libraries, we might need to choose the secondary // depending on what the current runtime's instruction set is. if (info.primaryCpuAbi != null && info.secondaryCpuAbi != null) { final String runtimeIsa = VMRuntime.getRuntime().vmInstructionSet(); // Get the instruction set that the libraries of secondary Abi is supported. // In presence of a native bridge this might be different than the one secondary Abi used. String secondaryIsa = VMRuntime.getInstructionSet(info.secondaryCpuAbi); final String secondaryDexCodeIsa = SystemProperties.get("ro.dalvik.vm.isa." + secondaryIsa); secondaryIsa = secondaryDexCodeIsa.isEmpty() ? secondaryIsa : secondaryDexCodeIsa; // If the runtimeIsa is the same as the primary isa, then we do nothing. // Everything will be set up correctly because info.nativeLibraryDir will // correspond to the right ISA. if (runtimeIsa.equals(secondaryIsa)) { ApplicationInfo modified = new ApplicationInfo(info); modified.nativeLibraryDir = info.secondaryNativeLibraryDir; return modified; } } return info; }
Example 2
Source File: ApplicationPackageManager.java From AndroidComponentPlugin with Apache License 2.0 | 6 votes |
private static void maybeAdjustApplicationInfo(ApplicationInfo info) { // If we're dealing with a multi-arch application that has both // 32 and 64 bit shared libraries, we might need to choose the secondary // depending on what the current runtime's instruction set is. if (info.primaryCpuAbi != null && info.secondaryCpuAbi != null) { final String runtimeIsa = VMRuntime.getRuntime().vmInstructionSet(); // Get the instruction set that the libraries of secondary Abi is supported. // In presence of a native bridge this might be different than the one secondary Abi used. String secondaryIsa = VMRuntime.getInstructionSet(info.secondaryCpuAbi); final String secondaryDexCodeIsa = SystemProperties.get("ro.dalvik.vm.isa." + secondaryIsa); secondaryIsa = secondaryDexCodeIsa.isEmpty() ? secondaryIsa : secondaryDexCodeIsa; // If the runtimeIsa is the same as the primary isa, then we do nothing. // Everything will be set up correctly because info.nativeLibraryDir will // correspond to the right ISA. if (runtimeIsa.equals(secondaryIsa)) { info.nativeLibraryDir = info.secondaryNativeLibraryDir; } } }
Example 3
Source File: ApplicationPackageManager.java From AndroidComponentPlugin with Apache License 2.0 | 6 votes |
private static ApplicationInfo maybeAdjustApplicationInfo(ApplicationInfo info) { // If we're dealing with a multi-arch application that has both // 32 and 64 bit shared libraries, we might need to choose the secondary // depending on what the current runtime's instruction set is. if (info.primaryCpuAbi != null && info.secondaryCpuAbi != null) { final String runtimeIsa = VMRuntime.getRuntime().vmInstructionSet(); // Get the instruction set that the libraries of secondary Abi is supported. // In presence of a native bridge this might be different than the one secondary Abi used. String secondaryIsa = VMRuntime.getInstructionSet(info.secondaryCpuAbi); final String secondaryDexCodeIsa = SystemProperties.get("ro.dalvik.vm.isa." + secondaryIsa); secondaryIsa = secondaryDexCodeIsa.isEmpty() ? secondaryIsa : secondaryDexCodeIsa; // If the runtimeIsa is the same as the primary isa, then we do nothing. // Everything will be set up correctly because info.nativeLibraryDir will // correspond to the right ISA. if (runtimeIsa.equals(secondaryIsa)) { ApplicationInfo modified = new ApplicationInfo(info); modified.nativeLibraryDir = info.secondaryNativeLibraryDir; return modified; } } return info; }
Example 4
Source File: EMMSystemService.java From product-emm with Apache License 2.0 | 6 votes |
private void publishFirmwareBuildDate() { String buildDate; JSONObject result = new JSONObject(); buildDate = SystemProperties.get(BUILD_DATE_UTC_PROPERTY); try { result.put("buildDate", buildDate); CommonUtils.sendBroadcast(context, Constants.Operation.GET_FIRMWARE_BUILD_DATE, Constants.Code.SUCCESS, Constants.Status.SUCCESSFUL, result.toString()); } catch (JSONException e) { String error = "Failed to create JSON object when publishing OTA progress."; Log.e(TAG, error, e); CommonUtils.sendBroadcast(context, Constants.Operation.GET_FIRMWARE_BUILD_DATE, Constants.Code.FAILURE, Constants.Status.INTERNAL_ERROR, String.valueOf(DEFAULT_STATE_INFO_CODE)); } }
Example 5
Source File: ApplicationPackageManager.java From AndroidComponentPlugin with Apache License 2.0 | 6 votes |
private static ApplicationInfo maybeAdjustApplicationInfo(ApplicationInfo info) { // If we're dealing with a multi-arch application that has both // 32 and 64 bit shared libraries, we might need to choose the secondary // depending on what the current runtime's instruction set is. if (info.primaryCpuAbi != null && info.secondaryCpuAbi != null) { final String runtimeIsa = VMRuntime.getRuntime().vmInstructionSet(); // Get the instruction set that the libraries of secondary Abi is supported. // In presence of a native bridge this might be different than the one secondary Abi used. String secondaryIsa = VMRuntime.getInstructionSet(info.secondaryCpuAbi); final String secondaryDexCodeIsa = SystemProperties.get("ro.dalvik.vm.isa." + secondaryIsa); secondaryIsa = secondaryDexCodeIsa.isEmpty() ? secondaryIsa : secondaryDexCodeIsa; // If the runtimeIsa is the same as the primary isa, then we do nothing. // Everything will be set up correctly because info.nativeLibraryDir will // correspond to the right ISA. if (runtimeIsa.equals(secondaryIsa)) { ApplicationInfo modified = new ApplicationInfo(info); modified.nativeLibraryDir = info.secondaryNativeLibraryDir; return modified; } } return info; }
Example 6
Source File: ApplicationPackageManager.java From AndroidComponentPlugin with Apache License 2.0 | 6 votes |
private static ApplicationInfo maybeAdjustApplicationInfo(ApplicationInfo info) { // If we're dealing with a multi-arch application that has both // 32 and 64 bit shared libraries, we might need to choose the secondary // depending on what the current runtime's instruction set is. if (info.primaryCpuAbi != null && info.secondaryCpuAbi != null) { final String runtimeIsa = VMRuntime.getRuntime().vmInstructionSet(); // Get the instruction set that the libraries of secondary Abi is supported. // In presence of a native bridge this might be different than the one secondary Abi used. String secondaryIsa = VMRuntime.getInstructionSet(info.secondaryCpuAbi); final String secondaryDexCodeIsa = SystemProperties.get("ro.dalvik.vm.isa." + secondaryIsa); secondaryIsa = secondaryDexCodeIsa.isEmpty() ? secondaryIsa : secondaryDexCodeIsa; // If the runtimeIsa is the same as the primary isa, then we do nothing. // Everything will be set up correctly because info.nativeLibraryDir will // correspond to the right ISA. if (runtimeIsa.equals(secondaryIsa)) { ApplicationInfo modified = new ApplicationInfo(info); modified.nativeLibraryDir = info.secondaryNativeLibraryDir; return modified; } } return info; }
Example 7
Source File: ApplicationPackageManager.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
private static ApplicationInfo maybeAdjustApplicationInfo(ApplicationInfo info) { // If we're dealing with a multi-arch application that has both // 32 and 64 bit shared libraries, we might need to choose the secondary // depending on what the current runtime's instruction set is. if (info.primaryCpuAbi != null && info.secondaryCpuAbi != null) { final String runtimeIsa = VMRuntime.getRuntime().vmInstructionSet(); // Get the instruction set that the libraries of secondary Abi is supported. // In presence of a native bridge this might be different than the one secondary Abi used. String secondaryIsa = VMRuntime.getInstructionSet(info.secondaryCpuAbi); final String secondaryDexCodeIsa = SystemProperties.get("ro.dalvik.vm.isa." + secondaryIsa); secondaryIsa = secondaryDexCodeIsa.isEmpty() ? secondaryIsa : secondaryDexCodeIsa; // If the runtimeIsa is the same as the primary isa, then we do nothing. // Everything will be set up correctly because info.nativeLibraryDir will // correspond to the right ISA. if (runtimeIsa.equals(secondaryIsa)) { ApplicationInfo modified = new ApplicationInfo(info); modified.nativeLibraryDir = info.secondaryNativeLibraryDir; return modified; } } return info; }
Example 8
Source File: ProductUtils.java From letv with Apache License 2.0 | 6 votes |
public static String getProductName() { if (!TextUtils.isEmpty(sProductName)) { return sProductName; } try { sProductName = SystemProperties.get(PROPERTY_PRODUCT_NAME, ""); if (TextUtils.isEmpty(sProductName)) { sProductName = SystemProperties.get("persist.product.letv.name", ""); } } catch (Exception e) { } catch (Error e2) { } if (TextUtils.isEmpty(sProductName)) { if (Build.MODEL.toUpperCase().contains(Build.BRAND.toUpperCase())) { sProductName = Build.MODEL; } else { sProductName = Build.BRAND + " " + Build.MODEL; } } else if (isLetv()) { sProductName = "LETV " + sProductName; } sProductName = sProductName.toUpperCase(); return sProductName; }
Example 9
Source File: StorageManagerService.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
/** * Update the zram_enabled system property (which init reads to * decide whether to enable zram) to reflect the zram_enabled * preference (which we can change for experimentation purposes). */ private void refreshZramSettings() { String propertyValue = SystemProperties.get(ZRAM_ENABLED_PROPERTY); if ("".equals(propertyValue)) { return; // System doesn't have zram toggling support } String desiredPropertyValue = Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.ZRAM_ENABLED, 1) != 0 ? "1" : "0"; if (!desiredPropertyValue.equals(propertyValue)) { // Avoid redundant disk writes by setting only if we're // changing the property value. There's no race: we're the // sole writer. SystemProperties.set(ZRAM_ENABLED_PROPERTY, desiredPropertyValue); } }
Example 10
Source File: ZygoteConnection.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * Applies invoke-with system properties to the zygote arguments. * * @param args non-null; zygote args */ public static void applyInvokeWithSystemProperty(Arguments args) { if (args.invokeWith == null && args.niceName != null) { String property = "wrap." + args.niceName; args.invokeWith = SystemProperties.get(property); if (args.invokeWith != null && args.invokeWith.length() == 0) { args.invokeWith = null; } } }
Example 11
Source File: PackageManagerServiceCompilerMapping.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * Return the default compiler filter for compilation. * * We derive that from the traditional "dalvik.vm.dex2oat-filter" property and just make * sure this isn't profile-guided. Returns "speed" in case of invalid (or missing) values. */ public static String getDefaultCompilerFilter() { String value = SystemProperties.get("dalvik.vm.dex2oat-filter"); if (value == null || value.isEmpty()) { return "speed"; } if (!DexFile.isValidCompilerFilter(value) || DexFile.isProfileGuidedCompilerFilter(value)) { return "speed"; } return value; }
Example 12
Source File: OemLockService.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
@Override public boolean isDeviceOemUnlocked() { enforceOemUnlockReadPermission(); String locked = SystemProperties.get(FLASH_LOCK_PROP); switch (locked) { case FLASH_LOCK_UNLOCKED: return true; default: return false; } }
Example 13
Source File: WallpaperManager.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * Return {@link ComponentName} of the default live wallpaper, or * {@code null} if none is defined. * * @hide */ public static ComponentName getDefaultWallpaperComponent(Context context) { ComponentName cn = null; String flat = SystemProperties.get(PROP_WALLPAPER_COMPONENT); if (!TextUtils.isEmpty(flat)) { cn = ComponentName.unflattenFromString(flat); } if (cn == null) { flat = context.getString(com.android.internal.R.string.default_wallpaper_component); if (!TextUtils.isEmpty(flat)) { cn = ComponentName.unflattenFromString(flat); } } // Check if the package exists if (cn != null) { try { final PackageManager packageManager = context.getPackageManager(); packageManager.getPackageInfo(cn.getPackageName(), PackageManager.MATCH_DIRECT_BOOT_AWARE | PackageManager.MATCH_DIRECT_BOOT_UNAWARE); } catch (PackageManager.NameNotFoundException e) { cn = null; } } return cn; }
Example 14
Source File: StorageManagerService.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
@Override public void onDiskCreated(String diskId, int flags) { synchronized (mLock) { final String value = SystemProperties.get(StorageManager.PROP_ADOPTABLE); switch (value) { case "force_on": flags |= DiskInfo.FLAG_ADOPTABLE; break; case "force_off": flags &= ~DiskInfo.FLAG_ADOPTABLE; break; } mDisks.put(diskId, new DiskInfo(diskId, flags)); } }
Example 15
Source File: PersistentDataBlockService.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
@Override public int getFlashLockState() { enforceOemUnlockReadPermission(); String locked = SystemProperties.get(FLASH_LOCK_PROP); switch (locked) { case FLASH_LOCK_LOCKED: return PersistentDataBlockManager.FLASH_LOCK_LOCKED; case FLASH_LOCK_UNLOCKED: return PersistentDataBlockManager.FLASH_LOCK_UNLOCKED; default: return PersistentDataBlockManager.FLASH_LOCK_UNKNOWN; } }
Example 16
Source File: PacManager.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
private String getPacChangeDelay() { final ContentResolver cr = mContext.getContentResolver(); /** Check system properties for the default value then use secure settings value, if any. */ String defaultDelay = SystemProperties.get( "conn." + Settings.Global.PAC_CHANGE_DELAY, DEFAULT_DELAYS); String val = Settings.Global.getString(cr, Settings.Global.PAC_CHANGE_DELAY); return (val == null) ? defaultDelay : val; }
Example 17
Source File: PropConfig.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
public static String[] getStringArray(Context context, String propName, int resId) { final String prop = SystemProperties.get(propName, UNSET); return !UNSET.equals(prop) ? prop.split(",") : context.getResources().getStringArray(resId); }
Example 18
Source File: SQLiteGlobal.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
/** * Gets the default journal mode when WAL is not in use. */ public static String getDefaultJournalMode() { return SystemProperties.get("debug.sqlite.journalmode", Resources.getSystem().getString( com.android.internal.R.string.db_default_journal_mode)); }
Example 19
Source File: NativeDaemonConnector.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
private static boolean isShuttingDown() { String shutdownAct = SystemProperties.get( ShutdownThread.SHUTDOWN_ACTION_PROPERTY, ""); return shutdownAct != null && shutdownAct.length() > 0; }
Example 20
Source File: InstructionSets.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
/** * Returns the instruction set that should be used to compile dex code. In the presence of * a native bridge this might be different than the one shared libraries use. */ public static String getDexCodeInstructionSet(String sharedLibraryIsa) { // TODO b/19550105 Build mapping once instead of querying each time String dexCodeIsa = SystemProperties.get("ro.dalvik.vm.isa." + sharedLibraryIsa); return TextUtils.isEmpty(dexCodeIsa) ? sharedLibraryIsa : dexCodeIsa; }