Merge "Work around an icu4c bug in TimeZoneNames::getDisplayName." into lmp-dev
diff --git a/res/layout/manage_applications_apps.xml b/res/layout/manage_applications_apps.xml
index 5bfdb69..68fcb1b 100644
--- a/res/layout/manage_applications_apps.xml
+++ b/res/layout/manage_applications_apps.xml
@@ -14,50 +14,69 @@
      limitations under the License.
 -->
 
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent" >
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical">
 
-    <LinearLayout android:id="@+id/list_container"
+    <FrameLayout android:id="@+id/pinned_header"
             android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:orientation="vertical"
-            android:visibility="gone">
-        <FrameLayout android:layout_width="match_parent"
-                android:layout_height="0px"
-                android:layout_weight="1">
-            <ListView android:id="@android:id/list"
-                android:drawSelectorOnTop="false"
+            android:layout_height="wrap_content"
+            android:visibility="gone" />
+
+    <FrameLayout
+              android:layout_width="match_parent"
+              android:layout_height="0dp"
+              android:layout_weight="1">
+
+        <LinearLayout android:id="@+id/list_container"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
-                android:clipToPadding="false"
-                android:scrollbarStyle="@integer/preference_scrollbar_style" />
-            <TextView android:id="@android:id/empty"
+                android:orientation="vertical"
+                android:visibility="gone">
+
+            <FrameLayout android:layout_width="match_parent"
+                    android:layout_height="0px"
+                    android:layout_weight="1">
+
+                <ListView android:id="@android:id/list"
+                    android:drawSelectorOnTop="false"
                     android:layout_width="match_parent"
                     android:layout_height="match_parent"
-                    android:gravity="center"
-                    android:text="@string/no_applications"
-                    android:textAppearance="?android:attr/textAppearanceLarge" />
-        </FrameLayout>
-    </LinearLayout>
+                    android:clipToPadding="false"
+                    android:scrollbarStyle="@integer/preference_scrollbar_style" />
 
-    <LinearLayout android:id="@+id/loading_container"
-            android:orientation="vertical"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:visibility="gone"
-            android:gravity="center">
+                <TextView android:id="@android:id/empty"
+                        android:layout_width="match_parent"
+                        android:layout_height="match_parent"
+                        android:gravity="center"
+                        android:text="@string/no_applications"
+                        android:textAppearance="?android:attr/textAppearanceLarge" />
 
-        <ProgressBar style="?android:attr/progressBarStyleLarge"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content" />
-        <TextView android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textAppearance="?android:attr/textAppearanceSmall"
-                android:text="@string/settings_safetylegal_activity_loading"
-                android:paddingTop="4dip"
-                android:singleLine="true" />
+            </FrameLayout>
 
-    </LinearLayout>
+        </LinearLayout>
 
-</FrameLayout>
+        <LinearLayout android:id="@+id/loading_container"
+                android:orientation="vertical"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:visibility="gone"
+                android:gravity="center">
+
+            <ProgressBar style="?android:attr/progressBarStyleLarge"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content" />
+
+            <TextView android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textAppearance="?android:attr/textAppearanceSmall"
+                    android:text="@string/settings_safetylegal_activity_loading"
+                    android:paddingTop="4dip"
+                    android:singleLine="true" />
+
+        </LinearLayout>
+
+    </FrameLayout>
+
+</LinearLayout>
diff --git a/res/layout/manage_applications_running.xml b/res/layout/manage_applications_running.xml
index 352ce44..cc8c1867 100644
--- a/res/layout/manage_applications_running.xml
+++ b/res/layout/manage_applications_running.xml
@@ -14,32 +14,46 @@
      limitations under the License.
 -->
 
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent" >
-    <view class="com.android.settings.applications.RunningProcessesView"
-            android:id="@+id/running_processes"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
-            android:visibility="gone" />
+            android:orientation="vertical">
 
-    <LinearLayout android:id="@+id/loading_container"
-            android:orientation="vertical"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:visibility="gone"
-            android:gravity="center">
+    <FrameLayout android:id="@+id/pinned_header"
+                 android:layout_width="match_parent"
+                 android:layout_height="wrap_content"
+                 android:visibility="gone" />
 
