Merge "Add demo mode to dev options" into nyc-dev
diff --git a/res/layout/admin_support_details_content.xml b/res/layout/admin_support_details_content.xml
index 52de743..7c756c4 100644
--- a/res/layout/admin_support_details_content.xml
+++ b/res/layout/admin_support_details_content.xml
@@ -20,7 +20,7 @@
             android:textAppearance="@android:style/TextAppearance.Material.Subhead"
             android:text="@string/default_admin_support_msg"
             android:maxLength="200"
-            android:autoLink="email|phone"
+            android:autoLink="email|phone|web"
             android:textColor="?android:attr/textColorSecondary" />
     <TextView android:id="@+id/admins_policies_list"
             android:layout_width="match_parent"
diff --git a/res/layout/bugreport_options_dialog.xml b/res/layout/bugreport_options_dialog.xml
index d937bc3..fd00bc6 100644
--- a/res/layout/bugreport_options_dialog.xml
+++ b/res/layout/bugreport_options_dialog.xml
@@ -15,66 +15,68 @@
      limitations under the License.
 -->
 
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:orientation="horizontal"
-    android:paddingStart="20dp"
-    android:paddingEnd="24dp"
-    android:paddingTop="15dp"
-    >
-
-    <CheckedTextView
-        android:id="@+id/bugreport_option_interactive_title"
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android">
+    <RelativeLayout
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:checked="true"
-        android:drawableStart="?android:attr/listChoiceIndicatorSingle"
-        android:ellipsize="marquee"
-        android:gravity="center_vertical"
-        android:paddingEnd="?android:attr/dialogPreferredPadding"
-        android:text="@*android:string/bugreport_option_interactive_title"
-        android:textAppearance="?android:attr/textAppearanceMedium"
-        android:textColor="?android:attr/textColorAlertDialogListItem" />
+        android:layout_height="match_parent"
+        android:orientation="horizontal"
+        android:paddingStart="20dp"
+        android:paddingEnd="24dp"
+        android:paddingTop="15dp"
+        >
 
-    <TextView
-        android:id="@+id/bugreport_option_interactive_summary"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_below="@+id/bugreport_option_interactive_title"
-        android:maxLines="10"
-        android:paddingBottom="10dp"
-        android:paddingStart="32dp"
-        android:paddingEnd="?android:attr/dialogPreferredPadding"
-        android:text="@*android:string/bugreport_option_interactive_summary"
-        android:textAppearance="?android:attr/textAppearanceListItemSecondary"
-        android:textColor="?android:attr/textColorSecondary" />
+        <CheckedTextView
+            android:id="@+id/bugreport_option_interactive_title"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:checked="true"
+            android:drawableStart="?android:attr/listChoiceIndicatorSingle"
+            android:ellipsize="marquee"
+            android:gravity="center_vertical"
+            android:paddingEnd="?android:attr/dialogPreferredPadding"
+            android:text="@*android:string/bugreport_option_interactive_title"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textColor="?android:attr/textColorAlertDialogListItem" />
 
-    <CheckedTextView
-        android:id="@+id/bugreport_option_full_title"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_below="@+id/bugreport_option_interactive_summary"
-        android:checked="false"
-        android:drawableStart="?android:attr/listChoiceIndicatorSingle"
-        android:ellipsize="marquee"
-        android:gravity="center_vertical"
-        android:paddingEnd="?android:attr/dialogPreferredPadding"
-        android:text="@*android:string/bugreport_option_full_title"
-        android:textAppearance="?android:attr/textAppearanceMedium"
-        android:textColor="?android:attr/textColorAlertDialogListItem" />
+        <TextView
+            android:id="@+id/bugreport_option_interactive_summary"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_below="@+id/bugreport_option_interactive_title"
+            android:maxLines="10"
+            android:paddingBottom="10dp"
+            android:paddingStart="32dp"
+            android:paddingEnd="?android:attr/dialogPreferredPadding"
+            android:text="@*android:string/bugreport_option_interactive_summary"
+            android:textAppearance="?android:attr/textAppearanceListItemSecondary"
+            android:textColor="?android:attr/textColorSecondary" />
 
