diff --git a/res/layout/preference_start_widget.xml b/res/layout/preference_start_widget.xml
new file mode 100644
index 00000000000..74fd57f545e
--- /dev/null
+++ b/res/layout/preference_start_widget.xml
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 5db167134bd..24144b856a5 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -204,4 +204,8 @@
56dp
+
+ 58dip
+ 16dip
+
diff --git a/res/values/strings.xml b/res/values/strings.xml
index a18835a42a6..1d11022e4f9 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -390,9 +390,6 @@
%1$s wants to access your messages. Give access to %2$s?
-
-
-
Date & time
@@ -1175,8 +1172,6 @@
Paired device
Name
-
- Use for
Internet connection
@@ -1230,9 +1225,13 @@
File transfer
Input device
-
+
Internet access
-
+
+ Contact sharing
+
+ Use for contact sharing
+
Internet connection sharing
Message Access
@@ -1257,7 +1256,7 @@
Connect to Bluetooth device
- Profiles
+ Use for
Rename
diff --git a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
index 12637974bfc..3b64ade0b97 100755
--- a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
+++ b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
@@ -76,11 +76,11 @@ final class CachedBluetoothDevice implements Comparable {
// Following constants indicate the user's choices of Phone book/message access settings
// User hasn't made any choice or settings app has wiped out the memory
- final static int ACCESS_UNKNOWN = 0;
+ public final static int ACCESS_UNKNOWN = 0;
// User has accepted the connection and let Settings app remember the decision
- final static int ACCESS_ALLOWED = 1;
+ public final static int ACCESS_ALLOWED = 1;
// User has rejected the connection and let Settings app remember the decision
- final static int ACCESS_REJECTED = 2;
+ public final static int ACCESS_REJECTED = 2;
// how many times did User reject the connection to make the rejected persist.
final static int PERSIST_REJECTED_TIMES_LIMIT = 2;
diff --git a/src/com/android/settings/bluetooth/DeviceProfilesSettings.java b/src/com/android/settings/bluetooth/DeviceProfilesSettings.java
index b50d2b4e12d..fb7668ff4e1 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) {
diff --git a/src/com/android/settings/bluetooth/PbapServerProfile.java b/src/com/android/settings/bluetooth/PbapServerProfile.java
index 1f5ca3281bc..87e51a509b5 100755
--- a/src/com/android/settings/bluetooth/PbapServerProfile.java
+++ b/src/com/android/settings/bluetooth/PbapServerProfile.java
@@ -118,16 +118,17 @@ final class PbapServerProfile implements LocalBluetoothProfile {
}
public int getNameResource(BluetoothDevice device) {
- return 0;
+ return R.string.bluetooth_profile_pbap;
}
public int getSummaryResourceForDevice(BluetoothDevice device) {
- return 0;
+ return R.string.bluetooth_profile_pbap_summary;
}
public int getDrawableResource(BluetoothClass btClass) {
- return 0;
+ return R.drawable.ic_bt_cellphone;
}
+
protected void finalize() {
if (V) Log.d(TAG, "finalize()");
if (mService != null) {