}
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 &&
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) &&
mProfileContainer.addPreference(pbapPref);
}
+ final MapProfile mapProfile = mManager.getProfileManager().getMapProfile();
+ final int mapPermission = mCachedDevice.getMessagePermissionChoice();
+ if (mapPermission != CachedBluetoothDevice.ACCESS_UNKNOWN) {
+ CheckBoxPreference mapPreference = createProfilePreference(mapProfile);
+ mProfileContainer.addPreference(mapPreference);
+ }
+
showOrHideProfileGroup();
}
boolean isConnected =
status == BluetoothProfile.STATE_CONNECTED;
- if (isConnected) {
+ if (profilePref.isChecked()) {
askDisconnect(mManager.getForegroundActivity(), profile);
} else {
+ if (profile instanceof MapProfile) {
+ mCachedDevice.setMessagePermissionChoice(BluetoothDevice.ACCESS_ALLOWED);
+ refreshProfilePreference(profilePref, profile);
+ }
if (profile.isPreferred(device)) {
// profile is preferred but not connected: disable auto-connect
profile.setPreferred(device, false);
public void onClick(DialogInterface dialog, int which) {
device.disconnect(profile);
profile.setPreferred(device.getDevice(), false);
+ if (profile instanceof MapProfile) {
+ device.setMessagePermissionChoice(BluetoothDevice.ACCESS_REJECTED);
+ refreshProfilePreference(
+ (CheckBoxPreference)findPreference(profile.toString()), profile);
+ }
}
};
mProfileContainer.removePreference(profilePref);
}
}
+
showOrHideProfileGroup();
}
// Gray out checkbox while connecting and disconnecting.
profilePref.setEnabled(!mCachedDevice.isBusy());
- if (profile instanceof PbapServerProfile) {
+ if (profile instanceof MapProfile) {
+ profilePref.setChecked(mCachedDevice.getMessagePermissionChoice()
+ == CachedBluetoothDevice.ACCESS_ALLOWED);
+ } else if (profile instanceof PbapServerProfile) {
// Handle PBAP specially.
profilePref.setChecked(mCachedDevice.getPhonebookPermissionChoice()
== CachedBluetoothDevice.ACCESS_ALLOWED);