diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 7900fc5a69cbc..45a46b3021781 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -4082,16 +4082,23 @@ public class Notification implements Parcelable
/**
* Construct a RemoteViews for the final heads-up notification layout.
+ *
+ * @param increasedHeight true if this layout be created with an increased height. Some
+ * styles may support showing more then just that basic 1U size
+ * and the system may decide to render important notifications
+ * slightly bigger even when collapsed.
+ *
+ * @hide
*/
- public RemoteViews createHeadsUpContentView() {
+ public RemoteViews createHeadsUpContentView(boolean increasedHeight) {
if (mN.headsUpContentView != null
&& (mStyle == null || !mStyle.displayCustomViewInline())) {
return mN.headsUpContentView;
} else if (mStyle != null) {
- final RemoteViews styleView = mStyle.makeHeadsUpContentView();
- if (styleView != null) {
- return styleView;
- }
+ final RemoteViews styleView = mStyle.makeHeadsUpContentView(increasedHeight);
+ if (styleView != null) {
+ return styleView;
+ }
} else if (mActions.size() == 0) {
return null;
}
@@ -4099,6 +4106,13 @@ public class Notification implements Parcelable
return applyStandardTemplateWithActions(getBigBaseLayoutResource());
}
+ /**
+ * Construct a RemoteViews for the final heads-up notification layout.
+ */
+ public RemoteViews createHeadsUpContentView() {
+ return createHeadsUpContentView(false /* useIncreasedHeight */);
+ }
+
/**
* Construct a RemoteViews for the display in public contexts like on the lockscreen.
*
@@ -4823,9 +4837,11 @@ public class Notification implements Parcelable
/**
* Construct a Style-specific RemoteViews for the final HUN layout.
+ *
+ * @param increasedHeight true if this layout be created with an increased height.
* @hide
*/
- public RemoteViews makeHeadsUpContentView() {
+ public RemoteViews makeHeadsUpContentView(boolean increasedHeight) {
return null;
}
@@ -5168,6 +5184,17 @@ public class Notification implements Parcelable
return super.makeContentView(increasedHeight);
}
+ /**
+ * @hide
+ */
+ @Override
+ public RemoteViews makeHeadsUpContentView(boolean increasedHeight) {
+ if (increasedHeight && mBuilder.mActions.size() > 0) {
+ return makeBigContentView();
+ }
+ return super.makeHeadsUpContentView(increasedHeight);
+ }
+
/**
* @hide
*/
@@ -5578,7 +5605,10 @@ public class Notification implements Parcelable
* @hide
*/
@Override
- public RemoteViews makeHeadsUpContentView() {
+ public RemoteViews makeHeadsUpContentView(boolean increasedHeight) {
+ if (increasedHeight) {
+ return makeBigContentView();
+ }
Message m = findLatestIncomingMessage();
CharSequence title = mConversationTitle != null
? mConversationTitle
@@ -6028,7 +6058,7 @@ public class Notification implements Parcelable
* @hide
*/
@Override
- public RemoteViews makeHeadsUpContentView() {
+ public RemoteViews makeHeadsUpContentView(boolean increasedHeight) {
RemoteViews expanded = makeMediaBigContentView();
return expanded != null ? expanded : makeMediaContentView();
}
@@ -6208,7 +6238,7 @@ public class Notification implements Parcelable
* @hide
*/
@Override
- public RemoteViews makeHeadsUpContentView() {
+ public RemoteViews makeHeadsUpContentView(boolean increasedHeight) {
return makeDecoratedHeadsUpContentView();
}
@@ -6344,7 +6374,7 @@ public class Notification implements Parcelable
* @hide
*/
@Override
- public RemoteViews makeHeadsUpContentView() {
+ public RemoteViews makeHeadsUpContentView(boolean increasedHeight) {
RemoteViews customRemoteView = mBuilder.mN.headsUpContentView != null
? mBuilder.mN.headsUpContentView
: mBuilder.mN.contentView;
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index e737d2d6f0076..2102e07120153 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -69,8 +69,8 @@
92dp
-
- 132dp
+
+ 132dp
64dp
@@ -87,6 +87,9 @@
148dp
+
+ 188dp
+
1500dp
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
index 2e9c7fd85e420..6a5f79fdcd9ba 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
@@ -76,6 +76,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
private int mNotificationMinHeightLegacy;
private int mMaxHeadsUpHeightLegacy;
private int mMaxHeadsUpHeight;
+ private int mMaxHeadsUpHeightIncreased;
private int mNotificationMinHeight;
private int mNotificationMinHeightLarge;
private int mNotificationMaxHeight;
@@ -209,6 +210,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
private boolean mIsLowPriority;
private boolean mIsColorized;
private boolean mUseIncreasedCollapsedHeight;
+ private boolean mUseIncreasedHeadsUpHeight;
@Override
public boolean isGroupExpansionChanging() {
@@ -354,8 +356,14 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
boolean headsUpCustom = layout.getHeadsUpChild() != null &&
layout.getHeadsUpChild().getId()
!= com.android.internal.R.id.status_bar_latest_event_content;
- int headsUpheight = headsUpCustom && beforeN ? mMaxHeadsUpHeightLegacy
- : mMaxHeadsUpHeight;
+ int headsUpheight;
+ if (headsUpCustom && beforeN) {
+ headsUpheight = mMaxHeadsUpHeightLegacy;
+ } else if (mUseIncreasedHeadsUpHeight && layout == mPrivateLayout) {
+ headsUpheight = mMaxHeadsUpHeightIncreased;
+ } else {
+ headsUpheight = mMaxHeadsUpHeight;
+ }
layout.setHeights(minHeight, headsUpheight, mNotificationMaxHeight,
mNotificationAmbientHeight);
}
@@ -991,6 +999,10 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
mUseIncreasedCollapsedHeight = use;
}
+ public void setUseIncreasedHeadsUpHeight(boolean use) {
+ mUseIncreasedHeadsUpHeight = use;
+ }
+
public interface ExpansionLogger {
public void logNotificationExpansion(String key, boolean userAction, boolean expanded);
}
@@ -1005,12 +1017,14 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
mNotificationMinHeightLegacy = getFontScaledHeight(R.dimen.notification_min_height_legacy);
mNotificationMinHeight = getFontScaledHeight(R.dimen.notification_min_height);
mNotificationMinHeightLarge = getFontScaledHeight(
- R.dimen.notification_min_height_large);
+ R.dimen.notification_min_height_increased);
mNotificationMaxHeight = getFontScaledHeight(R.dimen.notification_max_height);
mNotificationAmbientHeight = getFontScaledHeight(R.dimen.notification_ambient_height);
mMaxHeadsUpHeightLegacy = getFontScaledHeight(
R.dimen.notification_max_heads_up_height_legacy);
mMaxHeadsUpHeight = getFontScaledHeight(R.dimen.notification_max_heads_up_height);
+ mMaxHeadsUpHeightIncreased = getFontScaledHeight(
+ R.dimen.notification_max_heads_up_height_increased);
mIncreasedPaddingBetweenElements = getResources()
.getDimensionPixelSize(R.dimen.notification_divider_height_increased);
mIconTransformContentShiftNoIcon = getResources().getDimensionPixelSize(
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
index f73a5ea04ae48..81db42927682f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
@@ -126,7 +126,8 @@ public class NotificationData {
}
public boolean cacheContentViews(Context ctx, Notification updatedNotification,
- boolean isLowPriority, boolean useIncreasedCollapsedView) {
+ boolean isLowPriority, boolean useIncreasedCollapsedView,
+ boolean useIncreasedHeadsUp) {
boolean applyInPlace = false;
if (updatedNotification != null) {
final Notification.Builder updatedNotificationBuilder
@@ -136,7 +137,7 @@ public class NotificationData {
final RemoteViews newBigContentView = createBigContentView(
updatedNotificationBuilder, isLowPriority);
final RemoteViews newHeadsUpContentView =
- updatedNotificationBuilder.createHeadsUpContentView();
+ updatedNotificationBuilder.createHeadsUpContentView(useIncreasedHeadsUp);
final RemoteViews newPublicNotification
= updatedNotificationBuilder.makePublicContentView();
final RemoteViews newAmbientNotification
@@ -165,7 +166,7 @@ public class NotificationData {
cachedContentView = createContentView(builder, isLowPriority,
useIncreasedCollapsedView);
cachedBigContentView = createBigContentView(builder, isLowPriority);
- cachedHeadsUpContentView = builder.createHeadsUpContentView();
+ cachedHeadsUpContentView = builder.createHeadsUpContentView(useIncreasedHeadsUp);
cachedPublicContentView = builder.makePublicContentView();
cachedAmbientContentView = builder.makeAmbientNotification();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index bc43663ba2613..cb0b537a52467 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -712,6 +712,7 @@ public class StatusBar extends SystemUI implements DemoMode,
private NetworkController mNetworkController;
private KeyguardMonitorImpl mKeyguardMonitor;
private BatteryController mBatteryController;
+ private boolean mPanelExpanded;
private LogMaker mStatusBarStateLog;
private LockscreenGestureLogger mLockscreenGestureLogger = new LockscreenGestureLogger();
private NotificationIconAreaController mNotificationIconAreaController;
@@ -2679,6 +2680,7 @@ public class StatusBar extends SystemUI implements DemoMode,
}
public void setPanelExpanded(boolean isExpanded) {
+ mPanelExpanded = isExpanded;
mStatusBarWindowManager.setPanelExpanded(isExpanded);
mVisualStabilityManager.setPanelExpanded(isExpanded);
if (isExpanded && getBarState() != StatusBarState.KEYGUARD) {
@@ -6090,8 +6092,10 @@ public class StatusBar extends SystemUI implements DemoMode,
boolean isLowPriority = mNotificationData.isAmbient(sbn.getKey());
boolean useIncreasedCollapsedHeight = mMessagingUtil.isImportantMessaging(sbn,
mNotificationData.getImportance(sbn.getKey()));
+ boolean useIncreasedHeadsUp = useIncreasedCollapsedHeight && mPanelExpanded;
try {
- entry.cacheContentViews(mContext, null, isLowPriority, useIncreasedCollapsedHeight);
+ entry.cacheContentViews(mContext, null, isLowPriority, useIncreasedCollapsedHeight,
+ useIncreasedHeadsUp);
} catch (RuntimeException e) {
Log.e(TAG, "Unable to get notification remote views", e);
return false;
@@ -6262,6 +6266,7 @@ public class StatusBar extends SystemUI implements DemoMode,
}
row.setUserLocked(userLocked);
row.setUseIncreasedCollapsedHeight(useIncreasedCollapsedHeight);
+ row.setUseIncreasedHeadsUpHeight(useIncreasedHeadsUp);
row.onNotificationUpdated(entry);
return true;
}
@@ -6756,10 +6761,13 @@ public class StatusBar extends SystemUI implements DemoMode,
boolean useIncreasedCollapsedHeight = mMessagingUtil.isImportantMessaging(notification,
mNotificationData.getImportance(notification.getKey()));
entry.row.setUseIncreasedCollapsedHeight(useIncreasedCollapsedHeight);
+ boolean useIncreasedHeadsUp = useIncreasedCollapsedHeight && mPanelExpanded;
+ entry.row.setUseIncreasedHeadsUpHeight(useIncreasedHeadsUp);
boolean applyInPlace;
try {
applyInPlace = entry.cacheContentViews(mContext, notification.getNotification(),
- mNotificationData.isAmbient(key), useIncreasedCollapsedHeight);
+ mNotificationData.isAmbient(key), useIncreasedCollapsedHeight,
+ useIncreasedHeadsUp);
} catch (RuntimeException e) {
Log.e(TAG, "Unable to get notification remote views", e);
applyInPlace = false;