Java Code Examples for android.os.SystemProperties#getInt()

The following examples show how to use android.os.SystemProperties#getInt() . 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: DisplayManagerService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
DisplayManagerService(Context context, Injector injector) {
    super(context);
    mInjector = injector;
    mContext = context;
    mHandler = new DisplayManagerHandler(DisplayThread.get().getLooper());
    mUiHandler = UiThread.getHandler();
    mDisplayAdapterListener = new DisplayAdapterListener();
    mSingleDisplayDemoMode = SystemProperties.getBoolean("persist.demo.singledisplay", false);
    Resources resources = mContext.getResources();
    mDefaultDisplayDefaultColorMode = mContext.getResources().getInteger(
            com.android.internal.R.integer.config_defaultDisplayDefaultColorMode);
    mDefaultDisplayTopInset = SystemProperties.getInt(PROP_DEFAULT_DISPLAY_TOP_INSET, -1);
    float[] lux = getFloatArray(resources.obtainTypedArray(
            com.android.internal.R.array.config_minimumBrightnessCurveLux));
    float[] nits = getFloatArray(resources.obtainTypedArray(
            com.android.internal.R.array.config_minimumBrightnessCurveNits));
    mMinimumBrightnessCurve = new Curve(lux, nits);
    mMinimumBrightnessSpline = Spline.createSpline(lux, nits);

    PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
    mGlobalDisplayBrightness = pm.getDefaultScreenBrightnessSetting();
    mCurrentUserId = UserHandle.USER_SYSTEM;

    mSystemReady = false;
}
 
Example 2
Source File: RescueParty.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
private static void executeRescueLevel(Context context) {
    final int level = SystemProperties.getInt(PROP_RESCUE_LEVEL, LEVEL_NONE);
    if (level == LEVEL_NONE) return;

    Slog.w(TAG, "Attempting rescue level " + levelToString(level));
    try {
        executeRescueLevelInternal(context, level);
        EventLogTags.writeRescueSuccess(level);
        logCriticalInfo(Log.DEBUG,
                "Finished rescue level " + levelToString(level));
    } catch (Throwable t) {
        final String msg = ExceptionUtils.getCompleteMessage(t);
        EventLogTags.writeRescueFailure(level, msg);
        logCriticalInfo(Log.ERROR,
                "Failed rescue level " + levelToString(level) + ": " + msg);
    }
}
 
Example 3
Source File: ThreadedRenderer.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * 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 4
Source File: DisplayMetrics.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private static int getDeviceDensity() {
    // qemu.sf.lcd_density can be used to override ro.sf.lcd_density
    // when running in the emulator, allowing for dynamic configurations.
    // The reason for this is that ro.sf.lcd_density is write-once and is
    // set by the init process when it parses build.prop before anything else.
    return SystemProperties.getInt("qemu.sf.lcd_density",
            SystemProperties.getInt("ro.sf.lcd_density", DENSITY_DEFAULT));
}
 
Example 5
Source File: SQLiteGlobal.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the connection pool size when in WAL mode.
 */
public static int getWALConnectionPoolSize() {
    int value = SystemProperties.getInt("debug.sqlite.wal.poolsize",
            Resources.getSystem().getInteger(
            com.android.internal.R.integer.db_connection_pool_size));
    return Math.max(2, value);
}
 
Example 6
Source File: SQLiteGlobal.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 7
Source File: SQLiteGlobal.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the default page size to use when creating a database.
 */
public static int getDefaultPageSize() {
    synchronized (sLock) {
        if (sDefaultPageSize == 0) {
            // If there is an issue accessing /data, something is so seriously
            // wrong that we just let the IllegalArgumentException propagate.
            sDefaultPageSize = new StatFs("/data").getBlockSize();
        }
        return SystemProperties.getInt("debug.sqlite.pagesize", sDefaultPageSize);
    }
}
 
Example 8
Source File: HdmiCecLocalDevicePlayback.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
@ServiceThreadOnly
protected int getPreferredAddress() {
    assertRunOnServiceThread();
    return SystemProperties.getInt(Constants.PROPERTY_PREFERRED_ADDRESS_PLAYBACK,
            Constants.ADDR_UNREGISTERED);
}
 
