Search in sources :

Example 56 with LocalBluetoothProfile

use of com.android.settingslib.bluetooth.LocalBluetoothProfile in project android_packages_apps_Settings by omnirom.

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 BluetoothDevice device = mCachedDevice.getDevice();
    final int pbapPermission = device.getPhonebookAccessPermission();
    // Only provide PBAP cabability if the client device has requested PBAP.
    if (pbapPermission != BluetoothDevice.ACCESS_UNKNOWN) {
        final PbapServerProfile psp = mManager.getProfileManager().getPbapProfile();
        result.add(psp);
    }
    final MapProfile mapProfile = mManager.getProfileManager().getMapProfile();
    final int mapPermission = device.getMessageAccessPermission();
    if (mapPermission != BluetoothDevice.ACCESS_UNKNOWN) {
        result.add(mapProfile);
    }
    return result;
}
Also used : LocalBluetoothProfile(com.android.settingslib.bluetooth.LocalBluetoothProfile) PbapServerProfile(com.android.settingslib.bluetooth.PbapServerProfile) MapProfile(com.android.settingslib.bluetooth.MapProfile) BluetoothDevice(android.bluetooth.BluetoothDevice) CachedBluetoothDevice(com.android.settingslib.bluetooth.CachedBluetoothDevice)

Example 57 with LocalBluetoothProfile

use of com.android.settingslib.bluetooth.LocalBluetoothProfile in project android_packages_apps_Settings by omnirom.

the class BluetoothDetailsProfilesControllerTest method addFakeProfile.

/**
 * Creates and adds a mock LocalBluetoothProfile to the list of connectable profiles for the
 * device.
 * @param profileNameResId  the resource id for the name used by this profile
 * @param deviceIsPreferred  whether this profile should start out as enabled for the device
 */
private LocalBluetoothProfile addFakeProfile(int profileNameResId, boolean deviceIsPreferred) {
    LocalBluetoothProfile profile = new FakeBluetoothProfile(mContext, profileNameResId);
    profile.setEnabled(mDevice, deviceIsPreferred);
    mConnectableProfiles.add(profile);
    when(mProfileManager.getProfileByName(eq(profile.toString()))).thenReturn(profile);
    return profile;
}
Also used : LocalBluetoothProfile(com.android.settingslib.bluetooth.LocalBluetoothProfile)

Aggregations

LocalBluetoothProfile (com.android.settingslib.bluetooth.LocalBluetoothProfile)57 PbapServerProfile (com.android.settingslib.bluetooth.PbapServerProfile)22 CheckBox (android.widget.CheckBox)20 CachedBluetoothDevice (com.android.settingslib.bluetooth.CachedBluetoothDevice)15 MapProfile (com.android.settingslib.bluetooth.MapProfile)15 BluetoothDevice (android.bluetooth.BluetoothDevice)13 SwitchPreference (android.support.v14.preference.SwitchPreference)10 BluetoothClass (android.bluetooth.BluetoothClass)7 Pair (android.util.Pair)7 A2dpProfile (com.android.settingslib.bluetooth.A2dpProfile)6 SwitchPreference (androidx.preference.SwitchPreference)4 Preference (androidx.preference.Preference)1