Merge "Add importance to notification guts."
diff --git a/api/current.txt b/api/current.txt
index 8d174c3..622d79b 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -33268,11 +33268,11 @@
     method public int getSuppressedVisualEffects();
     method public boolean isAmbient();
     method public boolean matchesInterruptionFilter();
-    field public static final int IMPORTANCE_DEFAULT = 0; // 0x0
-    field public static final int IMPORTANCE_HIGH = 1; // 0x1
-    field public static final int IMPORTANCE_LOW = -1; // 0xffffffff
-    field public static final int IMPORTANCE_MAX = 2; // 0x2
-    field public static final int IMPORTANCE_NONE = -2; // 0xfffffffe
+    field public static final int IMPORTANCE_DEFAULT = 2; // 0x2
+    field public static final int IMPORTANCE_HIGH = 3; // 0x3
+    field public static final int IMPORTANCE_LOW = 1; // 0x1
+    field public static final int IMPORTANCE_MAX = 4; // 0x4
+    field public static final int IMPORTANCE_NONE = 0; // 0x0
     field public static final int IMPORTANCE_UNSPECIFIED = -1000; // 0xfffffc18
   }
 
diff --git a/api/system-current.txt b/api/system-current.txt
index 15426c1..ba3b7e3 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -35402,11 +35402,11 @@
     method public int getSuppressedVisualEffects();
     method public boolean isAmbient();
     method public boolean matchesInterruptionFilter();
-    field public static final int IMPORTANCE_DEFAULT = 0; // 0x0
-    field public static final int IMPORTANCE_HIGH = 1; // 0x1
-    field public static final int IMPORTANCE_LOW = -1; // 0xffffffff
-    field public static final int IMPORTANCE_MAX = 2; // 0x2
-    field public static final int IMPORTANCE_NONE = -2; // 0xfffffffe
+    field public static final int IMPORTANCE_DEFAULT = 2; // 0x2
+    field public static final int IMPORTANCE_HIGH = 3; // 0x3
+    field public static final int IMPORTANCE_LOW = 1; // 0x1
+    field public static final int IMPORTANCE_MAX = 4; // 0x4
+    field public static final int IMPORTANCE_NONE = 0; // 0x0
     field public static final int IMPORTANCE_UNSPECIFIED = -1000; // 0xfffffc18
   }
 
diff --git a/api/test-current.txt b/api/test-current.txt
index 029073c..3b53be4 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -33270,11 +33270,11 @@
     method public int getSuppressedVisualEffects();
     method public boolean isAmbient();
     method public boolean matchesInterruptionFilter();
-    field public static final int IMPORTANCE_DEFAULT = 0; // 0x0
-    field public static final int IMPORTANCE_HIGH = 1; // 0x1
-    field public static final int IMPORTANCE_LOW = -1; // 0xffffffff
-    field public static final int IMPORTANCE_MAX = 2; // 0x2
-    field public static final int IMPORTANCE_NONE = -2; // 0xfffffffe
+    field public static final int IMPORTANCE_DEFAULT = 2; // 0x2
+    field public static final int IMPORTANCE_HIGH = 3; // 0x3
+    field public static final int IMPORTANCE_LOW = 1; // 0x1
+    field public static final int IMPORTANCE_MAX = 4; // 0x4
+    field public static final int IMPORTANCE_NONE = 0; // 0x0
     field public static final int IMPORTANCE_UNSPECIFIED = -1000; // 0xfffffc18
   }
 
diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java
index d7fcd7d..76c63b9 100644
--- a/core/java/android/service/notification/NotificationListenerService.java
+++ b/core/java/android/service/notification/NotificationListenerService.java
@@ -833,29 +833,29 @@
         /**
          * A notification with no importance: shows nowhere, is blocked.
          */
-        public static final int IMPORTANCE_NONE = -2;
+        public static final int IMPORTANCE_NONE = 0;
 
         /**
          * Low notification importance: only shows in the shade, below the fold.
          */
