Merge "Bluetooth PAN: Set isPreferred to true (2/2)" into mnc-dev

This commit is contained in:
Andre Eisenbach
2015-06-02 09:00:29 +00:00
committed by Android (Google) Code Review

View File

@@ -39,6 +39,7 @@ import com.android.settingslib.bluetooth.LocalBluetoothManager;
import com.android.settingslib.bluetooth.LocalBluetoothProfile; import com.android.settingslib.bluetooth.LocalBluetoothProfile;
import com.android.settingslib.bluetooth.LocalBluetoothProfileManager; import com.android.settingslib.bluetooth.LocalBluetoothProfileManager;
import com.android.settingslib.bluetooth.MapProfile; import com.android.settingslib.bluetooth.MapProfile;
import com.android.settingslib.bluetooth.PanProfile;
import com.android.settingslib.bluetooth.PbapServerProfile; import com.android.settingslib.bluetooth.PbapServerProfile;
import java.util.HashMap; import java.util.HashMap;
@@ -244,8 +245,12 @@ public final class DeviceProfilesSettings extends SettingsPreferenceFragment
} }
if (profile.isPreferred(device)) { if (profile.isPreferred(device)) {
// profile is preferred but not connected: disable auto-connect // profile is preferred but not connected: disable auto-connect
profile.setPreferred(device, false); if (profile instanceof PanProfile) {
refreshProfilePreference(profilePref, profile); mCachedDevice.connectProfile(profile);
} else {
profile.setPreferred(device, false);
refreshProfilePreference(profilePref, profile);
}
} else { } else {
profile.setPreferred(device, true); profile.setPreferred(device, true);
mCachedDevice.connectProfile(profile); mCachedDevice.connectProfile(profile);
@@ -330,10 +335,15 @@ public final class DeviceProfilesSettings extends SettingsPreferenceFragment
if (profile instanceof MapProfile) { if (profile instanceof MapProfile) {
profilePref.setChecked(mCachedDevice.getMessagePermissionChoice() profilePref.setChecked(mCachedDevice.getMessagePermissionChoice()
== CachedBluetoothDevice.ACCESS_ALLOWED); == CachedBluetoothDevice.ACCESS_ALLOWED);
} else if (profile instanceof PbapServerProfile) { } else if (profile instanceof PbapServerProfile) {
// Handle PBAP specially.
profilePref.setChecked(mCachedDevice.getPhonebookPermissionChoice() profilePref.setChecked(mCachedDevice.getPhonebookPermissionChoice()
== CachedBluetoothDevice.ACCESS_ALLOWED); == CachedBluetoothDevice.ACCESS_ALLOWED);
} else if (profile instanceof PanProfile) {
profilePref.setChecked(profile.getConnectionStatus(device) ==
BluetoothProfile.STATE_CONNECTED);
} else { } else {
profilePref.setChecked(profile.isPreferred(device)); profilePref.setChecked(profile.isPreferred(device));
} }