Changes done to update UI with appropriate checkbox state, when AVRC Connect is initiated from the headset.

Earlier, the checkbox state was not being updated when the connection state changed for media audio, when connected from headset

Change-Id: Ic46a8a87b74cbe76f0e8b62428516af5594526ec
This commit is contained in:
Sreenidhi T
2012-05-16 04:25:31 -07:00
committed by Matthew Xie
parent 737a30f593
commit c7b490c7a0
2 changed files with 7 additions and 3 deletions

View File

@@ -167,11 +167,15 @@ final class A2dpProfile implements LocalBluetoothProfile {
int state = mService.getConnectionState(device); int state = mService.getConnectionState(device);
switch (state) { switch (state) {
case BluetoothProfile.STATE_DISCONNECTED: case BluetoothProfile.STATE_DISCONNECTED:
{
setPreferred(device, false);
return R.string.bluetooth_a2dp_profile_summary_use_for; return R.string.bluetooth_a2dp_profile_summary_use_for;
}
case BluetoothProfile.STATE_CONNECTED: case BluetoothProfile.STATE_CONNECTED:
{
setPreferred(device, true);
return R.string.bluetooth_a2dp_profile_summary_connected; return R.string.bluetooth_a2dp_profile_summary_connected;
}
default: default:
return Utils.getConnectionStateSummary(state); return Utils.getConnectionStateSummary(state);
} }

View File

@@ -332,8 +332,8 @@ public final class DeviceProfilesSettings extends SettingsPreferenceFragment
* Gray out checkbox while connecting and disconnecting * Gray out checkbox while connecting and disconnecting
*/ */
profilePref.setEnabled(!mCachedDevice.isBusy()); profilePref.setEnabled(!mCachedDevice.isBusy());
profilePref.setChecked(profile.isPreferred(device));
profilePref.setSummary(profile.getSummaryResourceForDevice(device)); profilePref.setSummary(profile.getSummaryResourceForDevice(device));
profilePref.setChecked(profile.isPreferred(device));
} }
private LocalBluetoothProfile getProfileOf(Preference pref) { private LocalBluetoothProfile getProfileOf(Preference pref) {