-        public static final int IMPORTANCE_LOW = -1;
+        public static final int IMPORTANCE_LOW = 1;
 
         /**
          * Default notification importance: shows everywhere, but is not intrusive.
          */
-        public static final int IMPORTANCE_DEFAULT = 0;
+        public static final int IMPORTANCE_DEFAULT = 2;
 
         /**
          * Higher notification importance: shows everywhere, makes noise,
          * but does not visually intrude.
          */
-        public static final int IMPORTANCE_HIGH = 1;
+        public static final int IMPORTANCE_HIGH = 3;
 
         /**
          * Highest notification importance: shows everywhere, makes noise,
          * and also visually intrudes.
          */
-        public static final int IMPORTANCE_MAX = 2;
+        public static final int IMPORTANCE_MAX = 4;
 
         private String mKey;
         private int mRank = -1;
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index ca249b9..4d967ff 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -3955,6 +3955,9 @@
     <string name="battery_saver_description">To help improve battery life, battery saver reduces your device’s performance and limits vibration, location services, and most background data. Email, messaging, and other apps that rely on syncing may not update unless you open them.\n\nBattery saver turns off automatically when your device is charging.</string>
 
 
+    <!-- [CHAR LIMIT=100] Notification importance slider title -->
+    <string name="notification_importance_title">Importance</string>
+
     <!-- [CHAR LIMIT=100] Notification Importance slider: blocked importance level description -->
     <string name="notification_importance_blocked">Blocked: Never show these notifications</string>
 
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 7470331..6367d37 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2088,6 +2088,7 @@
   <java-symbol type="string" name="notification_importance_default" />
   <java-symbol type="string" name="notification_importance_high" />
   <java-symbol type="string" name="notification_importance_max" />
+  <java-symbol type="string" name="notification_importance_title" />
 
   <java-symbol type="string" name="select_day" />
   <java-symbol type="string" name="select_year" />
diff --git a/packages/SystemUI/res/layout/notification_guts.xml b/packages/SystemUI/res/layout/notification_guts.xml
index d52c274..c9dbc79 100644
--- a/packages/SystemUI/res/layout/notification_guts.xml
+++ b/packages/SystemUI/res/layout/notification_guts.xml
@@ -16,75 +16,77 @@
 -->
 
 <com.android.systemui.statusbar.NotificationGuts
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:id="@+id/notification_guts"
-    android:visibility="gone"
-    android:clickable="true"
-    android:gravity="top|start"
-    >
-    <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="@android:dimen/notification_large_icon_height"
-            android:orientation="horizontal"
-            >
+        xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:id="@+id/notification_guts"
+        android:visibility="gone"
+        android:clickable="true"
+        android:gravity="top|start"
+        android:orientation="vertical"
+        android:paddingEnd="8dp"
+        android:background="@color/notification_guts_text_color" >
 
-        <ImageView android:id="@android:id/icon"
-               android:layout_width="@android:dimen/notification_large_icon_width"
-               android:layout_height="@android:dimen/notification_large_icon_height"
-               android:layout_weight="0"
-               android:padding="8dp"
-               android:scaleType="centerInside"
-               />
-        <LinearLayout
+    <!-- header -->
+    <FrameLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_gravity="start|center_vertical"
-            android:orientation="vertical"
-            android:paddingStart="8dp"
-            android:paddingEnd="8dp"
-            android:layout_weight="1"
-            >
-            <TextView
-                    android:id="@+id/pkgname"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:layout_gravity="center_vertical|start"
-                    android:layout_weight="1"
-                    android:textAppearance="@*android:style/TextAppearance.Material.Notification.Title"
-                    android:textColor="@color/notification_guts_title_color"
-                    />
-            <DateTimeView
-                    android:id="@+id/timestamp"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_weight="0"
-                    android:layout_gravity="center_vertical|start"
-                    android:textAppearance="@*android:style/TextAppearance.Material.Notification.Time"
-                    android:textColor="@color/notification_guts_text_color"
-                    />
-            <TextView
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:id="@+id/debug_info"
-                    android:layout_weight="0"
-                    android:textAppearance="@*android:style/TextAppearance.Material.Notification.Time"
-                    android:layout_gravity="bottom|start"
-                    android:visibility="gone"
-                    android:textColor="@color/notification_guts_text_color"
-                    />
-        </LinearLayout>
+            android:paddingStart="@*android:dimen/notification_content_margin_start"
+            android:paddingTop="8dp"
+            android:paddingBottom="16dp" >
 
