Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 01259c5d authored by Sravan Kumar V's avatar Sravan Kumar V Committed by Linux Build Service Account
Browse files

Bluetooth: PBAP: Add support for PBAP UI preference

This pach adds support for PBAP UI preference in SettingsLib. Without this
change it is not possible to properly use the pbap checkbox preference from
Bluetooth subsettings menu. Also some map profile specific bug fixes are also
incorporated in this change.

Change-Id: I283a0cb65cb132931010fb2f8c977bea20a67951
CRs-Fixed: 758697
parent 409c6a10
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -135,6 +135,8 @@ public final class CachedBluetoothDevice implements Comparable<CachedBluetoothDe
        if (newProfileState == BluetoothProfile.STATE_CONNECTED) {
            if (profile instanceof MapProfile) {
                profile.setPreferred(mDevice, true);
                mRemovedProfiles.remove(profile);
                mProfiles.add(profile);
            } else if (!mProfiles.contains(profile)) {
                mRemovedProfiles.remove(profile);
                mProfiles.add(profile);
+13 −3
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.bluetooth.BluetoothInputDevice;
import android.bluetooth.BluetoothPan;
import android.bluetooth.BluetoothPbapClient;
import android.bluetooth.BluetoothDun;
import android.bluetooth.BluetoothPbap;
import android.bluetooth.BluetoothProfile;
import android.bluetooth.BluetoothUuid;
import android.content.Context;
@@ -139,9 +140,11 @@ public final class LocalBluetoothProfileManager {
            addProfile(mDunProfile, DunServerProfile.NAME,
                    BluetoothDun.ACTION_CONNECTION_STATE_CHANGED);
        }
       //Create PBAP server profile, but do not add it to list of profiles
       // as we do not need to monitor the profile as part of profile list

        //Create PBAP server profile
        mPbapProfile = new PbapServerProfile(context);
        addProfile(mPbapProfile, PbapServerProfile.NAME,
             BluetoothPbap.PBAP_STATE_CHANGED_ACTION);

        if (DEBUG) Log.d(TAG, "LocalBluetoothProfileManager construction complete");
    }
@@ -481,6 +484,13 @@ public final class LocalBluetoothProfileManager {
            removedProfiles.add(mPbapProfile);
        }

        if ((mPbapProfile != null) &&
            (mPbapProfile.getConnectionStatus(device) == BluetoothProfile.STATE_CONNECTED)) {
            profiles.add(mPbapProfile);
            removedProfiles.remove(mPbapProfile);
            mPbapProfile.setPreferred(device, true);
        }

        if (DEBUG) {
            Log.d(TAG,"New Profiles" + profiles.toString());
        }