Example 9
Source File: UserManagerService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
static int getMaxManagedProfiles() {
    // Allow overriding max managed profiles on debuggable builds for testing
    // of multiple profiles.
    if (!Build.IS_DEBUGGABLE) {
        return MAX_MANAGED_PROFILES;
    } else {
        return SystemProperties.getInt("persist.sys.max_profiles",
                MAX_MANAGED_PROFILES);
    }
}
 
Example 10
Source File: CameraServiceProxy.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
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 11
Source File: DisplayManagerService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private void registerWifiDisplayAdapterLocked() {
    if (mContext.getResources().getBoolean(
            com.android.internal.R.bool.config_enableWifiDisplay)
            || SystemProperties.getInt(FORCE_WIFI_DISPLAY_ENABLE, -1) == 1) {
        mWifiDisplayAdapter = new WifiDisplayAdapter(
                mSyncRoot, mContext, mHandler, mDisplayAdapterListener,
                mPersistentDataStore);
        registerDisplayAdapterLocked(mWifiDisplayAdapter);
    }
}
 
Example 12
Source File: PackageManagerServiceUtils.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
/** Returns true if APK Verity is enabled. */
static boolean isApkVerityEnabled() {
    return SystemProperties.getInt("ro.apk_verity.mode", 0) != 0;
}
 
Example 13
Source File: MockableSystemProperties.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
public int getInt(String key, int def) {
    return SystemProperties.getInt(key, def);
}
 
Example 14
Source File: PropConfig.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
public static int getInt(Context context, String propName, int resId) {
    return SystemProperties.getInt(propName, context.getResources().getInteger(resId));
}
 
Example 15
Source File: RescueParty.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
@Override
public int getCount() {
    return SystemProperties.getInt(PROP_RESCUE_BOOT_COUNT, 0);
}
 
Example 16
Source File: SQLiteGlobal.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
/**
 * Gets the journal size limit in bytes.
 */
public static int getJournalSizeLimit() {
    return SystemProperties.getInt("debug.sqlite.journalsizelimit",
            Resources.getSystem().getInteger(
            com.android.internal.R.integer.db_journal_size_limit));
}
 
Example 17
Source File: RescueParty.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
/**
 * Check if we're currently attempting to reboot for a factory reset.
 */
public static boolean isAttemptingFactoryReset() {
    return SystemProperties.getInt(PROP_RESCUE_LEVEL, LEVEL_NONE) == LEVEL_FACTORY_RESET;
}
 
Example 18
Source File: SQLiteGlobal.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
/**
 * The default number of milliseconds that SQLite connection is allowed to be idle before it
 * is closed and removed from the pool.
 */
public static int getIdleConnectionTimeout() {
    return SystemProperties.getInt("debug.sqlite.idle_connection_timeout",
            Resources.getSystem().getInteger(
                    com.android.internal.R.integer.db_default_idle_connection_timeout));
}
 
Example 19
Source File: DisplayTransformManager.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
/**
 * Return true when the color matrix works in linear space.
 */
public static boolean needsLinearColorMatrix() {
    return SystemProperties.getInt(PERSISTENT_PROPERTY_DISPLAY_COLOR,
            DISPLAY_COLOR_UNMANAGED) != DISPLAY_COLOR_UNMANAGED;
}
 
Example 20
Source File: SQLiteDebug.java    From android_9.0.0_r45 with Apache License 2.0 2 votes vote down vote up
/**
 * Determines whether a query should be logged.
 *
 * Reads the "db.log.slow_query_threshold" system property, which can be changed
 * by the user at any time.  If the value is zero, then all queries will
 * be considered slow.  If the value does not exist or is negative, then no queries will
 * be considered slow.
 *
 * This value can be changed dynamically while the system is running.
 * For example, "adb shell setprop db.log.slow_query_threshold 200" will
 * log all queries that take 200ms or longer to run.
 * @hide
 */
public static final boolean shouldLogSlowQuery(long elapsedTimeMillis) {
    int slowQueryMillis = SystemProperties.getInt("db.log.slow_query_threshold", -1);
    return slowQueryMillis >= 0 && elapsedTimeMillis >= slowQueryMillis;
}