use of android.database.sqlite.SQLiteStatement in project android_frameworks_base by ResurrectionRemix.
the class DatabaseHelper method loadVibrateSetting.
private void loadVibrateSetting(SQLiteDatabase db, boolean deleteOld) {
if (deleteOld) {
db.execSQL("DELETE FROM system WHERE name='" + Settings.System.VIBRATE_ON + "'");
}
SQLiteStatement stmt = null;
try {
stmt = db.compileStatement("INSERT OR IGNORE INTO system(name,value)" + " VALUES(?,?);");
// Vibrate on by default for ringer, on for notification
int vibrate = 0;
vibrate = AudioSystem.getValueForVibrateSetting(vibrate, AudioManager.VIBRATE_TYPE_NOTIFICATION, AudioManager.VIBRATE_SETTING_ONLY_SILENT);
vibrate |= AudioSystem.getValueForVibrateSetting(vibrate, AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_ONLY_SILENT);
loadSetting(stmt, Settings.System.VIBRATE_ON, vibrate);
} finally {
if (stmt != null)
stmt.close();
}
}
use of android.database.sqlite.SQLiteStatement in project android_frameworks_base by ResurrectionRemix.
the class DatabaseHelper method upgradeScreenTimeout.
private void upgradeScreenTimeout(SQLiteDatabase db) {
// Change screen timeout to current default
db.beginTransaction();
SQLiteStatement stmt = null;
try {
stmt = db.compileStatement("INSERT OR REPLACE INTO system(name,value)" + " VALUES(?,?);");
loadIntegerSetting(stmt, Settings.System.SCREEN_OFF_TIMEOUT, R.integer.def_screen_off_timeout);
db.setTransactionSuccessful();
} finally {
db.endTransaction();
if (stmt != null)
stmt.close();
}
}
use of android.database.sqlite.SQLiteStatement in project android_frameworks_base by ResurrectionRemix.
the class DatabaseHelper method upgradeVibrateSettingFromNone.
private void upgradeVibrateSettingFromNone(SQLiteDatabase db) {
int vibrateSetting = getIntValueFromSystem(db, Settings.System.VIBRATE_ON, 0);
// If the ringer vibrate value is invalid, set it to the default
if ((vibrateSetting & 3) == AudioManager.VIBRATE_SETTING_OFF) {
vibrateSetting = AudioSystem.getValueForVibrateSetting(0, AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_ONLY_SILENT);
}
// Apply the same setting to the notification vibrate value
vibrateSetting = AudioSystem.getValueForVibrateSetting(vibrateSetting, AudioManager.VIBRATE_TYPE_NOTIFICATION, vibrateSetting);
SQLiteStatement stmt = null;
try {
stmt = db.compileStatement("INSERT OR REPLACE INTO system(name,value)" + " VALUES(?,?);");
loadSetting(stmt, Settings.System.VIBRATE_ON, vibrateSetting);
} finally {
if (stmt != null)
stmt.close();
}
}
use of android.database.sqlite.SQLiteStatement in project android_frameworks_base by ResurrectionRemix.
the class DatabaseHelper method loadSecureSettings.
private void loadSecureSettings(SQLiteDatabase db) {
SQLiteStatement stmt = null;
try {
stmt = db.compileStatement("INSERT OR IGNORE INTO secure(name,value)" + " VALUES(?,?);");
loadStringSetting(stmt, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, R.string.def_location_providers_allowed);
String wifiWatchList = SystemProperties.get("ro.com.android.wifi-watchlist");
if (!TextUtils.isEmpty(wifiWatchList)) {
loadSetting(stmt, Settings.Secure.WIFI_WATCHDOG_WATCH_LIST, wifiWatchList);
}
// Don't do this. The SystemServer will initialize ADB_ENABLED from a
// persistent system property instead.
//loadSetting(stmt, Settings.Secure.ADB_ENABLED, 0);
// Allow mock locations default, based on build
loadSetting(stmt, Settings.Secure.ALLOW_MOCK_LOCATION, "1".equals(SystemProperties.get("ro.allow.mock.location")) ? 1 : 0);
loadSecure35Settings(stmt);
loadBooleanSetting(stmt, Settings.Secure.MOUNT_PLAY_NOTIFICATION_SND, R.bool.def_mount_play_notification_snd);
loadBooleanSetting(stmt, Settings.Secure.MOUNT_UMS_AUTOSTART, R.bool.def_mount_ums_autostart);
loadBooleanSetting(stmt, Settings.Secure.MOUNT_UMS_PROMPT, R.bool.def_mount_ums_prompt);
loadBooleanSetting(stmt, Settings.Secure.MOUNT_UMS_NOTIFY_ENABLED, R.bool.def_mount_ums_notify_enabled);
loadBooleanSetting(stmt, Settings.Secure.ACCESSIBILITY_SCRIPT_INJECTION, R.bool.def_accessibility_script_injection);
loadStringSetting(stmt, Settings.Secure.ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS, R.string.def_accessibility_web_content_key_bindings);
loadIntegerSetting(stmt, Settings.Secure.LONG_PRESS_TIMEOUT, R.integer.def_long_press_timeout_millis);
loadBooleanSetting(stmt, Settings.Secure.TOUCH_EXPLORATION_ENABLED, R.bool.def_touch_exploration_enabled);
loadBooleanSetting(stmt, Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD, R.bool.def_accessibility_speak_password);
loadStringSetting(stmt, Settings.Secure.ACCESSIBILITY_SCREEN_READER_URL, R.string.def_accessibility_screen_reader_url);
if (SystemProperties.getBoolean("ro.lockscreen.disable.default", false) == true) {
loadSetting(stmt, Settings.System.LOCKSCREEN_DISABLED, "1");
} else {
loadBooleanSetting(stmt, Settings.System.LOCKSCREEN_DISABLED, R.bool.def_lockscreen_disabled);
}
loadBooleanSetting(stmt, Settings.Secure.SCREENSAVER_ENABLED, com.android.internal.R.bool.config_dreamsEnabledByDefault);
loadBooleanSetting(stmt, Settings.Secure.SCREENSAVER_ACTIVATE_ON_DOCK, com.android.internal.R.bool.config_dreamsActivatedOnDockByDefault);
loadBooleanSetting(stmt, Settings.Secure.SCREENSAVER_ACTIVATE_ON_SLEEP, com.android.internal.R.bool.config_dreamsActivatedOnSleepByDefault);
loadStringSetting(stmt, Settings.Secure.SCREENSAVER_COMPONENTS, com.android.internal.R.string.config_dreamsDefaultComponent);
loadStringSetting(stmt, Settings.Secure.SCREENSAVER_DEFAULT_COMPONENT, com.android.internal.R.string.config_dreamsDefaultComponent);
loadBooleanSetting(stmt, Settings.Secure.DOZE_ENABLED, R.bool.def_dozeEnabledByDefault);
loadBooleanSetting(stmt, Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, R.bool.def_accessibility_display_magnification_enabled);
loadFractionSetting(stmt, Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE, R.fraction.def_accessibility_display_magnification_scale, 1);
loadBooleanSetting(stmt, Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE, R.bool.def_accessibility_display_magnification_auto_update);
loadBooleanSetting(stmt, Settings.Secure.USER_SETUP_COMPLETE, R.bool.def_user_setup_complete);
loadStringSetting(stmt, Settings.Secure.IMMERSIVE_MODE_CONFIRMATIONS, R.string.def_immersive_mode_confirmations);
loadBooleanSetting(stmt, Settings.Secure.INSTALL_NON_MARKET_APPS, R.bool.def_install_non_market_apps);
loadBooleanSetting(stmt, Settings.Secure.WAKE_GESTURE_ENABLED, R.bool.def_wake_gesture_enabled);
loadIntegerSetting(stmt, Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, R.integer.def_lock_screen_show_notifications);
loadBooleanSetting(stmt, Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, R.bool.def_lock_screen_allow_private_notifications);
loadIntegerSetting(stmt, Settings.Secure.SLEEP_TIMEOUT, R.integer.def_sleep_timeout);
/*
* IMPORTANT: Do not add any more upgrade steps here as the global,
* secure, and system settings are no longer stored in a database
* but are kept in memory and persisted to XML.
*
* See: SettingsProvider.UpgradeController#onUpgradeLocked
*/
} finally {
if (stmt != null)
stmt.close();
}
}
use of android.database.sqlite.SQLiteStatement in project android_frameworks_base by ResurrectionRemix.
the class DatabaseHelper method upgradeScreenTimeoutFromNever.
private void upgradeScreenTimeoutFromNever(SQLiteDatabase db) {
// See if the timeout is -1 (for "Never").
Cursor c = db.query(TABLE_SYSTEM, new String[] { "_id", "value" }, "name=? AND value=?", new String[] { Settings.System.SCREEN_OFF_TIMEOUT, "-1" }, null, null, null);
SQLiteStatement stmt = null;
if (c.getCount() > 0) {
c.close();
try {
stmt = db.compileStatement("INSERT OR REPLACE INTO system(name,value)" + " VALUES(?,?);");
// Set the timeout to 30 minutes in milliseconds
loadSetting(stmt, Settings.System.SCREEN_OFF_TIMEOUT, Integer.toString(30 * 60 * 1000));
} finally {
if (stmt != null)
stmt.close();
}
} else {
c.close();
}
}
Aggregations