android.os.SystemProperties Java Examples
The following examples show how to use
android.os.SystemProperties.
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: StatusInstallerFragment.java From EdXposedManager with GNU General Public License v3.0 | 6 votes |
private void determineVerifiedBootState(View v) { try { String propSystemVerified = SystemProperties.get("partition.system.verified", "0"); String propState = SystemProperties.get("ro.boot.verifiedbootstate", ""); File fileDmVerityModule = new File("/sys/module/dm_verity"); boolean verified = !propSystemVerified.equals("0"); boolean detected = !propState.isEmpty() || fileDmVerityModule.exists(); TextView tv = v.findViewById(R.id.dmverity); if (verified) { tv.setText(R.string.verified_boot_active); tv.setTextColor(getResources().getColor(R.color.warning, null)); } else if (detected) { tv.setText(R.string.verified_boot_deactivated); v.findViewById(R.id.dmverity_explanation).setVisibility(View.GONE); } else { tv.setText(R.string.verified_boot_none); tv.setTextColor(getResources().getColor(R.color.warning, null)); v.findViewById(R.id.dmverity_explanation).setVisibility(View.GONE); } } catch (Exception e) { Log.e(TAG, "Could not detect Verified Boot state", e); } }
Example #2
Source File: RMPowerActionService.java From rebootmenu with GNU General Public License v3.0 | 6 votes |
@TargetApi(M) @Override public void safeMode() { preliminaryPreparation("safeMode"); injectSystemThread(() -> { if (SDK_INT < N) { //ShutdownThread.java // Indicates whether we are rebooting into safe mode //public static final String REBOOT_SAFEMODE_PROPERTY = "persist.sys.safemode"; SystemProperties.set("persist.sys.safemode", "1"); mPowerManager.reboot(null); return; } invokeNoThrowAndReturn(rebootSafeMode, mPowerManager); }); }
Example #3
Source File: DisplayTransformManager.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
/** * Propagates the provided saturation to the SurfaceFlinger. */ private void applySaturation(float saturation) { SystemProperties.set(PERSISTENT_PROPERTY_SATURATION, Float.toString(saturation)); final IBinder flinger = ServiceManager.getService(SURFACE_FLINGER); if (flinger != null) { final Parcel data = Parcel.obtain(); data.writeInterfaceToken("android.ui.ISurfaceComposer"); data.writeFloat(saturation); try { flinger.transact(SURFACE_FLINGER_TRANSACTION_SATURATION, data, null, 0); } catch (RemoteException ex) { Log.e(TAG, "Failed to set saturation", ex); } finally { data.recycle(); } } }
Example #4
Source File: Choreographer.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
private Choreographer(Looper looper, int vsyncSource) { mLooper = looper; mHandler = new FrameHandler(looper); mDisplayEventReceiver = USE_VSYNC ? new FrameDisplayEventReceiver(looper, vsyncSource) : null; mLastFrameTimeNanos = Long.MIN_VALUE; mFrameIntervalNanos = (long)(1000000000 / getRefreshRate()); mCallbackQueues = new CallbackQueue[CALLBACK_LAST + 1]; for (int i = 0; i <= CALLBACK_LAST; i++) { mCallbackQueues[i] = new CallbackQueue(); } // b/68769804: For low FPS experiments. setFPSDivisor(SystemProperties.getInt(ThreadedRenderer.DEBUG_FPS_DIVISOR, 1)); }
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: DreamManagerService.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
@Override public void onBootPhase(int phase) { if (phase == SystemService.PHASE_THIRD_PARTY_APPS_CAN_START) { if (Build.IS_DEBUGGABLE) { SystemProperties.addChangeCallback(mSystemPropertiesChanged); } mContext.registerReceiver(new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { writePulseGestureEnabled(); synchronized (mLock) { stopDreamLocked(false /*immediate*/); } } }, new IntentFilter(Intent.ACTION_USER_SWITCHED), null, mHandler); mContext.getContentResolver().registerContentObserver( Settings.Secure.getUriFor(Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP), false, mDozeEnabledObserver, UserHandle.USER_ALL); writePulseGestureEnabled(); } }
Example #8
Source File: ThreadedRenderer.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
/** * Indicates whether threaded rendering is available under any form for * the view hierarchy. * * @return True if the view hierarchy can potentially be defer rendered, * false otherwise */ public static boolean isAvailable() { if (sSupportsOpenGL != null) { return sSupportsOpenGL.booleanValue(); } if (SystemProperties.getInt("ro.kernel.qemu", 0) == 0) { // Device is not an emulator. sSupportsOpenGL = true; return true; } int qemu_gles = SystemProperties.getInt("qemu.gles", -1); if (qemu_gles == -1) { // In this case, the value of the qemu.gles property is not ready // because the SurfaceFlinger service may not start at this point. return false; } // In the emulator this property will be set > 0 when OpenGL ES 2.0 is // enabled, 0 otherwise. On old emulator versions it will be undefined. sSupportsOpenGL = qemu_gles > 0; return sSupportsOpenGL.booleanValue(); }
Example #9
Source File: ProcessStatsService.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
public ProcessStatsService(ActivityManagerService am, File file) { mAm = am; mBaseDir = file; mBaseDir.mkdirs(); mProcessStats = new ProcessStats(true); updateFile(); SystemProperties.addChangeCallback(new Runnable() { @Override public void run() { synchronized (mAm) { if (mProcessStats.evaluateSystemProperties(false)) { mProcessStats.mFlags |= ProcessStats.FLAG_SYSPROPS; writeStateLocked(true, true); mProcessStats.evaluateSystemProperties(true); } } } }); }
Example #10
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 #11
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 #12
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 #13
Source File: WebViewLibraryLoader.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
/** * Reserve space for the native library to be loaded into. */ static void reserveAddressSpaceInZygote() { System.loadLibrary("webviewchromium_loader"); long addressSpaceToReserve = SystemProperties.getLong(WebViewFactory.CHROMIUM_WEBVIEW_VMSIZE_SIZE_PROPERTY, CHROMIUM_WEBVIEW_DEFAULT_VMSIZE_BYTES); sAddressSpaceReserved = nativeReserveAddressSpace(addressSpaceToReserve); if (sAddressSpaceReserved) { if (DEBUG) { Log.v(LOGTAG, "address space reserved: " + addressSpaceToReserve + " bytes"); } } else { Log.e(LOGTAG, "reserving " + addressSpaceToReserve + " bytes of address space failed"); } }
Example #14
Source File: SpecialSupport.java From rebootmenu with GNU General Public License v3.0 | 5 votes |
/** * 检测是否是MIUI系统 * * @return bool */ public static boolean isMIUI() { //android.os.SystemProperties.get("ro.miui.ui.version.name", ""); // 如果返回值是「V10」,就是 MIUI 10 String miuiVersionName; try { miuiVersionName = SystemProperties.get("ro.miui.ui.version.name", ""); } catch (Throwable throwable) { throwable.printStackTrace(); return false; } Log.d(TAG, "isMIUI: miuiVersionName:" + miuiVersionName); return !TextUtils.isEmpty(miuiVersionName); }
Example #15
Source File: SQLiteGlobal.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * Gets the default database synchronization mode when WAL is not in use. */ public static String getDefaultSyncMode() { // Use the FULL synchronous mode for system processes by default. String defaultMode = sDefaultSyncMode; if (defaultMode != null) { return defaultMode; } return SystemProperties.get("debug.sqlite.syncmode", Resources.getSystem().getString( com.android.internal.R.string.db_default_sync_mode)); }
Example #16
Source File: ActivityManagerShellCommand.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
static void removeWallOption() { String props = SystemProperties.get("dalvik.vm.extra-opts"); if (props != null && props.contains("-Xprofile:wallclock")) { props = props.replace("-Xprofile:wallclock", ""); props = props.trim(); SystemProperties.set("dalvik.vm.extra-opts", props); } }
Example #17
Source File: PowerManagerService.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * Low-level function turn the device off immediately, without trying * to be clean. Most people should use {@link ShutdownThread} for a clean shutdown. * * @param reason code to pass to android_reboot() (e.g. "userrequested"), or null. */ public static void lowLevelShutdown(String reason) { if (reason == null) { reason = ""; } SystemProperties.set("sys.powerctl", "shutdown," + reason); }
Example #18
Source File: ProductUtils.java From letv with Apache License 2.0 | 5 votes |
public static boolean isYunOS() { String hw = ""; try { hw = SystemProperties.get("ro.yunos.hardware", null).toLowerCase(); } catch (Exception e) { } catch (Error e2) { } return !TextUtils.isEmpty(hw) && hw.equals("yunos"); }
Example #19
Source File: HdmiCecLocalDevicePlayback.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
@Override @ServiceThreadOnly protected int getPreferredAddress() { assertRunOnServiceThread(); return SystemProperties.getInt(Constants.PROPERTY_PREFERRED_ADDRESS_PLAYBACK, Constants.ADDR_UNREGISTERED); }
Example #20
Source File: GnssLocationProvider.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
private void subscriptionOrSimChanged(Context context) { if (DEBUG) Log.d(TAG, "received SIM related action: "); TelephonyManager phone = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE); CarrierConfigManager configManager = (CarrierConfigManager) mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE); String mccMnc = phone.getSimOperator(); boolean isKeepLppProfile = false; if (!TextUtils.isEmpty(mccMnc)) { if (DEBUG) Log.d(TAG, "SIM MCC/MNC is available: " + mccMnc); synchronized (mLock) { if (configManager != null) { PersistableBundle b = configManager.getConfig(); if (b != null) { isKeepLppProfile = b.getBoolean(CarrierConfigManager.KEY_PERSIST_LPP_MODE_BOOL); } } if (isKeepLppProfile) { // load current properties for the carrier loadPropertiesFromResource(context, mProperties); String lpp_profile = mProperties.getProperty("LPP_PROFILE"); // set the persist property LPP_PROFILE for the value if (lpp_profile != null) { SystemProperties.set(LPP_PROFILE, lpp_profile); } } else { // reset the persist property SystemProperties.set(LPP_PROFILE, ""); } reloadGpsProperties(context, mProperties); mNIHandler.setSuplEsEnabled(mSuplEsEnabled); } } else { if (DEBUG) Log.d(TAG, "SIM MCC/MNC is still not available"); } }
Example #21
Source File: DexLoadReporter.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
private void registerSecondaryDexForProfiling(String[] dexPaths) { if (!SystemProperties.getBoolean("dalvik.vm.dexopt.secondary", false)) { return; } // Make a copy of the current data directories so that we don't keep the lock // while registering for profiling. The registration will perform I/O to // check for or create the profile. String[] dataDirs; synchronized (mDataDirs) { dataDirs = mDataDirs.toArray(new String[0]); } for (String dexPath : dexPaths) { registerSecondaryDexForProfiling(dexPath, dataDirs); } }
Example #22
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 #23
Source File: LockSettingsService.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
public LockSettingsStorage getStorage() { final LockSettingsStorage storage = new LockSettingsStorage(mContext); storage.setDatabaseOnCreateCallback(new LockSettingsStorage.Callback() { @Override public void initialize(SQLiteDatabase db) { // Get the lockscreen default from a system property, if available boolean lockScreenDisable = SystemProperties.getBoolean( "ro.lockscreen.disable.default", false); if (lockScreenDisable) { storage.writeKeyValue(db, LockPatternUtils.DISABLE_LOCKSCREEN_KEY, "1", 0); } } }); return storage; }
Example #24
Source File: PersistentDataBlockService.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
private void formatIfOemUnlockEnabled() { boolean enabled = doGetOemUnlockEnabled(); if (enabled) { synchronized (mLock) { formatPartitionLocked(true); } } SystemProperties.set(OEM_UNLOCK_PROP, enabled ? "1" : "0"); }
Example #25
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 #26
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 #27
Source File: RecoverySystemService.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * Check if any of the init services is still running. If so, we cannot * start a new uncrypt/setup-bcb/clear-bcb service right away; otherwise * it may break the socket communication since init creates / deletes * the socket (/dev/socket/uncrypt) on service start / exit. */ private boolean checkAndWaitForUncryptService() { for (int retry = 0; retry < SOCKET_CONNECTION_MAX_RETRY; retry++) { final String uncryptService = SystemProperties.get(INIT_SERVICE_UNCRYPT); final String setupBcbService = SystemProperties.get(INIT_SERVICE_SETUP_BCB); final String clearBcbService = SystemProperties.get(INIT_SERVICE_CLEAR_BCB); final boolean busy = "running".equals(uncryptService) || "running".equals(setupBcbService) || "running".equals(clearBcbService); if (DEBUG) { Slog.i(TAG, "retry: " + retry + " busy: " + busy + " uncrypt: [" + uncryptService + "]" + " setupBcb: [" + setupBcbService + "]" + " clearBcb: [" + clearBcbService + "]"); } if (!busy) { return true; } try { Thread.sleep(1000); } catch (InterruptedException e) { Slog.w(TAG, "Interrupted:", e); } } return false; }
Example #28
Source File: CameraServiceProxy.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
public CameraServiceProxy(Context context) { super(context); mContext = context; mHandlerThread = new ServiceThread(TAG, Process.THREAD_PRIORITY_DISPLAY, /*allowTo*/false); mHandlerThread.start(); mHandler = new Handler(mHandlerThread.getLooper(), this); mNotifyNfc = SystemProperties.getInt(NFC_NOTIFICATION_PROP, 0) > 0; if (DEBUG) Slog.v(TAG, "Notify NFC behavior is " + (mNotifyNfc ? "active" : "disabled")); }
Example #29
Source File: DeviceIdentifiersPolicyService.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
@Override public @Nullable String getSerial() throws RemoteException { if (UserHandle.getAppId(Binder.getCallingUid()) != Process.SYSTEM_UID && mContext.checkCallingOrSelfPermission( Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED && mContext.checkCallingOrSelfPermission( Manifest.permission.READ_PRIVILEGED_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) { throw new SecurityException("getSerial requires READ_PHONE_STATE" + " or READ_PRIVILEGED_PHONE_STATE permission"); } return SystemProperties.get("ro.serialno", Build.UNKNOWN); }
Example #30
Source File: SQLiteGlobal.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * Gets the WAL auto-checkpoint integer in database pages. */ public static int getWALAutoCheckpoint() { int value = SystemProperties.getInt("debug.sqlite.wal.autocheckpoint", Resources.getSystem().getInteger( com.android.internal.R.integer.db_wal_autocheckpoint)); return Math.max(1, value); }