-    <TextView
-        android:id="@+id/bugreport_option_full_summary"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_below="@+id/bugreport_option_full_title"
-        android:maxLines="10"
-        android:paddingBottom="10dp"
-        android:paddingStart="32dp"
-        android:paddingEnd="?android:attr/dialogPreferredPadding"
-        android:text="@*android:string/bugreport_option_full_summary"
-        android:textAppearance="?android:attr/textAppearanceListItemSecondary"
-        android:textColor="?android:attr/textColorSecondary" />
+        <CheckedTextView
+            android:id="@+id/bugreport_option_full_title"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_below="@+id/bugreport_option_interactive_summary"
+            android:checked="false"
+            android:drawableStart="?android:attr/listChoiceIndicatorSingle"
+            android:ellipsize="marquee"
+            android:gravity="center_vertical"
+            android:paddingEnd="?android:attr/dialogPreferredPadding"
+            android:text="@*android:string/bugreport_option_full_title"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textColor="?android:attr/textColorAlertDialogListItem" />
 
-</RelativeLayout>
\ No newline at end of file
+        <TextView
+            android:id="@+id/bugreport_option_full_summary"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_below="@+id/bugreport_option_full_title"
+            android:maxLines="10"
+            android:paddingBottom="10dp"
+            android:paddingStart="32dp"
+            android:paddingEnd="?android:attr/dialogPreferredPadding"
+            android:text="@*android:string/bugreport_option_full_summary"
+            android:textAppearance="?android:attr/textAppearanceListItemSecondary"
+            android:textColor="?android:attr/textColorSecondary" />
+
+    </RelativeLayout>
+</ScrollView>
diff --git a/res/layout/dashboard_tile.xml b/res/layout/dashboard_tile.xml
index cd7c8ee..983e6ea 100644
--- a/res/layout/dashboard_tile.xml
+++ b/res/layout/dashboard_tile.xml
@@ -15,57 +15,40 @@
 -->
 
 <LinearLayout
-        xmlns:android="http://schemas.android.com/apk/res/android"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:gravity="center_vertical"
-        android:minHeight="@dimen/dashboard_tile_minimum_height"
-        android:clickable="true"
-        android:background="@drawable/selectable_card" >
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:gravity="center_vertical"
+    android:minHeight="@dimen/dashboard_tile_minimum_height"
+    android:clickable="true"
+    android:background="@drawable/selectable_card" >
 
     <ImageView
-            android:id="@android:id/icon"
-            android:layout_width="@dimen/dashboard_tile_image_size"
-            android:layout_height="@dimen/dashboard_tile_image_size"
-            android:scaleType="centerInside"
-            android:layout_marginStart="@dimen/dashboard_tile_image_margin_start"
-            android:layout_marginEnd="@dimen/dashboard_tile_image_margin_end" />
+        android:id="@android:id/icon"
+        android:layout_width="@dimen/dashboard_tile_image_size"
+        android:layout_height="@dimen/dashboard_tile_image_size"
+        android:scaleType="centerInside"
+        android:layout_marginStart="@dimen/dashboard_tile_image_margin_start"
+        android:layout_marginEnd="@dimen/dashboard_tile_image_margin_end" />
 
     <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:orientation="vertical">
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical">
 
-        <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="0dip"
-            android:orientation="vertical"
-            android:gravity="center_vertical"
-            android:layout_weight="1">
+        <TextView android:id="@android:id/title"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:singleLine="true"
+            android:textAppearance="@style/TextAppearance.TileTitle"
+            android:ellipsize="marquee"
+            android:fadingEdge="horizontal" />
 
-            <RelativeLayout
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content">
-
-                <TextView android:id="@android:id/title"
-                          android:layout_width="wrap_content"
-                          android:layout_height="wrap_content"
-                          android:singleLine="true"
-                          android:textAppearance="@style/TextAppearance.TileTitle"
-                          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:textAppearance="@style/TextAppearance.Small"
-                          android:textColor="?android:attr/textColorSecondary" />
-
-            </RelativeLayout>
-
-        </LinearLayout>
+        <TextView android:id="@android:id/summary"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textAppearance="@style/TextAppearance.Small"
+            android:textColor="?android:attr/textColorSecondary" />
 
     </LinearLayout>
 
diff --git a/res/layout/device_admin_add.xml b/res/layout/device_admin_add.xml
index a15a962..034075b 100644
--- a/res/layout/device_admin_add.xml
+++ b/res/layout/device_admin_add.xml
@@ -118,7 +118,7 @@
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:textAppearance="?android:attr/textAppearanceMedium"
-                    android:autoLink="email|phone"
+                    android:autoLink="email|phone|web"
                     android:padding="10dip" />
             </LinearLayout>
 