-        <ProgressBar style="?android:attr/progressBarStyleLarge"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content" />
-        <TextView android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textAppearance="?android:attr/textAppearanceSmall"
-                android:text="@string/settings_safetylegal_activity_loading"
-                android:paddingTop="4dip"
-                android:singleLine="true" />
+    <FrameLayout
+              android:layout_width="match_parent"
+              android:layout_height="match_parent" >
 
-    </LinearLayout>
+        <view class="com.android.settings.applications.RunningProcessesView"
+                android:id="@+id/running_processes"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:visibility="gone" />
 
-</FrameLayout>
+        <LinearLayout android:id="@+id/loading_container"
+                android:orientation="vertical"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:visibility="gone"
+                android:gravity="center">
+
+            <ProgressBar style="?android:attr/progressBarStyleLarge"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content" />
+
+            <TextView android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textAppearance="?android:attr/textAppearanceSmall"
+                    android:text="@string/settings_safetylegal_activity_loading"
+                    android:paddingTop="4dip"
+                    android:singleLine="true" />
+
+        </LinearLayout>
+
+    </FrameLayout>
+
+</LinearLayout>
diff --git a/res/layout/preference_start_widget.xml b/res/layout/preference_start_widget.xml
new file mode 100644
index 0000000..74fd57f
--- /dev/null
+++ b/res/layout/preference_start_widget.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:minHeight="?android:attr/listPreferredItemHeightSmall"
+    android:gravity="center_vertical"
+    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+    android:background="?android:attr/selectableItemBackground">
+
+    <LinearLayout
+        android:id="@android:id/widget_frame"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:minWidth="@dimen/checkbox_widget_min_width"
+        android:gravity="center"
+        android:orientation="horizontal" />
+
+    <RelativeLayout
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:paddingTop="@dimen/checkbox_layout_padding"
+        android:paddingBottom="@dimen/checkbox_layout_padding">
+
+        <TextView
+            android:id="@+android:id/title"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:singleLine="true"
+            android:textAppearance="@android:style/TextAppearance.Material.Subhead"
+            android:textColor="?android:attr/textColorPrimary"
+            android:ellipsize="marquee"
+            android:fadingEdge="horizontal" />
+
+        <TextView
+            android:id="@android:id/summary"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_below="@android:id/title"
+            android:layout_alignStart="@android:id/title"
+            android:visibility="gone"
+            android:textAlignment="viewStart"
+            android:textAppearance="@android:style/TextAppearance.Material.Body1"
+            android:textColor="?android:attr/textColorSecondary"
+            android:maxLines="10" />
+
+    </RelativeLayout>
+
+</LinearLayout>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 5db1671..24144b8 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -204,4 +204,8 @@
     <!-- Diameter of a round user icon -->
     <dimen name="user_icon_diameter">56dp</dimen>
 
+    <!-- CheckBoxPreference -->
+    <dimen name="checkbox_widget_min_width">58dip</dimen>
+    <dimen name="checkbox_layout_padding">16dip</dimen>
+
 </resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index d3fe9e7..8fbccba 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -390,9 +390,6 @@
     <!-- Bluetooth message permission Alert Activity text [CHAR LIMIT=none] -->
     <string name="bluetooth_map_acceptance_dialog_text">%1$s wants to access your messages. Give access to %2$s?</string>
 
-
-
-
     <!-- Date & time settings screen title -->
     <string name="date_and_time">Date &amp; time</string>
     <!-- The title of the activity to pick a time zone. -->
@@ -1175,8 +1172,6 @@
     <string name="bluetooth_preference_paired_dialog_title">Paired device</string>
     <!-- Bluetooth settings: Name label [CHAR LIMIT=40] -->
     <string name="bluetooth_preference_paired_dialog_name_label">Name</string>
-    <!-- Bluetooth settings: Use for label [CHAR LIMIT=40] -->
-    <string name="bluetooth_preference_paired_dialog_use_label">Use for</string>
     <!-- Bluetooth settings: Checkbox label for enable/disable internet connection.  [CHAR LIMIT=40] -->
     <string name="bluetooth_preference_paired_dialog_internet_option">Internet connection</string>
     <!-- Bluetooth settings: Checkbox label for enable/disable keyboard connection.  [CHAR LIMIT=40] -->