-        <ImageButton style="@android:style/Widget.Material.Light.Button.Borderless.Small"
-                 android:id="@+id/notification_inspect_app_provided_settings"
-                 android:layout_width="52dp"
-                 android:layout_height="match_parent"
-                 android:layout_weight="0"
-                 android:gravity="center"
-                 android:src="@drawable/ic_settings"
-                 android:visibility="gone"
-                />
+        <LinearLayout
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:id="@+id/notification_guts_header"
+                android:orientation="vertical"
+                android:layout_gravity="center_vertical|start"
+                android:layout_marginEnd="52dp">
+
+                <LinearLayout
+                        android:id="@+id/notification_guts_app_details"
+                        android:orientation="horizontal"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:clipChildren="false"
+                        android:layout_gravity="start|top"
+                        android:gravity="center_vertical"
+                        >
+
+                    <ImageView
+                            android:id="@android:id/icon"
+                            android:layout_width="18dp"
+                            android:layout_height="18dp"
+                            android:layout_marginEnd="3dp"
+                            android:src="@android:drawable/arrow_down_float" />
+                    <TextView
+                            android:id="@+id/pkgname"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:textAppearance="@android:style/TextAppearance.Material.Notification.Info"
+                            android:layout_marginStart="3dp"
+                            android:layout_marginEnd="4dp"
+                            android:textColor="@color/notification_guts_title_color" />
+                    <TextView
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:id="@+id/debug_info"
+                            android:layout_weight="0"
+                            android:textAppearance="@android:style/TextAppearance.Material.Notification.Time"
+                            android:layout_gravity="bottom|start"
+                            android:visibility="gone"
+                            android:textColor="#ffffff" />
+                </LinearLayout>
+
+                <TextView
+                        android:id="@+id/topic_details"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:textAppearance="@android:style/TextAppearance.Material.Notification.Title"
+                        android:textColor="@color/notification_guts_text_color"
+                        android:layout_alignParentBottom="true"
+                        android:layout_alignParentStart="true" />
+            </LinearLayout>
 
         <ImageButton style="@android:style/Widget.Material.Light.Button.Borderless.Small"
                 android:id="@+id/notification_inspect_item"
@@ -92,8 +94,73 @@
                 android:layout_height="match_parent"
                 android:layout_weight="0"
                 android:gravity="center"
+                android:layout_gravity="center_vertical|end"
                 android:contentDescription="@string/status_bar_notification_inspect_item_title"
-                android:src="@drawable/ic_info"
-                />
+                android:src="@drawable/ic_settings" />
+    </FrameLayout>
+    <!-- Importance slider -->
+    <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:gravity="center_vertical"
+            android:paddingStart="@*android:dimen/notification_content_margin_start"
+            android:orientation="vertical"
+            android:clickable="false"
+            android:focusable="false"
+            android:paddingBottom="8dip">
+        <TextView
+                android:id="@+id/title"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:singleLine="true"
+                android:textAppearance="@android:style/TextAppearance.Material.Subhead"
+                android:textColor="@color/notification_guts_text_color"
+                android:ellipsize="marquee"
+                android:fadingEdge="horizontal"
+                android:text="@*android:string/notification_importance_title"/>
+
+        <TextView
+                android:id="@+id/summary"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_alignStart="@android:id/title"
+                android:textAlignment="viewStart"
+                android:textAppearance="@android:style/TextAppearance.Material.Body1"
+                android:textColor="@color/notification_guts_title_color"
+                android:maxLines="3"
+                android:minLines="2" />
+
+        <FrameLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:paddingTop="6dp" >
+
+            <ImageView
+                    android:id="@+id/low_importance"
+                    android:src="@android:drawable/ic_menu_close_clear_cancel"
+                    android:layout_gravity="center_vertical|start"
+                    android:layout_width="24dp"
+                    android:layout_height="24dp" />
+
+            <SeekBar
+                    android:id="@+id/seekbar"
+                    android:layout_marginStart="24dp"
+                    android:layout_marginEnd="24dp"
+                    android:layout_gravity="center_vertical"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:focusable="true"
+                    android:background="#00ffffff"
+                    android:thumbTint="@android:color/white"
+                    android:progressTint="@android:color/white" />
+
+            <ImageView
+                    android:id="@+id/max_importance"
+                    android:src="@android:drawable/ic_popup_reminder"
+                    android:layout_gravity="center_vertical|end"
+                    android:layout_width="24dp"
+                    android:layout_height="24dp"/>
+
+        </FrameLayout>
     </LinearLayout>
 </com.android.systemui.statusbar.NotificationGuts>
diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml
index 8875515..94350d9 100644
--- a/packages/SystemUI/res/values/colors.xml
+++ b/packages/SystemUI/res/values/colors.xml
@@ -102,9 +102,9 @@
     <color name="current_user_border_color">@color/system_accent_color</color>
 
     <!-- The "inside" of a notification, reached via longpress -->
-    <color name="notification_guts_bg_color">@color/system_secondary_color</color>
-    <color name="notification_guts_title_color">#FFFFFFFF</color>
-    <color name="notification_guts_text_color">#b2FFFFFF</color>
+    <color name="notification_guts_bg_color">@*android:color/material_deep_teal_500</color>
+    <color name="notification_guts_title_color">#B2DFDB</color>
+    <color name="notification_guts_text_color">#FFFFFFFF</color>
     <color name="notification_guts_btn_color">#FFFFFFFF</color>
 
     <color name="assist_orb_color">#ffffff</color>
diff --git a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
index 6207324..870e0af 100644
--- a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
@@ -246,7 +246,10 @@
                             mWatchLongPress = new Runnable() {
                                 @Override
                                 public void run() {
-                                    if (mCurrView != null && !mLongPressSent) {
+                                    float pos = getPos(ev);
+                                    float delta = pos - mInitialTouchPos;
+                                    if (mCurrView != null && !mLongPressSent
+                                            && Math.abs(delta) < mPagingTouchSlop) {
                                         mLongPressSent = true;
                                         mCurrView.sendAccessibilityEvent(
                                                 AccessibilityEvent.TYPE_VIEW_LONG_CLICKED);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 8b94e54..ab1ec72 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -23,6 +23,7 @@
 import android.animation.TimeInterpolator;
 import android.app.ActivityManager;
 import android.app.ActivityManagerNative;
+import android.app.INotificationManager;
 import android.app.Notification;
 import android.app.NotificationManager;
 import android.app.PendingIntent;
@@ -37,7 +38,6 @@
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.PackageManager.NameNotFoundException;
-import android.content.pm.ResolveInfo;
 import android.content.pm.UserInfo;
 import android.content.res.Configuration;
 import android.content.res.Resources;
@@ -84,6 +84,7 @@
 import android.widget.FrameLayout;
 import android.widget.ImageView;
 import android.widget.RemoteViews;
+import android.widget.SeekBar;
 import android.widget.TextView;
 import android.widget.Toast;
 
@@ -904,14 +905,6 @@
                        .findViewById(com.android.internal.R.id.media_actions) != null;
     }
 
-    // The gear button in the guts that links to the app's own notification settings
-    private void startAppOwnNotificationSettingsActivity(Intent intent,
-            final int notificationId, final String notificationTag, final int appUid) {
-        intent.putExtra("notification_id", notificationId);
-        intent.putExtra("notification_tag", notificationTag);
-        startNotificationGutsIntent(intent, appUid);
-    }
-
     // The (i) button in the guts that links to the system notification settings for that app
     private void startAppNotificationSettingsActivity(String packageName, final int appUid) {
         final Intent intent = new Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS);
@@ -970,12 +963,13 @@
             // app is gone, just show package name and generic icon
             pkgicon = pmUser.getDefaultActivityIcon();
         }
+
         ((ImageView) row.findViewById(android.R.id.icon)).setImageDrawable(pkgicon);
-        ((DateTimeView) row.findViewById(R.id.timestamp)).setTime(sbn.getPostTime());
         ((TextView) row.findViewById(R.id.pkgname)).setText(appname);
+
+        bindTopicImportance(sbn, row);
+
         final View settingsButton = guts.findViewById(R.id.notification_inspect_item);
-        final View appSettingsButton
-                = guts.findViewById(R.id.notification_inspect_app_provided_settings);
         if (appUid >= 0) {
             final int appUidF = appUid;
             settingsButton.setOnClickListener(new View.OnClickListener() {
@@ -984,38 +978,72 @@
                     startAppNotificationSettingsActivity(pkg, appUidF);
                 }
             });
-
-            final Intent appSettingsQueryIntent
-                    = new Intent(Intent.ACTION_MAIN)
-                    .addCategory(Notification.INTENT_CATEGORY_NOTIFICATION_PREFERENCES)
-                    .setPackage(pkg);
-            List<ResolveInfo> infos = pmUser.queryIntentActivities(appSettingsQueryIntent, 0);
-            if (infos.size() > 0) {
-                appSettingsButton.setVisibility(View.VISIBLE);
-                appSettingsButton.setContentDescription(
-                        mContext.getResources().getString(
-                                R.string.status_bar_notification_app_settings_title,
-                                appname
-                        ));
-                final Intent appSettingsLaunchIntent = new Intent(appSettingsQueryIntent)
-                        .setClassName(pkg, infos.get(0).activityInfo.name);
-                appSettingsButton.setOnClickListener(new View.OnClickListener() {
-                    public void onClick(View v) {
-                        MetricsLogger.action(mContext, MetricsLogger.ACTION_APP_NOTE_SETTINGS);
-                        startAppOwnNotificationSettingsActivity(appSettingsLaunchIntent,
-                                sbn.getId(),
-                                sbn.getTag(),
-                                appUidF);
-                    }
-                });
-            } else {
-                appSettingsButton.setVisibility(View.GONE);
-            }
         } else {
             settingsButton.setVisibility(View.GONE);
-            appSettingsButton.setVisibility(View.GONE);
         }
+    }
 