diff --git a/res/layout/preview_seek_bar_view_pager.xml b/res/layout/preview_seek_bar_view_pager.xml
index 66b492c..e24b674 100644
--- a/res/layout/preview_seek_bar_view_pager.xml
+++ b/res/layout/preview_seek_bar_view_pager.xml
@@ -39,6 +39,6 @@
         android:text="@string/screen_zoom_preview_title"
         android:textAppearance="@android:style/TextAppearance.Material.Widget.ActionBar.Title"
         android:textColor="@color/seek_bar_preference_preview_text"
-        android:accessibilityTraversalBefore="@id/preview_pager"/>
+        android:importantForAccessibility="no" />
 </LinearLayout>
 
diff --git a/res/layout/screen_zoom_preview_1.xml b/res/layout/screen_zoom_preview_1.xml
index 4280091..b7d2d15 100644
--- a/res/layout/screen_zoom_preview_1.xml
+++ b/res/layout/screen_zoom_preview_1.xml
@@ -17,7 +17,8 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:fillViewport="true" >
+    android:fillViewport="true"
+    android:importantForAccessibility="noHideDescendants">
 
     <view class="com.android.settings.TouchBlockingFrameLayout"
         android:id="@+id/frame"
@@ -31,8 +32,7 @@
             android:paddingTop="@dimen/conversation_message_list_padding"
             android:paddingStart="@dimen/conversation_message_list_padding"
             android:paddingEnd="@dimen/conversation_message_list_padding"
-            android:orientation="vertical"
-            android:importantForAccessibility="noHideDescendants">
+            android:orientation="vertical">
 
             <com.android.settings.display.ConversationMessageView
                 android:layout_width="match_parent"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 834d136..9a934dd 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -7352,7 +7352,7 @@
     <!-- Message of the dialog box to confirm resetting rate-limiting in the system service ShortcutManager. [CHAR_LIMIT=none] -->
     <string name="confirm_reset_shortcut_manager_throttling_message">Reset ShortcutManager rate-limiting counters?</string>
 
-    <!-- Title of notification suggestion during optional steps of setup. [CHAR_LIMIT=40] -->
+    <!-- Title of notification suggestion during optional steps of setup. [CHAR_LIMIT=60] -->
     <string name="notification_suggestion_title">Control lock screen notifications</string>
     <!-- Summary of notification suggestion during optional steps of setup. [CHAR_LIMIT=80] -->
     <string name="notification_suggestion_summary">Show or hide notification content</string>
diff --git a/res/values/themes.xml b/res/values/themes.xml
index c85a4f1..427e11f 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -198,8 +198,8 @@
     </style>
 
     <style name="ThemeOverlay.SwitchBar.Settings" parent="@android:style/ThemeOverlay.Material.Dark.ActionBar">
-        <item name="switchBarMarginStart">@dimen/switchbar_margin_start</item>
-        <item name="switchBarMarginEnd">@dimen/switchbar_margin_end</item>
+        <item name="switchBarMarginStart">@dimen/switchbar_subsettings_margin_start</item>
+        <item name="switchBarMarginEnd">@dimen/switchbar_subsettings_margin_end</item>
         <item name="switchBarBackgroundColor">@color/switchbar_background_color</item>
     </style>
 
diff --git a/src/com/android/settings/PreviewPagerAdapter.java b/src/com/android/settings/PreviewPagerAdapter.java
index 485ac8f..20d1761 100644
--- a/src/com/android/settings/PreviewPagerAdapter.java
+++ b/src/com/android/settings/PreviewPagerAdapter.java
@@ -15,6 +15,8 @@
  */
 package com.android.settings;
 
+import android.animation.Animator;
+import android.animation.Animator.AnimatorListener;
 import android.content.Context;
 import android.content.res.Configuration;
 import android.support.v4.view.PagerAdapter;