@@ -1230,9 +1225,13 @@
     <string name="bluetooth_profile_opp">File transfer</string>
     <!-- Bluetooth settings. The user-visible string that is used whenever referring to the HID profile. -->
     <string name="bluetooth_profile_hid">Input device</string>
-    <!-- Bluetooth settings. The user-visible string that is used whenever referring to the PAN profile (accessing Internet through remote device). [CHAR LIMIT=40]-->
+    <!-- Bluetooth settings. The user-visible string that is used whenever referring to the PAN profile (accessing Internet through remote device). [CHAR LIMIT=40] -->
     <string name="bluetooth_profile_pan">Internet access</string>
-    <!-- Bluetooth settings. The user-visible string that is used whenever referring to the PAN profile (sharing this device's Internet connection). [CHAR LIMIT=40]-->
+    <!-- Bluetooth settings. The user-visible string that is used whenever referring to the PBAP profile. [CHAR LIMIT=40] -->
+    <string name="bluetooth_profile_pbap">Contact sharing</string>
+    <!-- Bluetooth settings. The user-visible summary string that is used whenever referring to the PBAP profile (sharing contacts). [CHAR LIMIT=60] -->
+    <string name="bluetooth_profile_pbap_summary">Use for contact sharing</string>
+    <!-- Bluetooth settings. The user-visible string that is used whenever referring to the PAN profile (sharing this device's Internet connection). [CHAR LIMIT=40] -->
     <string name="bluetooth_profile_pan_nap">Internet connection sharing</string>
     <!-- Bluetooth settings.  The user-visible string that is used whenever referring to the map profile. -->
     <string name="bluetooth_profile_map">Message Access</string>
@@ -1257,7 +1256,7 @@
     <!-- Bluetooth settings.  Connection options screen.  The summary of the online mode checkbox.  This describes what the setting does in the context of the screen. -->
     <string name="bluetooth_device_advanced_online_mode_summary">Connect to Bluetooth device</string>
     <!-- Bluetooth settings.  Connection options screen.  The title of the header that is above all of the profiles. -->
-    <string name="bluetooth_device_advanced_profile_header_title">Profiles</string>
+    <string name="bluetooth_device_advanced_profile_header_title">Use for</string>
     <!-- Bluetooth settings. Connection options screen. Title for option to rename the device. [CHAR LIMIT=30] -->
     <string name="bluetooth_device_advanced_rename_device">Rename</string>
     <!-- Bluetooth settings. Connection options screen. Title for checkbox to enable incoming file transfers [CHAR LIMIT=30] -->
@@ -4607,7 +4606,7 @@
     <string name="really_remove_account_message" product="tablet">Removing this account will delete all of its messages, contacts, and other data from the tablet!</string>
     <!-- Remove account message in dialog [CHAR LIMIT=NONE] -->
     <string name="really_remove_account_message" product="default">Removing this account will delete all of its messages, contacts, and other data from the phone!</string>
-    <!-- This is shown if the autheticator for a given account fails to remove it. -->
+    <!-- This is shown if the autheticator for a given account fails to remove it. [CHAR LIMIT=NONE] -->
     <string name="remove_account_failed">This change isn\'t allowed by your administrator</string>
     <!-- What to show in messaging that refers to this provider, e.g. AccountSyncSettings -->
     <string name="provider_label">Push subscriptions</string>
@@ -5798,7 +5797,7 @@
     <string name="zen_mode_from_starred">Starred contacts only</string>
 
     <!-- [CHAR LIMIT=80] Zen mode settings: Reminder text about alarms -->
-    <string name="zen_mode_alarm_info">Alarms and other personal reminders are priority interruptions</string>
+    <string name="zen_mode_alarm_info">Alarms and other personal reminders are always priority</string>
 
     <!-- [CHAR LIMIT=20] Zen mode settings: When option -->
     <string name="zen_mode_when">Automatically turn on</string>
diff --git a/res/xml/zen_mode_settings.xml b/res/xml/zen_mode_settings.xml
index a4084cb..aea4291 100644
--- a/res/xml/zen_mode_settings.xml
+++ b/res/xml/zen_mode_settings.xml
@@ -43,6 +43,11 @@
             android:switchTextOff=""
             android:switchTextOn="" />
 
+        <com.android.settings.notification.DropDownPreference
+                android:key="starred"
+                android:title="@string/zen_mode_from"
+                android:persistent="false" />
+
         <Preference
             android:key="alarm_info"
             android:title=""
diff --git a/src/com/android/settings/applications/ManageApplications.java b/src/com/android/settings/applications/ManageApplications.java
index e40ad25..493caf6 100644
--- a/src/com/android/settings/applications/ManageApplications.java
+++ b/src/com/android/settings/applications/ManageApplications.java
@@ -43,12 +43,12 @@
 import android.os.RemoteException;
 import android.os.ServiceManager;
 import android.os.UserHandle;
+import android.os.UserManager;
 import android.preference.PreferenceFrameLayout;
+import android.provider.Settings;
 import android.support.v4.view.PagerAdapter;
 import android.support.v4.view.PagerTabStrip;
 import android.support.v4.view.ViewPager;
-import android.text.BidiFormatter;
-import android.text.format.Formatter;
 import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.Menu;
@@ -60,18 +60,21 @@
 import android.widget.AbsListView;
 import android.widget.AdapterView;
 import android.widget.AdapterView.OnItemClickListener;
+import android.widget.AdapterView.OnItemSelectedListener;
 import android.widget.BaseAdapter;
 import android.widget.Filter;
 import android.widget.Filterable;
 import android.widget.ListView;
-import android.widget.TextView;
+import android.widget.Spinner;
 
 import com.android.internal.app.IMediaContainerService;
 import com.android.internal.content.PackageHelper;
 import com.android.settings.R;
 import com.android.settings.SettingsActivity;
+import com.android.settings.UserSpinnerAdapter;
 import com.android.settings.Settings.RunningServicesActivity;
 import com.android.settings.Settings.StorageUseActivity;
+import com.android.settings.UserSpinnerAdapter.UserDetails;
 import com.android.settings.applications.ApplicationsState.AppEntry;
 import com.android.settings.deviceinfo.StorageMeasurement;
 import com.android.settings.Utils;
@@ -134,7 +137,7 @@
  */
 public class ManageApplications extends Fragment implements
         AppClickListener, DialogInterface.OnClickListener,
-        DialogInterface.OnDismissListener {
+        DialogInterface.OnDismissListener, OnItemSelectedListener  {
 
     static final String TAG = "ManageApplications";
     static final boolean DEBUG = false;
@@ -194,6 +197,8 @@
 
         private View mListContainer;
 
+        private ViewGroup mPinnedHeader;
+
         // ListView used to display list
         private ListView mListView;
         // Custom view used to display running processes
@@ -245,6 +250,14 @@
             mRootView = inflater.inflate(mListType == LIST_TYPE_RUNNING
                     ? R.layout.manage_applications_running
                     : R.layout.manage_applications_apps, null);
+            mPinnedHeader = (ViewGroup) mRootView.findViewById(R.id.pinned_header);
+            if (mOwner.mProfileSpinnerAdapter != null) {
+                Spinner spinner = (Spinner) inflater.inflate(R.layout.spinner_view, null);
+                spinner.setAdapter(mOwner.mProfileSpinnerAdapter);
+                spinner.setOnItemSelectedListener(mOwner);
+                mPinnedHeader.addView(spinner);
+                mPinnedHeader.setVisibility(View.VISIBLE);
+            }
             mLoadingContainer = mRootView.findViewById(R.id.loading_container);
             mLoadingContainer.setVisibility(View.VISIBLE);
             mListContainer = mRootView.findViewById(R.id.list_container);
@@ -468,6 +481,8 @@
     private ViewGroup mContentContainer;
     private View mRootView;
     private ViewPager mViewPager;
+    private UserSpinnerAdapter mProfileSpinnerAdapter;
+    private Context mContext;
 
     AlertDialog mResetDialog;
 
@@ -830,13 +845,14 @@
             mActive.remove(view);
         }
     }
-    
+
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
         setHasOptionsMenu(true);
 
+        mContext = getActivity();
         mApplicationsState = ApplicationsState.getInstance(getActivity().getApplication());
         Intent intent = getActivity().getIntent();
         String action = intent.getAction();
@@ -903,6 +919,22 @@
         mTabs.add(tab);
 
         mNumTabs = mTabs.size();
+
+        final UserManager um = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
+        List<UserHandle> userProfiles = um.getUserProfiles();
+        if (userProfiles.size() >= 2) {
+
+            UserHandle myUserHandle = new UserHandle(UserHandle.myUserId());
+            userProfiles.remove(myUserHandle);
+            userProfiles.add(0, myUserHandle);
+            ArrayList<UserDetails> userDetails = new ArrayList<UserDetails>(userProfiles.size());
+            final int count = userProfiles.size();
+            for (int i = 0; i < count; i++) {
+                userDetails.add(new UserDetails(userProfiles.get(i), um, mContext));
+            }
+            // TODO: Factor out spinner creation in a method in Utils class. See: http://b/16645615
+            mProfileSpinnerAdapter = new UserSpinnerAdapter(mContext, userDetails);
+        }
     }
 
 
@@ -1011,6 +1043,23 @@
         }
     }
 
