Fixed multiple MAP issues.

+ Bluetooth Settings properly stores the MAP state as a shared
preference.
+ A Bluetooth's Settings profile will display MAP even if it was
previously denied.

Bug: 17391677
Change-Id: I94dd7d1a75cc4fe09647c85d84d9e3651a07a673
This commit is contained in:
PauloftheWest
2014-09-24 15:21:30 -07:00
parent 3156e38f5e
commit 00656b8e46
4 changed files with 30 additions and 11 deletions

View File

@@ -133,7 +133,9 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
}
mProfileConnectionState.put(profile, newProfileState);
if (newProfileState == BluetoothProfile.STATE_CONNECTED) {
if (!mProfiles.contains(profile)) {
if (profile instanceof MapProfile) {
profile.setPreferred(mDevice, true);
} else if (!mProfiles.contains(profile)) {
mRemovedProfiles.remove(profile);
mProfiles.add(profile);
if (profile instanceof PanProfile &&
@@ -142,15 +144,8 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
mLocalNapRoleConnected = true;
}
}
if (profile instanceof MapProfile) {
profile.setPreferred(mDevice, true);
}
} else if (profile instanceof MapProfile &&
newProfileState == BluetoothProfile.STATE_DISCONNECTED) {
if (mProfiles.contains(profile)) {
mRemovedProfiles.add(profile);
mProfiles.remove(profile);
}
profile.setPreferred(mDevice, false);
} else if (mLocalNapRoleConnected && profile instanceof PanProfile &&
((PanProfile) profile).isLocalRoleNap(mDevice) &&