+    private void bindTopicImportance(final StatusBarNotification sbn,
+            ExpandableNotificationRow row) {
+        final INotificationManager sINM = INotificationManager.Stub.asInterface(
+                ServiceManager.getService(Context.NOTIFICATION_SERVICE));
+        final Notification.Topic topic = sbn.getNotification().getTopic() == null
+                ? new Notification.Topic(Notification.TOPIC_DEFAULT, mContext.getString(
+                        com.android.internal.R.string.default_notification_topic_label))
+                : sbn.getNotification().getTopic();
+
+        ((TextView) row.findViewById(R.id.topic_details)).setText(topic.getLabel());
+        final TextView topicSummary = ((TextView) row.findViewById(R.id.summary));
+        int importance = mNotificationData.getImportance(sbn.getKey());
+        SeekBar seekBar = (SeekBar) row.findViewById(R.id.seekbar);
+        seekBar.setMax(4);
+        seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
+            @Override
+            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
+                topicSummary.setText(getProgressSummary(progress));
+                if (fromUser) {
+                    try {
+                        sINM.setTopicImportance(sbn.getPackageName(), sbn.getUid(), topic,
+                                progress);
+                    } catch (RemoteException e) {
+                        // :(
+                    }
+                }
+            }
+
+            @Override
+            public void onStartTrackingTouch(SeekBar seekBar) {
+                // no-op
+            }
+
+            @Override
+            public void onStopTrackingTouch(SeekBar seekBar) {
+                // no-op
+            }
+
+            private String getProgressSummary(int progress) {
+                switch (progress) {
+                    case NotificationListenerService.Ranking.IMPORTANCE_NONE:
+                        return mContext.getString(
+                                com.android.internal.R.string.notification_importance_blocked);
+                    case NotificationListenerService.Ranking.IMPORTANCE_LOW:
+                        return mContext.getString(
+                                com.android.internal.R.string.notification_importance_low);
+                    case NotificationListenerService.Ranking.IMPORTANCE_DEFAULT:
+                        return mContext.getString(
+                                com.android.internal.R.string.notification_importance_default);
+                    case NotificationListenerService.Ranking.IMPORTANCE_HIGH:
+                        return mContext.getString(
+                                com.android.internal.R.string.notification_importance_high);
+                    case NotificationListenerService.Ranking.IMPORTANCE_MAX:
+                        return mContext.getString(
+                                com.android.internal.R.string.notification_importance_max);
+                    default:
+                        return "";
+                }
+            }
+        });
+        seekBar.setProgress(importance);
     }
 
     protected SwipeHelper.LongPressListener getNotificationLongClicker() {
@@ -1050,6 +1078,7 @@
 
                 MetricsLogger.action(mContext, MetricsLogger.ACTION_NOTE_CONTROLS);
                 guts.setVisibility(View.VISIBLE);
+
                 final double horz = Math.max(guts.getWidth() - x, x);
                 final double vert = Math.max(guts.getActualHeight() - y, y);
                 final float r = (float) Math.hypot(horz, vert);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
index fa41215..b2fbe20 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
@@ -289,7 +289,7 @@
             mRankingMap.getRanking(key, mTmpRanking);
             return mTmpRanking.getVisibilityOverride();
         }