+    @Override
+    public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
+        UserHandle selectedUser = mProfileSpinnerAdapter.getUserHandle(position);
+        if (selectedUser.getIdentifier() != UserHandle.myUserId()) {
+            // TODO: Factor out intent starting in a method in Utils class. See: http://b/16645615
+            Intent intent = new Intent(Settings.ACTION_APPLICATION_SETTINGS);
+            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+            mContext.startActivityAsUser(intent, selectedUser);
+            getActivity().finish();
+        }
+    }
+
+    @Override
+    public void onNothingSelected(AdapterView<?> parent) {
+        // Nothing to do
+    }
+
     private void updateNumTabs() {
         int newNum = mApplicationsState.haveDisabledApps() ? mTabs.size() : (mTabs.size()-1);
         if (newNum != mNumTabs) {
diff --git a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
index 1263797..a7104df 100755
--- a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
+++ b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
@@ -76,11 +76,11 @@
 
     // 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;
@@ -539,7 +539,7 @@
         if (bondState == BluetoothDevice.BOND_NONE) {
             mProfiles.clear();
             mConnectAfterPairing = false;  // cancel auto-connect
-            setPhonebookPermissionChoice(ACCESS_UNKNOWN);
+            setPhonebookPermissionChoice(ACCESS_ALLOWED);
             setMessagePermissionChoice(ACCESS_UNKNOWN);
             mPhonebookRejectedTimes = 0;
             savePhonebookRejectTimes();
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 @@
     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 @@
             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 @@
      */
     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 @@
     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 @@
          */
         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 1f5ca32..87e51a5 100755
--- a/src/com/android/settings/bluetooth/PbapServerProfile.java
+++ b/src/com/android/settings/bluetooth/PbapServerProfile.java
@@ -118,16 +118,17 @@
     }
 
     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) {
diff --git a/src/com/android/settings/notification/ZenModeSettings.java b/src/com/android/settings/notification/ZenModeSettings.java
index c20b350..5e24b9d 100644
--- a/src/com/android/settings/notification/ZenModeSettings.java
+++ b/src/com/android/settings/notification/ZenModeSettings.java
@@ -153,8 +153,6 @@
 
         final PreferenceCategory important =
                 (PreferenceCategory) root.findPreference(KEY_IMPORTANT);
-        final Preference alarmInfo = important.findPreference(KEY_ALARM_INFO);
-        important.removePreference(alarmInfo);
 
         mCalls = (SwitchPreference) important.findPreference(KEY_CALLS);
         if (Utils.isVoiceCapable(mContext)) {
@@ -189,9 +187,7 @@
             }
         });
 
-        mStarred = new DropDownPreference(mContext);
-        mStarred.setKey(KEY_STARRED);
-        mStarred.setTitle(R.string.zen_mode_from);
+        mStarred = (DropDownPreference) important.findPreference(KEY_STARRED);
         mStarred.setDropDownWidth(R.dimen.zen_mode_dropdown_width);
         mStarred.addItem(R.string.zen_mode_from_anyone, ZenModeConfig.SOURCE_ANYONE);
         mStarred.addItem(R.string.zen_mode_from_starred, ZenModeConfig.SOURCE_STAR);
@@ -211,8 +207,6 @@
         });
         important.addPreference(mStarred);
 
-        important.addPreference(alarmInfo);
-
         final PreferenceCategory downtime = (PreferenceCategory) root.findPreference(KEY_DOWNTIME);
 
         mDays = downtime.findPreference(KEY_DAYS);