use of com.android.settingslib.bluetooth.LocalBluetoothProfile in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DockService method connectIfEnabled.
private synchronized void connectIfEnabled(BluetoothDevice device) {
CachedBluetoothDevice cachedDevice = getCachedBluetoothDevice(device);
List<LocalBluetoothProfile> profiles = cachedDevice.getConnectableProfiles();
for (LocalBluetoothProfile profile : profiles) {
if (profile.getPreferred(device) == BluetoothProfile.PRIORITY_AUTO_CONNECT) {
cachedDevice.connect(false);
return;
}
}
}
use of com.android.settingslib.bluetooth.LocalBluetoothProfile in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BluetoothDevicePreference method getBtClassDrawableWithDescription.
private Pair<Integer, String> getBtClassDrawableWithDescription() {
BluetoothClass btClass = mCachedDevice.getBtClass();
if (btClass != null) {
switch(btClass.getMajorDeviceClass()) {
case BluetoothClass.Device.Major.COMPUTER:
return new Pair<Integer, String>(R.drawable.ic_bt_laptop, COMPUTER);
case BluetoothClass.Device.Major.PHONE:
return new Pair<Integer, String>(R.drawable.ic_bt_cellphone, PHONE);
case BluetoothClass.Device.Major.PERIPHERAL:
return new Pair<Integer, String>(HidProfile.getHidClassDrawable(btClass), INPUT_PERIPHERAL);
case BluetoothClass.Device.Major.IMAGING:
return new Pair<Integer, String>(R.drawable.ic_bt_imaging, IMAGING);
default:
}
} else {
Log.w(TAG, "mBtClass is null");
}
List<LocalBluetoothProfile> profiles = mCachedDevice.getProfiles();
for (LocalBluetoothProfile profile : profiles) {
int resId = profile.getDrawableResource(btClass);
if (resId != 0) {
return new Pair<Integer, String>(resId, null);
}
}
if (btClass != null) {
if (btClass.doesClassMatch(BluetoothClass.PROFILE_A2DP)) {
return new Pair<Integer, String>(R.drawable.ic_bt_headphones_a2dp, HEADPHONE);
}
if (btClass.doesClassMatch(BluetoothClass.PROFILE_HEADSET)) {
return new Pair<Integer, String>(R.drawable.ic_bt_headset_hfp, HEADSET);
}
}
return new Pair<Integer, String>(R.drawable.ic_settings_bluetooth, BLUETOOTH);
}
use of com.android.settingslib.bluetooth.LocalBluetoothProfile in project android_packages_apps_Settings by LineageOS.
the class BluetoothDetailsProfilesController method getProfiles.
/**
* Helper to get the list of connectable and special profiles.
*/
private List<LocalBluetoothProfile> getProfiles() {
List<LocalBluetoothProfile> result = mCachedDevice.getConnectableProfiles();
final int pbapPermission = mCachedDevice.getPhonebookPermissionChoice();
// Only provide PBAP cabability if the client device has requested PBAP.
if (pbapPermission != CachedBluetoothDevice.ACCESS_UNKNOWN) {
final PbapServerProfile psp = mManager.getProfileManager().getPbapProfile();
result.add(psp);
}
final MapProfile mapProfile = mManager.getProfileManager().getMapProfile();
final int mapPermission = mCachedDevice.getMessagePermissionChoice();
if (mapPermission != CachedBluetoothDevice.ACCESS_UNKNOWN) {
result.add(mapProfile);
}
return result;
}
use of com.android.settingslib.bluetooth.LocalBluetoothProfile in project android_packages_apps_Settings by LineageOS.
the class BluetoothDetailsProfilesController method refresh.
/**
* Refreshes the state of the switches for all profiles, possibly adding or removing switches as
* needed.
*/
@Override
protected void refresh() {
for (LocalBluetoothProfile profile : getProfiles()) {
SwitchPreference pref = (SwitchPreference) mProfilesContainer.findPreference(profile.toString());
if (pref == null) {
pref = createProfilePreference(mProfilesContainer.getContext(), profile);
mProfilesContainer.addPreference(pref);
maybeAddHighQualityAudioPref(profile);
}
refreshProfilePreference(pref, profile);
}
for (LocalBluetoothProfile removedProfile : mCachedDevice.getRemovedProfiles()) {
SwitchPreference pref = (SwitchPreference) mProfilesContainer.findPreference(removedProfile.toString());
if (pref != null) {
mProfilesContainer.removePreference(pref);
}
}
}
use of com.android.settingslib.bluetooth.LocalBluetoothProfile in project android_packages_apps_Settings by LineageOS.
the class DeviceProfilesSettings method refreshProfiles.
private void refreshProfiles() {
for (LocalBluetoothProfile profile : mCachedDevice.getConnectableProfiles()) {
CheckBox profilePref = findProfile(profile.toString());
if (profilePref == null) {
profilePref = createProfilePreference(profile);
mProfileContainer.addView(profilePref);
} else {
refreshProfilePreference(profilePref, profile);
}
}
for (LocalBluetoothProfile profile : mCachedDevice.getRemovedProfiles()) {
CheckBox profilePref = findProfile(profile.toString());
if (profilePref != null) {
Log.d(TAG, "Removing " + profile.toString() + " from profile list");
mProfileContainer.removeView(profilePref);
}
}
showOrHideProfileGroup();
}
Aggregations