-        return NotificationListenerService.Ranking.VISIBILITY_NO_OVERRIDE;
+        return Ranking.VISIBILITY_NO_OVERRIDE;
     }
 
     public boolean shouldSuppressPeek(String key) {
@@ -309,6 +309,14 @@
         return Ranking.IMPORTANCE_UNSPECIFIED;
     }
 
+    public int getImportance(String key) {
+        if (mRankingMap != null) {
+            mRankingMap.getRanking(key, mTmpRanking);
+            return mTmpRanking.getImportance();
+        }
+        return Ranking.IMPORTANCE_UNSPECIFIED;
+    }
+
     private void updateRankingAndSort(RankingMap ranking) {
         if (ranking != null) {
             mRankingMap = ranking;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java
index 46e0bf8..0081496 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java
@@ -21,12 +21,14 @@
 import android.graphics.drawable.Drawable;
 import android.util.AttributeSet;
 import android.widget.FrameLayout;
+import android.widget.LinearLayout;
+
 import com.android.systemui.R;
 
 /**
  * The guts of a notification revealed when performing a long press.
  */
-public class NotificationGuts extends FrameLayout {
+public class NotificationGuts extends LinearLayout {
 
     private Drawable mBackground;
     private int mClipTopAmount;
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index dd5baec..07343a9 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -1237,7 +1237,7 @@
         @Override
         public void setTopicImportance(String pkg, int uid, Notification.Topic topic,
                 int importance) {
-            checkCallerIsSystem();
+            enforceSystemOrSystemUI("Caller not system or systemui");
             mRankingHelper.setTopicImportance(pkg, uid, topic, importance);
             savePolicyFile();
         }
diff --git a/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java b/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java
index 8eb30d2..cf1a4aa 100644
--- a/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java
+++ b/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java
@@ -162,8 +162,11 @@
 
         new Test("with topic Hello") {
             public void run() {
+                Notification.BigTextStyle bigText = new Notification.BigTextStyle();
+                bigText.bigText("FgBHreherhethethethe\ntwetwrterter\netetweterteryetry");
                 Notification n = new Notification.Builder(NotificationTestList.this)
                         .setSmallIcon(R.drawable.icon1)
+                        .setStyle(bigText)
                         .setWhen(mActivityCreateTime)
                         .setContentTitle("hihi")
                         .setContentText("This is a notification!!!")