diff options
author | Hemant Gupta <hemantg@codeaurora.org> | 2015-11-04 16:32:17 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2015-11-06 11:35:30 -0800 |
commit | 42636158a622ff4fed5efe595d00f15123756bcd (patch) | |
tree | a075784f079d7ac00d196968fe205f62fdcb96e5 /packages/SettingsLib | |
parent | fc59213a04d76c8fd55e59e44ea0531f4334938a (diff) | |
download | frameworks_base-42636158a622ff4fed5efe595d00f15123756bcd.zip frameworks_base-42636158a622ff4fed5efe595d00f15123756bcd.tar.gz frameworks_base-42636158a622ff4fed5efe595d00f15123756bcd.tar.bz2 |
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
Diffstat (limited to 'packages/SettingsLib')
2 files changed, 15 insertions, 3 deletions
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java index f6d787c..9207f0a 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java @@ -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); diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java index 6a7890f..3876468 100755..100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java @@ -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; @@ -126,15 +127,17 @@ public final class LocalBluetoothProfileManager { addProfile(mMapProfile, MapProfile.NAME, BluetoothMap.ACTION_CONNECTION_STATE_CHANGED); - // enable DUN only if the property is set + // enable DUN only if the property is set if (SystemProperties.getBoolean("ro.bluetooth.dun", false) == true) { mDunProfile = new DunServerProfile(context); 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); + } } } |