@@ -34,8 +36,6 @@
  */
 public class PreviewPagerAdapter extends PagerAdapter {
 
-    private FrameLayout[] mPreviewFrames;
-
     /** Duration to use when cross-fading between previews. */
     private static final long CROSS_FADE_DURATION_MS = 400;
 
@@ -45,6 +45,12 @@
     /** Interpolator to use when cross-fading between previews. */
     private static final Interpolator FADE_OUT_INTERPOLATOR = new AccelerateInterpolator();
 
+    private final FrameLayout[] mPreviewFrames;
+
+    private Runnable mAnimationEndAction;
+
+    private int mAnimationCounter;
+
     public PreviewPagerAdapter(Context context, int[] previewSampleResIds,
                                Configuration[] configurations) {
         mPreviewFrames = new FrameLayout[previewSampleResIds.length];
@@ -54,9 +60,6 @@
             mPreviewFrames[i].setLayoutParams(new LinearLayout.LayoutParams(
                     LinearLayout.LayoutParams.MATCH_PARENT,
                     LinearLayout.LayoutParams.MATCH_PARENT));
-            mPreviewFrames[i].setContentDescription(
-                    context.getString(R.string.preview_page_indicator_content_description, i + 1,
-                            previewSampleResIds.length));
 
             for (Configuration configuration : configurations) {
                 // Create a new configuration for the specified value. It won't
@@ -95,6 +98,14 @@
         return (view == object);
     }
 
+    boolean isAnimating() {
+        return mAnimationCounter > 0;
+    }
+
+    void setAnimationEndAction(Runnable action) {
+        mAnimationEndAction = action;
+    }
+
     void setPreviewLayer(int newIndex, int currentIndex, int currentItem, boolean animate) {
         for (FrameLayout previewFrame : mPreviewFrames) {
             if (currentIndex >= 0) {
@@ -104,6 +115,7 @@
                             .alpha(0)
                             .setInterpolator(FADE_OUT_INTERPOLATOR)
                             .setDuration(CROSS_FADE_DURATION_MS)
+                            .setListener(new PreviewFrameAnimatorListener())
                             .withEndAction(new Runnable() {
                                 @Override
                                 public void run() {
@@ -122,6 +134,7 @@
                         .alpha(1)
                         .setInterpolator(FADE_IN_INTERPOLATOR)
                         .setDuration(CROSS_FADE_DURATION_MS)
+                        .setListener(new PreviewFrameAnimatorListener())
                         .withStartAction(new Runnable() {
                             @Override
                             public void run() {
@@ -134,4 +147,34 @@
             }
         }
     }
+
+    private void runAnimationEndAction() {
+        if (mAnimationEndAction != null && !isAnimating()) {
+            mAnimationEndAction.run();
+            mAnimationEndAction = null;
+        }
+    }
+
+    private class PreviewFrameAnimatorListener implements AnimatorListener {
+        @Override
+        public void onAnimationStart(Animator animation) {
+            mAnimationCounter++;
+        }
+
+        @Override
+        public void onAnimationEnd(Animator animation) {
+            mAnimationCounter--;
+            runAnimationEndAction();
+        }
+
+        @Override
+        public void onAnimationCancel(Animator animation) {
+            // Empty method.
+        }
+
+        @Override
+        public void onAnimationRepeat(Animator animation) {
+            // Empty method.
+        }
+    }
 }
diff --git a/src/com/android/settings/PreviewSeekBarPreferenceFragment.java b/src/com/android/settings/PreviewSeekBarPreferenceFragment.java
index bac146d..aa663cf 100644
--- a/src/com/android/settings/PreviewSeekBarPreferenceFragment.java
+++ b/src/com/android/settings/PreviewSeekBarPreferenceFragment.java
@@ -79,7 +79,16 @@
 
         @Override
         public void onStopTrackingTouch(SeekBar seekBar) {
-            commit();
+            if (mPreviewPagerAdapter.isAnimating()) {
+                mPreviewPagerAdapter.setAnimationEndAction(new Runnable() {
+                    @Override
+                    public void run() {
+                        commit();
+                    }
+                });
+            } else {
+                commit();
+            }
             mSeekByTouch = false;
         }
     }
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index 0c3260f..bcb677d 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -706,8 +706,6 @@
     private void unifyLocks() {
         int profileQuality =
                 mLockPatternUtils.getKeyguardStoredPasswordQuality(mProfileChallengeUserId);
-        mLockPatternUtils.setSeparateProfileChallengeEnabled(mProfileChallengeUserId, false,
-                mCurrentProfilePassword);
         if (profileQuality == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING) {
             mLockPatternUtils.saveLockPattern(
                     LockPatternUtils.stringToPattern(mCurrentProfilePassword),
@@ -717,6 +715,8 @@
                     mCurrentProfilePassword, mCurrentDevicePassword,
                     profileQuality, MY_USER_ID);
         }
+        mLockPatternUtils.setSeparateProfileChallengeEnabled(mProfileChallengeUserId, false,
+                mCurrentProfilePassword);
         final boolean profilePatternVisibility =
                 mLockPatternUtils.isVisiblePatternEnabled(mProfileChallengeUserId);
         mLockPatternUtils.setVisiblePatternEnabled(profilePatternVisibility, MY_USER_ID);
diff --git a/src/com/android/settings/applications/ManageApplications.java b/src/com/android/settings/applications/ManageApplications.java
index 49ef23a..9de3f7a 100644
--- a/src/com/android/settings/applications/ManageApplications.java
+++ b/src/com/android/settings/applications/ManageApplications.java
@@ -23,10 +23,7 @@
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager;
 import android.icu.text.AlphabeticIndex;
-import android.os.Bundle;
-import android.os.Environment;
-import android.os.UserHandle;
-import android.os.UserManager;
+import android.os.*;
 import android.preference.PreferenceFrameLayout;
 import android.text.TextUtils;
 import android.util.ArraySet;
@@ -1225,6 +1222,7 @@
         // TODO: Can probably hack together with less than full app state.
         private final ApplicationsState mAppState;
         private final ApplicationsState.Session mSession;
+        private final Handler mHandler;
 
         private SummaryProvider(Context context, SummaryLoader loader) {
             mContext = context;
@@ -1232,6 +1230,7 @@
             mAppState =
                     ApplicationsState.getInstance((Application) context.getApplicationContext());
             mSession = mAppState.newSession(this);
+            mHandler = new Handler(mAppState.getBackgroundLooper());
         }
 
         @Override
@@ -1248,6 +1247,16 @@
             mLoader.setSummary(this, mContext.getString(R.string.apps_summary, apps.size()));
         }
 
+        private void postRebuild() {
+            mHandler.post(new Runnable() {
+                @Override
+                public void run() {
+                    updateSummary(mSession.rebuild(ApplicationsState.FILTER_DOWNLOADED_AND_LAUNCHER,
+                            null, false));
+                }
+            });
+        }
+
         @Override
         public void onRebuildComplete(ArrayList<AppEntry> apps) {
             updateSummary(apps);
@@ -1255,20 +1264,17 @@
 
         @Override
         public void onPackageListChanged() {
-            updateSummary(mSession.rebuild(ApplicationsState.FILTER_DOWNLOADED_AND_LAUNCHER,
-                    ApplicationsState.ALPHA_COMPARATOR));
+            postRebuild();
         }
 
         @Override
         public void onLauncherInfoChanged() {
-            updateSummary(mSession.rebuild(ApplicationsState.FILTER_DOWNLOADED_AND_LAUNCHER,
-                    ApplicationsState.ALPHA_COMPARATOR));
+            postRebuild();
         }
 
         @Override
         public void onLoadEntriesCompleted() {
-            updateSummary(mSession.rebuild(ApplicationsState.FILTER_DOWNLOADED_AND_LAUNCHER,
-                    ApplicationsState.ALPHA_COMPARATOR));
+            postRebuild();
         }
 
         @Override
diff --git a/src/com/android/settings/applications/ManageAssist.java b/src/com/android/settings/applications/ManageAssist.java
index 7af967c..6fe966d 100644
--- a/src/com/android/settings/applications/ManageAssist.java
+++ b/src/com/android/settings/applications/ManageAssist.java
@@ -60,8 +60,6 @@
         mContextPref.setOnPreferenceChangeListener(this);
 
         mScreenshotPref = (SwitchPreference) findPreference(KEY_SCREENSHOT);
-        mScreenshotPref.setChecked(Settings.Secure.getInt(getContentResolver(),
-                Settings.Secure.ASSIST_SCREENSHOT_ENABLED, 1) != 0);
         mScreenshotPref.setOnPreferenceChangeListener(this);
 
         mVoiceInputPref = (VoiceInputListPreference) findPreference(KEY_VOICE_INPUT);
@@ -134,9 +132,8 @@
         }
 
         mScreenshotPref.setEnabled(mContextPref.isChecked());
-        if (!mContextPref.isChecked()) {
-            mScreenshotPref.setChecked(false);
-        }
+        mScreenshotPref.setChecked(mContextPref.isChecked() && Settings.Secure.getInt(
+                getContentResolver(), Settings.Secure.ASSIST_SCREENSHOT_ENABLED, 1) != 0);
     }
 
     private boolean isCurrentAssistVoiceService() {
diff --git a/src/com/android/settings/applications/NotificationApps.java b/src/com/android/settings/applications/NotificationApps.java
index f76aa8d..b599eb6 100644
--- a/src/com/android/settings/applications/NotificationApps.java
+++ b/src/com/android/settings/applications/NotificationApps.java
@@ -17,6 +17,7 @@
 import android.app.Activity;
 import android.app.Application;
 import android.content.Context;
+import android.os.Handler;
 import com.android.settings.R;
 import com.android.settings.applications.AppStateBaseBridge.Callback;
 import com.android.settings.dashboard.SummaryLoader;
@@ -44,6 +45,7 @@
         private final ApplicationsState.Session mSession;
         private final NotificationBackend mNotifBackend;
         private final AppStateNotificationBridge mExtraInfoBridge;
+        private final Handler mHandler;
 
         private SummaryProvider(Context context, SummaryLoader loader) {
             mContext = context;
@@ -54,6 +56,7 @@
             mNotifBackend = new NotificationBackend();
             mExtraInfoBridge = new AppStateNotificationBridge(mContext,
                     mAppState, this, mNotifBackend);
+            mHandler = new Handler(mAppState.getBackgroundLooper());
         }
 
         @Override
@@ -84,9 +87,14 @@
 
         @Override
         public void onExtraInfoUpdated() {
-            updateSummary(mSession.rebuild(
-                    AppStateNotificationBridge.FILTER_APP_NOTIFICATION_BLOCKED,
-                    ApplicationsState.ALPHA_COMPARATOR));
+            mHandler.post(new Runnable() {
+                @Override
+                public void run() {
+                    updateSummary(mSession.rebuild(
+                            AppStateNotificationBridge.FILTER_APP_NOTIFICATION_BLOCKED,
+                            null, false));
+                }
+            });
         }
 
         @Override
diff --git a/src/com/android/settings/sim/SimSettings.java b/src/com/android/settings/sim/SimSettings.java
index e783923..ece3913 100644
--- a/src/com/android/settings/sim/SimSettings.java
+++ b/src/com/android/settings/sim/SimSettings.java
@@ -164,10 +164,11 @@
 
         if (sir != null) {
             simPref.setSummary(sir.getDisplayName());
+            simPref.setEnabled(mSelectableSubInfos.size() > 1);
         } else if (sir == null) {
             simPref.setSummary(R.string.sim_selection_required_pref);
+            simPref.setEnabled(mSelectableSubInfos.size() >= 1);
         }
-        simPref.setEnabled(mSelectableSubInfos.size() >= 1);
     }
 
     private void updateCellularDataValues() {
@@ -176,17 +177,18 @@
         simPref.setTitle(R.string.cellular_data_title);
         if (DBG) log("[updateCellularDataValues] mSubInfoList=" + mSubInfoList);
 
-        if (sir != null) {
-            simPref.setSummary(sir.getDisplayName());
-        } else if (sir == null) {
-            simPref.setSummary(R.string.sim_selection_required_pref);
-        }
-
         boolean callStateIdle = isCallStateIdle();
         final boolean ecbMode = SystemProperties.getBoolean(
                 TelephonyProperties.PROPERTY_INECM_MODE, false);
-        // Enable data preference in msim mode and call state idle
-        simPref.setEnabled((mSelectableSubInfos.size() >= 1) && callStateIdle && !ecbMode);
+        if (sir != null) {
+            simPref.setSummary(sir.getDisplayName());
+            // Enable data preference in msim mode and call state idle
+            simPref.setEnabled((mSelectableSubInfos.size() > 1) && callStateIdle && !ecbMode);
+        } else if (sir == null) {
+            simPref.setSummary(R.string.sim_selection_required_pref);
+            // Enable data preference in msim mode and call state idle
+            simPref.setEnabled((mSelectableSubInfos.size() >= 1) && callStateIdle && !ecbMode);
+        }
     }
 
     private void updateCallValues() {