diff --git a/packages/CMSettingsProvider/res/values/defaults.xml b/packages/CMSettingsProvider/res/values/defaults.xml index 3b2d741..b9b0601 100644 --- a/packages/CMSettingsProvider/res/values/defaults.xml +++ b/packages/CMSettingsProvider/res/values/defaults.xml @@ -54,4 +54,12 @@ 1==on --> 1 + + false + + + false + + + content://settings/system/notification_sound \ No newline at end of file diff --git a/packages/CMSettingsProvider/src/org/cyanogenmod/cmsettings/CMDatabaseHelper.java b/packages/CMSettingsProvider/src/org/cyanogenmod/cmsettings/CMDatabaseHelper.java index 819739e..97b9c29 100644 --- a/packages/CMSettingsProvider/src/org/cyanogenmod/cmsettings/CMDatabaseHelper.java +++ b/packages/CMSettingsProvider/src/org/cyanogenmod/cmsettings/CMDatabaseHelper.java @@ -228,6 +228,18 @@ public class CMDatabaseHelper extends SQLiteOpenHelper{ loadBooleanSetting(db, CMTableNames.TABLE_SECURE, CMSettings.Secure.STATS_COLLECTION, R.bool.def_stats_collection); + + loadBooleanSetting(db, CMTableNames.TABLE_GLOBAL, + CMSettings.Global.POWER_NOTIFICATIONS_ENABLED, + R.bool.def_power_notifications_enabled); + + loadBooleanSetting(db, CMTableNames.TABLE_GLOBAL, + CMSettings.Global.POWER_NOTIFICATIONS_VIBRATE, + R.bool.def_power_notifications_vibrate); + + loadStringSetting(db, CMTableNames.TABLE_GLOBAL, + CMSettings.Global.POWER_NOTIFICATIONS_RINGTONE, + R.string.def_power_notifications_ringtone); } /** diff --git a/packages/CMSettingsProvider/src/org/cyanogenmod/cmsettings/CMSettingsProvider.java b/packages/CMSettingsProvider/src/org/cyanogenmod/cmsettings/CMSettingsProvider.java index c297e30..2fab5a7 100644 --- a/packages/CMSettingsProvider/src/org/cyanogenmod/cmsettings/CMSettingsProvider.java +++ b/packages/CMSettingsProvider/src/org/cyanogenmod/cmsettings/CMSettingsProvider.java @@ -887,6 +887,54 @@ public class CMSettingsProvider extends ContentProvider { */ public static final String NOTIFICATION_LIGHT_PULSE_CUSTOM_VALUES = CMSettings.System.NOTIFICATION_LIGHT_PULSE_CUSTOM_VALUES; + + /** + * Whether to wake the display when plugging or unplugging the charger + * + * @hide + */ + public static final String WAKE_WHEN_PLUGGED_OR_UNPLUGGED = + CMSettings.Global.WAKE_WHEN_PLUGGED_OR_UNPLUGGED; + + /** {@hide} */ + public static final String BLUETOOTH_A2DP_SRC_PRIORITY_PREFIX = + CMSettings.Global.BLUETOOTH_A2DP_SRC_PRIORITY_PREFIX; + + /** + * Whether to sound when charger power is connected/disconnected + * @hide + */ + public static final String POWER_NOTIFICATIONS_ENABLED = + CMSettings.Global.POWER_NOTIFICATIONS_ENABLED; + + /** + * Whether to vibrate when charger power is connected/disconnected + * @hide + */ + public static final String POWER_NOTIFICATIONS_VIBRATE = + CMSettings.Global.POWER_NOTIFICATIONS_VIBRATE; + + /** + * URI for power notification sounds + * @hide + */ + public static final String POWER_NOTIFICATIONS_RINGTONE = + CMSettings.Global.POWER_NOTIFICATIONS_RINGTONE; + + /** + * @hide + */ + public static final String ZEN_DISABLE_DUCKING_DURING_MEDIA_PLAYBACK = + CMSettings.Global.ZEN_DISABLE_DUCKING_DURING_MEDIA_PLAYBACK; + + /** + * Whether the system auto-configure the priority of the wifi ap's or use + * the manual settings established by the user. + * <> 0 to autoconfigure, 0 to manual settings. Default is <> 0. + * @hide + */ + public static final String WIFI_AUTO_PRIORITIES_CONFIGURATION = + CMSettings.Global.WIFI_AUTO_PRIORITIES_CONFIGURATION; } /** @@ -1118,6 +1166,27 @@ public class CMSettingsProvider extends ContentProvider { rowsMigrated = migrateCMSettingsForTable(userId, CMDatabaseHelper.CMTableNames.TABLE_SECURE, secureToCmSettingsMap); if (LOCAL_LOGV) Log.d(TAG, "Migrated " + rowsMigrated + " to CM secure table"); + + // Migrate global settings + HashMap globalToCmSettingsMap = new HashMap(); + globalToCmSettingsMap.put(LegacyCMSettings.WAKE_WHEN_PLUGGED_OR_UNPLUGGED, + CMSettings.Global.WAKE_WHEN_PLUGGED_OR_UNPLUGGED); + globalToCmSettingsMap.put(LegacyCMSettings.BLUETOOTH_A2DP_SRC_PRIORITY_PREFIX, + CMSettings.Global.BLUETOOTH_A2DP_SRC_PRIORITY_PREFIX); + globalToCmSettingsMap.put(LegacyCMSettings.POWER_NOTIFICATIONS_ENABLED, + CMSettings.Global.POWER_NOTIFICATIONS_ENABLED); + globalToCmSettingsMap.put(LegacyCMSettings.POWER_NOTIFICATIONS_VIBRATE, + CMSettings.Global.POWER_NOTIFICATIONS_VIBRATE); + globalToCmSettingsMap.put(LegacyCMSettings.POWER_NOTIFICATIONS_RINGTONE, + CMSettings.Global.POWER_NOTIFICATIONS_RINGTONE); + globalToCmSettingsMap.put(LegacyCMSettings.ZEN_DISABLE_DUCKING_DURING_MEDIA_PLAYBACK, + CMSettings.Global.ZEN_DISABLE_DUCKING_DURING_MEDIA_PLAYBACK); + globalToCmSettingsMap.put(LegacyCMSettings.WIFI_AUTO_PRIORITIES_CONFIGURATION, + CMSettings.Global.WIFI_AUTO_PRIORITIES_CONFIGURATION); + + rowsMigrated = migrateCMSettingsForTable(userId, + CMDatabaseHelper.CMTableNames.TABLE_GLOBAL, globalToCmSettingsMap); + if (LOCAL_LOGV) Log.d(TAG, "Migrated " + rowsMigrated + " to CM global table"); } } diff --git a/src/java/cyanogenmod/providers/CMSettings.java b/src/java/cyanogenmod/providers/CMSettings.java index 0092700..3318037 100644 --- a/src/java/cyanogenmod/providers/CMSettings.java +++ b/src/java/cyanogenmod/providers/CMSettings.java @@ -32,6 +32,7 @@ import android.util.Log; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.regex.Pattern; /** @@ -2223,10 +2224,59 @@ public final class CMSettings { return putStringForUser(cr, name, Float.toString(value), userId); } + /** + * Get the key that retrieves a bluetooth a2dp src's priority. + * @hide + */ + public static final String getBluetoothA2dpSrcPriorityKey(String address) { + return BLUETOOTH_A2DP_SRC_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT); + } // endregion // region Global Settings + /** + * Whether to wake the display when plugging or unplugging the charger + * + * @hide + */ + public static final String WAKE_WHEN_PLUGGED_OR_UNPLUGGED = + "wake_when_plugged_or_unplugged"; + /** {@hide} */ + public static final String + BLUETOOTH_A2DP_SRC_PRIORITY_PREFIX = "bluetooth_a2dp_src_priority_"; + + /** + * Whether to sound when charger power is connected/disconnected + * @hide + */ + public static final String POWER_NOTIFICATIONS_ENABLED = "power_notifications_enabled"; + + /** + * Whether to vibrate when charger power is connected/disconnected + * @hide + */ + public static final String POWER_NOTIFICATIONS_VIBRATE = "power_notifications_vibrate"; + + /** + * URI for power notification sounds + * @hide + */ + public static final String POWER_NOTIFICATIONS_RINGTONE = "power_notifications_ringtone"; + + /** + * @hide + */ + public static final String ZEN_DISABLE_DUCKING_DURING_MEDIA_PLAYBACK = + "zen_disable_ducking_during_media_playback"; + + /** + * Whether the system auto-configure the priority of the wifi ap's or use + * the manual settings established by the user. + * <> 0 to autoconfigure, 0 to manual settings. Default is <> 0. + * @hide + */ + public static final String WIFI_AUTO_PRIORITIES_CONFIGURATION = "wifi_auto_priority"; // endregion } }