Loading src/com/android/settings/bluetooth/DeviceProfilesSettings.java +10 −8 Original line number Diff line number Diff line Loading @@ -241,7 +241,7 @@ public final class DeviceProfilesSettings extends SettingsPreferenceFragment mCachedDevice.setName((String) newValue); } else if (preference instanceof CheckBoxPreference) { LocalBluetoothProfile prof = getProfileOf(preference); onProfileClicked(prof); onProfileClicked(prof, (CheckBoxPreference) preference); return false; // checkbox will update from onDeviceAttributesChanged() callback } else { return false; Loading @@ -250,7 +250,7 @@ public final class DeviceProfilesSettings extends SettingsPreferenceFragment return true; } private void onProfileClicked(LocalBluetoothProfile profile) { private void onProfileClicked(LocalBluetoothProfile profile, CheckBoxPreference profilePref) { BluetoothDevice device = mCachedDevice.getDevice(); int status = profile.getConnectionStatus(device); Loading @@ -259,11 +259,17 @@ public final class DeviceProfilesSettings extends SettingsPreferenceFragment if (isConnected) { askDisconnect(getActivity(), profile); } else { if (profile.isPreferred(device)) { // profile is preferred but not connected: disable auto-connect profile.setPreferred(device, false); refreshProfilePreference(profilePref, profile); } else { profile.setPreferred(device, true); mCachedDevice.connectProfile(profile); } } } private void askDisconnect(Context context, final LocalBluetoothProfile profile) { Loading Loading @@ -357,8 +363,4 @@ public final class DeviceProfilesSettings extends SettingsPreferenceFragment private void unpairDevice() { mCachedDevice.unpair(); } private boolean getAutoConnect(LocalBluetoothProfile prof) { return prof.isPreferred(mCachedDevice.getDevice()); } } src/com/android/settings/bluetooth/PanProfile.java +2 −1 Original line number Diff line number Diff line Loading @@ -106,7 +106,8 @@ final class PanProfile implements LocalBluetoothProfile { } public boolean isPreferred(BluetoothDevice device) { return true; // return current connection status so profile checkbox is set correctly return getConnectionStatus(device) == BluetoothProfile.STATE_CONNECTED; } public int getPreferred(BluetoothDevice device) { Loading Loading
src/com/android/settings/bluetooth/DeviceProfilesSettings.java +10 −8 Original line number Diff line number Diff line Loading @@ -241,7 +241,7 @@ public final class DeviceProfilesSettings extends SettingsPreferenceFragment mCachedDevice.setName((String) newValue); } else if (preference instanceof CheckBoxPreference) { LocalBluetoothProfile prof = getProfileOf(preference); onProfileClicked(prof); onProfileClicked(prof, (CheckBoxPreference) preference); return false; // checkbox will update from onDeviceAttributesChanged() callback } else { return false; Loading @@ -250,7 +250,7 @@ public final class DeviceProfilesSettings extends SettingsPreferenceFragment return true; } private void onProfileClicked(LocalBluetoothProfile profile) { private void onProfileClicked(LocalBluetoothProfile profile, CheckBoxPreference profilePref) { BluetoothDevice device = mCachedDevice.getDevice(); int status = profile.getConnectionStatus(device); Loading @@ -259,11 +259,17 @@ public final class DeviceProfilesSettings extends SettingsPreferenceFragment if (isConnected) { askDisconnect(getActivity(), profile); } else { if (profile.isPreferred(device)) { // profile is preferred but not connected: disable auto-connect profile.setPreferred(device, false); refreshProfilePreference(profilePref, profile); } else { profile.setPreferred(device, true); mCachedDevice.connectProfile(profile); } } } private void askDisconnect(Context context, final LocalBluetoothProfile profile) { Loading Loading @@ -357,8 +363,4 @@ public final class DeviceProfilesSettings extends SettingsPreferenceFragment private void unpairDevice() { mCachedDevice.unpair(); } private boolean getAutoConnect(LocalBluetoothProfile prof) { return prof.isPreferred(mCachedDevice.getDevice()); } }
src/com/android/settings/bluetooth/PanProfile.java +2 −1 Original line number Diff line number Diff line Loading @@ -106,7 +106,8 @@ final class PanProfile implements LocalBluetoothProfile { } public boolean isPreferred(BluetoothDevice device) { return true; // return current connection status so profile checkbox is set correctly return getConnectionStatus(device) == BluetoothProfile.STATE_CONNECTED; } public int getPreferred(BluetoothDevice device) { Loading