diff options
author | PauloftheWest <paulofthewest@google.com> | 2014-07-25 06:15:10 -0700 |
---|---|---|
committer | PauloftheWest <paulofthewest@google.com> | 2014-07-30 08:39:46 -0700 |
commit | 361d870e5415f8642cb106b4329d194673b4dd02 (patch) | |
tree | 111909e6035339d4cb71950561b1912e8704ed7a /src/com/android/settings/bluetooth/DeviceProfilesSettings.java | |
parent | c8a1db191207e38b7ad0acdfd276651e4911e812 (diff) | |
download | packages_apps_Settings-361d870e5415f8642cb106b4329d194673b4dd02.zip packages_apps_Settings-361d870e5415f8642cb106b4329d194673b4dd02.tar.gz packages_apps_Settings-361d870e5415f8642cb106b4329d194673b4dd02.tar.bz2 |
Added ability for user to automatically accept/deny Bluetooth Phonebook Syncs
Bug: 16040292
Change-Id: Ieeaa014052f53787cf7057578e0b2ac048dc6eb1
Diffstat (limited to 'src/com/android/settings/bluetooth/DeviceProfilesSettings.java')
-rwxr-xr-x | src/com/android/settings/bluetooth/DeviceProfilesSettings.java | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/com/android/settings/bluetooth/DeviceProfilesSettings.java b/src/com/android/settings/bluetooth/DeviceProfilesSettings.java index b50d2b4..fb7668f 100755 --- a/src/com/android/settings/bluetooth/DeviceProfilesSettings.java +++ b/src/com/android/settings/bluetooth/DeviceProfilesSettings.java @@ -55,6 +55,7 @@ public final class DeviceProfilesSettings extends SettingsPreferenceFragment private static final String KEY_RENAME_DEVICE = "rename_device"; private static final String KEY_PROFILE_CONTAINER = "profile_container"; private static final String KEY_UNPAIR = "unpair"; + private static final String KEY_PBAP_SERVER = "PBAP Server"; public static final String EXTRA_DEVICE = "device"; private RenameEditTextPreference mRenameDeviceNamePref; @@ -181,6 +182,16 @@ public final class DeviceProfilesSettings extends SettingsPreferenceFragment Preference pref = createProfilePreference(profile); mProfileContainer.addPreference(pref); } + + 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(); + CheckBoxPreference pbapPref = createProfilePreference(psp); + pbapPref.setChecked(pbapPermission == CachedBluetoothDevice.ACCESS_ALLOWED); + mProfileContainer.addPreference(pbapPref); + } + showOrHideProfileGroup(); } @@ -205,6 +216,7 @@ public final class DeviceProfilesSettings extends SettingsPreferenceFragment */ private CheckBoxPreference createProfilePreference(LocalBluetoothProfile profile) { CheckBoxPreference pref = new CheckBoxPreference(getActivity()); + pref.setLayoutResource(R.layout.preference_start_widget); pref.setKey(profile.toString()); pref.setTitle(profile.getNameResource(mCachedDevice.getDevice())); pref.setPersistent(false); @@ -265,6 +277,15 @@ public final class DeviceProfilesSettings extends SettingsPreferenceFragment private void onProfileClicked(LocalBluetoothProfile profile, CheckBoxPreference profilePref) { BluetoothDevice device = mCachedDevice.getDevice(); + if (profilePref.getKey().equals(KEY_PBAP_SERVER)) { + final int newPermission = mCachedDevice.getPhonebookPermissionChoice() + == CachedBluetoothDevice.ACCESS_ALLOWED ? CachedBluetoothDevice.ACCESS_REJECTED + : CachedBluetoothDevice.ACCESS_ALLOWED; + mCachedDevice.setPhonebookPermissionChoice(newPermission); + profilePref.setChecked(newPermission == CachedBluetoothDevice.ACCESS_ALLOWED); + return; + } + int status = profile.getConnectionStatus(device); boolean isConnected = status == BluetoothProfile.STATE_CONNECTED; @@ -351,7 +372,6 @@ public final class DeviceProfilesSettings extends SettingsPreferenceFragment */ profilePref.setEnabled(!mCachedDevice.isBusy()); profilePref.setChecked(profile.isPreferred(device)); - profilePref.setSummary(profile.getSummaryResourceForDevice(device)); } private LocalBluetoothProfile getProfileOf(Preference pref) { |