use of com.android.settingslib.bluetooth.PanProfile in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DeviceProfilesSettings method onProfileClicked.
private void onProfileClicked(LocalBluetoothProfile profile, CheckBox profilePref) {
BluetoothDevice device = mCachedDevice.getDevice();
if (!profilePref.isChecked()) {
// Recheck it, until the dialog is done.
profilePref.setChecked(true);
askDisconnect(mManager.getForegroundActivity(), profile);
} else {
if (profile instanceof MapProfile) {
mCachedDevice.setMessagePermissionChoice(BluetoothDevice.ACCESS_ALLOWED);
}
if (profile instanceof PbapServerProfile) {
mCachedDevice.setPhonebookPermissionChoice(BluetoothDevice.ACCESS_ALLOWED);
refreshProfilePreference(profilePref, profile);
return;
}
if (profile.isPreferred(device)) {
// profile is preferred but not connected: disable auto-connect
if (profile instanceof PanProfile) {
mCachedDevice.connectProfile(profile);
} else {
profile.setPreferred(device, false);
}
} else {
profile.setPreferred(device, true);
mCachedDevice.connectProfile(profile);
}
refreshProfilePreference(profilePref, profile);
}
}
use of com.android.settingslib.bluetooth.PanProfile in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DeviceProfilesSettings method refreshProfilePreference.
private void refreshProfilePreference(CheckBox profilePref, LocalBluetoothProfile profile) {
BluetoothDevice device = mCachedDevice.getDevice();
// Gray out checkbox while connecting and disconnecting.
profilePref.setEnabled(!mCachedDevice.isBusy());
if (profile instanceof MapProfile) {
profilePref.setChecked(mCachedDevice.getMessagePermissionChoice() == CachedBluetoothDevice.ACCESS_ALLOWED);
} else if (profile instanceof PbapServerProfile) {
profilePref.setChecked(mCachedDevice.getPhonebookPermissionChoice() == CachedBluetoothDevice.ACCESS_ALLOWED);
} else if (profile instanceof PanProfile) {
profilePref.setChecked(profile.getConnectionStatus(device) == BluetoothProfile.STATE_CONNECTED);
} else {
profilePref.setChecked(profile.isPreferred(device));
}
}
Aggregations