diff options
| author | 2009-12-08 09:05:45 -0800 | |
|---|---|---|
| committer | 2009-12-22 10:10:24 -0800 | |
| commit | 484d2888680e18e6ad8c3fcc51e3b70a705a096e (patch) | |
| tree | 22e4a46d917cd9f062803bf053cce1da82cbf570 | |
| parent | 4350e1451c9f884fabcabfda915b58a26c6ebf5f (diff) | |
Fix issue 2299360: Change in in-call volume affects the Bluetooth in-call volume and vice versa.
Add a separate system settings entry for bluetooth SCO volume.
| -rw-r--r-- | api/current.xml | 11 | ||||
| -rw-r--r-- | core/java/android/provider/Settings.java | 10 | ||||
| -rw-r--r-- | media/java/android/media/AudioService.java | 2 | ||||
| -rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java | 25 |
4 files changed, 45 insertions, 3 deletions
diff --git a/api/current.xml b/api/current.xml index d7bc614d19f5..a367f2ead14b 100644 --- a/api/current.xml +++ b/api/current.xml @@ -130819,6 +130819,17 @@ visibility="public" > </field> +<field name="VOLUME_BLUETOOTH_SCO" + type="java.lang.String" + transient="false" + volatile="false" + value=""volume_bluetooth_sco"" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> <field name="VOLUME_MUSIC" type="java.lang.String" transient="false" diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 8c8330335a79..8dc7a5502516 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -1194,6 +1194,12 @@ public final class Settings { public static final String VOLUME_NOTIFICATION = "volume_notification"; /** + * Bluetooth Headset volume. This is used internally, changing this value will + * not change the volume. See AudioManager. + */ + public static final String VOLUME_BLUETOOTH_SCO = "volume_bluetooth_sco"; + + /** * Whether the notifications should use the ring volume (value of 1) or * a separate notification volume (value of 0). In most cases, users * will have this enabled so the notification and ringer volumes will be @@ -1214,7 +1220,7 @@ public final class Settings { */ public static final String[] VOLUME_SETTINGS = { VOLUME_VOICE, VOLUME_SYSTEM, VOLUME_RING, VOLUME_MUSIC, - VOLUME_ALARM, VOLUME_NOTIFICATION + VOLUME_ALARM, VOLUME_NOTIFICATION, VOLUME_BLUETOOTH_SCO }; /** @@ -1472,12 +1478,14 @@ public final class Settings { VOLUME_MUSIC, VOLUME_ALARM, VOLUME_NOTIFICATION, + VOLUME_BLUETOOTH_SCO, VOLUME_VOICE + APPEND_FOR_LAST_AUDIBLE, VOLUME_SYSTEM + APPEND_FOR_LAST_AUDIBLE, VOLUME_RING + APPEND_FOR_LAST_AUDIBLE, VOLUME_MUSIC + APPEND_FOR_LAST_AUDIBLE, VOLUME_ALARM + APPEND_FOR_LAST_AUDIBLE, VOLUME_NOTIFICATION + APPEND_FOR_LAST_AUDIBLE, + VOLUME_BLUETOOTH_SCO + APPEND_FOR_LAST_AUDIBLE, TEXT_AUTO_REPLACE, TEXT_AUTO_CAPS, TEXT_AUTO_PUNCTUATE, diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java index e5837eef237d..96d7027eac9f 100644 --- a/media/java/android/media/AudioService.java +++ b/media/java/android/media/AudioService.java @@ -168,7 +168,7 @@ public class AudioService extends IAudioService.Stub { AudioSystem.STREAM_MUSIC, // STREAM_MUSIC AudioSystem.STREAM_ALARM, // STREAM_ALARM AudioSystem.STREAM_NOTIFICATION, // STREAM_NOTIFICATION - AudioSystem.STREAM_VOICE_CALL, // STREAM_BLUETOOTH_SCO + AudioSystem.STREAM_BLUETOOTH_SCO, // STREAM_BLUETOOTH_SCO AudioSystem.STREAM_SYSTEM, // STREAM_SYSTEM_ENFORCED AudioSystem.STREAM_VOICE_CALL, // STREAM_DTMF AudioSystem.STREAM_MUSIC // STREAM_TTS diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java index e28e9158145a..ac2da9736829 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -71,7 +71,7 @@ public class DatabaseHelper extends SQLiteOpenHelper { // database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion' // is properly propagated through your change. Not doing so will result in a loss of user // settings. - private static final int DATABASE_VERSION = 43; + private static final int DATABASE_VERSION = 44; private Context mContext; @@ -539,6 +539,24 @@ public class DatabaseHelper extends SQLiteOpenHelper { upgradeVersion = 43; } + if (upgradeVersion == 43) { + /* + * This upgrade stores bluetooth volume separately from voice volume + */ + db.beginTransaction(); + try { + SQLiteStatement stmt = db.compileStatement("INSERT OR IGNORE INTO system(name,value)" + + " VALUES(?,?);"); + loadSetting(stmt, Settings.System.VOLUME_BLUETOOTH_SCO, + AudioManager.DEFAULT_STREAM_VOLUME[AudioManager.STREAM_BLUETOOTH_SCO]); + stmt.close(); + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); + } + upgradeVersion = 44; + } + if (upgradeVersion != currentVersion) { Log.w(TAG, "Got stuck trying to upgrade from version " + upgradeVersion + ", must wipe the settings provider"); @@ -691,6 +709,11 @@ public class DatabaseHelper extends SQLiteOpenHelper { stmt, Settings.System.VOLUME_NOTIFICATION, AudioManager.DEFAULT_STREAM_VOLUME[AudioManager.STREAM_NOTIFICATION]); + loadSetting( + stmt, + Settings.System.VOLUME_BLUETOOTH_SCO, + AudioManager.DEFAULT_STREAM_VOLUME[AudioManager.STREAM_BLUETOOTH_SCO]); + loadSetting(stmt, Settings.System.MODE_RINGER, AudioManager.RINGER_MODE_NORMAL); |