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

Commit 42636158 authored by Hemant Gupta's avatar Hemant Gupta Committed by Gerrit - the friendly Code Review server
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 fc59213a
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
@@ -24,6 +24,7 @@ import android.bluetooth.BluetoothMap;
import android.bluetooth.BluetoothInputDevice;
import android.bluetooth.BluetoothPan;
import android.bluetooth.BluetoothDun;
import android.bluetooth.BluetoothPbap;
import android.bluetooth.BluetoothProfile;
import android.bluetooth.BluetoothUuid;
import android.content.Context;
@@ -132,9 +133,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");
    }
@@ -411,6 +414,13 @@ public final class LocalBluetoothProfileManager {
            removedProfiles.remove(mMapProfile);
            mMapProfile.setPreferred(device, true);
        }

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

}