Loading core/java/android/app/Notification.java +61 −2 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; import android.os.SystemClock; import android.os.SystemProperties; import android.os.UserHandle; import android.text.BidiFormatter; import android.text.SpannableStringBuilder; Loading Loading @@ -2427,6 +2428,9 @@ public class Notification implements Parcelable private static final int MAX_ACTION_BUTTONS = 3; private static final boolean USE_ONLY_TITLE_IN_LOW_PRIORITY_SUMMARY = SystemProperties.getBoolean("notifications.only_title", true); private Context mContext; private Notification mN; private Bundle mUserExtras = new Bundle(); Loading Loading @@ -3760,7 +3764,7 @@ public class Notification implements Parcelable } else if (mActions.size() != 0) { result = applyStandardTemplateWithActions(getBigBaseLayoutResource()); } adaptNotificationHeaderForBigContentView(result); makeHeaderExpanded(result); return result; } Loading Loading @@ -3795,7 +3799,12 @@ public class Notification implements Parcelable } } private void adaptNotificationHeaderForBigContentView(RemoteViews result) { /** * Adapt the Notification header if this view is used as an expanded view. * * @hide */ public static void makeHeaderExpanded(RemoteViews result) { if (result != null) { result.setBoolean(R.id.notification_header, "setExpanded", true); } Loading Loading @@ -3855,7 +3864,57 @@ public class Notification implements Parcelable return publicView; } /** * Construct a content view for the display when low - priority * * @param useRegularSubtext uses the normal subtext set if there is one available. Otherwise * a new subtext is created consisting of the content of the * notification. * @hide */ public RemoteViews makeLowPriorityContentView(boolean useRegularSubtext) { int color = mN.color; mN.color = COLOR_DEFAULT; CharSequence summary = mN.extras.getCharSequence(EXTRA_SUB_TEXT); if (!useRegularSubtext || TextUtils.isEmpty(summary)) { CharSequence newSummary = createSummaryText(); if (!TextUtils.isEmpty(newSummary)) { mN.extras.putCharSequence(EXTRA_SUB_TEXT, newSummary); } } RemoteViews header = makeNotificationHeader(); if (summary != null) { mN.extras.putCharSequence(EXTRA_SUB_TEXT, summary); } else { mN.extras.remove(EXTRA_SUB_TEXT); } mN.color = color; return header; } private CharSequence createSummaryText() { CharSequence titleText = mN.extras.getCharSequence(Notification.EXTRA_TITLE); if (USE_ONLY_TITLE_IN_LOW_PRIORITY_SUMMARY) { return titleText; } SpannableStringBuilder summary = new SpannableStringBuilder(); if (titleText == null) { titleText = mN.extras.getCharSequence(Notification.EXTRA_TITLE_BIG); } BidiFormatter bidi = BidiFormatter.getInstance(); if (titleText != null) { summary.append(bidi.unicodeWrap(titleText)); } CharSequence contentText = mN.extras.getCharSequence(Notification.EXTRA_TEXT); if (titleText != null && contentText != null) { summary.append(bidi.unicodeWrap(mContext.getText( R.string.notification_header_divider_symbol_with_spaces))); } if (contentText != null) { summary.append(bidi.unicodeWrap(contentText)); } return summary; } private RemoteViews generateActionButton(Action action, boolean emphazisedMode, boolean oddAction, boolean ambient) { Loading core/res/res/layout/notification_template_header.xml +3 −2 Original line number Diff line number Diff line Loading @@ -20,10 +20,11 @@ android:id="@+id/notification_header" android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="53dp" android:layout_height="48dp" android:clipChildren="false" android:paddingTop="10dp" android:paddingBottom="16dp" android:paddingBottom="11dp" android:layout_marginBottom="5dp" android:paddingStart="@dimen/notification_content_margin_start" android:paddingEnd="16dp"> <com.android.internal.widget.CachingIconView Loading core/res/res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -578,6 +578,9 @@ <!-- The divider symbol between different parts of the notification header. not translatable [CHAR LIMIT=1] --> <string name="notification_header_divider_symbol" translatable="false">•</string> <!-- The divider symbol between different parts of the notification header including spaces. not translatable [CHAR LIMIT=3] --> <string name="notification_header_divider_symbol_with_spaces" translatable="false">" • "</string> <!-- Text shown in place of notification contents when the notification is hidden on a secure lockscreen --> <string name="notification_hidden_text">Contents hidden</string> Loading core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -2788,6 +2788,7 @@ <java-symbol type="drawable" name="lockscreen_notselected" /> <java-symbol type="drawable" name="lockscreen_selected" /> <java-symbol type="string" name="notification_header_divider_symbol_with_spaces" /> <java-symbol type="string" name="config_defaultCellBroadcastReceiverComponent" /> <java-symbol type="string" name="app_category_game" /> Loading packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +5 −2 Original line number Diff line number Diff line Loading @@ -1524,8 +1524,9 @@ public abstract class BaseStatusBar extends SystemUI implements entry.notification.getUser().getIdentifier()); final StatusBarNotification sbn = entry.notification; boolean isLowPriority = mNotificationData.isAmbient(sbn.getKey()); try { entry.cacheContentViews(mContext, null); entry.cacheContentViews(mContext, null, isLowPriority); } catch (RuntimeException e) { Log.e(TAG, "Unable to get notification remote views", e); return false; Loading Loading @@ -1597,6 +1598,7 @@ public abstract class BaseStatusBar extends SystemUI implements workAroundBadLayerDrawableOpacity(row); bindDismissRunnable(row); row.setIsLowPriority(isLowPriority); // NB: the large icon is now handled entirely by the template Loading Loading @@ -2283,7 +2285,8 @@ public abstract class BaseStatusBar extends SystemUI implements boolean applyInPlace; try { applyInPlace = entry.cacheContentViews(mContext, notification.getNotification()); applyInPlace = entry.cacheContentViews(mContext, notification.getNotification(), mNotificationData.isAmbient(key)); } catch (RuntimeException e) { Log.e(TAG, "Unable to get notification remote views", e); applyInPlace = false; Loading Loading
core/java/android/app/Notification.java +61 −2 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; import android.os.SystemClock; import android.os.SystemProperties; import android.os.UserHandle; import android.text.BidiFormatter; import android.text.SpannableStringBuilder; Loading Loading @@ -2427,6 +2428,9 @@ public class Notification implements Parcelable private static final int MAX_ACTION_BUTTONS = 3; private static final boolean USE_ONLY_TITLE_IN_LOW_PRIORITY_SUMMARY = SystemProperties.getBoolean("notifications.only_title", true); private Context mContext; private Notification mN; private Bundle mUserExtras = new Bundle(); Loading Loading @@ -3760,7 +3764,7 @@ public class Notification implements Parcelable } else if (mActions.size() != 0) { result = applyStandardTemplateWithActions(getBigBaseLayoutResource()); } adaptNotificationHeaderForBigContentView(result); makeHeaderExpanded(result); return result; } Loading Loading @@ -3795,7 +3799,12 @@ public class Notification implements Parcelable } } private void adaptNotificationHeaderForBigContentView(RemoteViews result) { /** * Adapt the Notification header if this view is used as an expanded view. * * @hide */ public static void makeHeaderExpanded(RemoteViews result) { if (result != null) { result.setBoolean(R.id.notification_header, "setExpanded", true); } Loading Loading @@ -3855,7 +3864,57 @@ public class Notification implements Parcelable return publicView; } /** * Construct a content view for the display when low - priority * * @param useRegularSubtext uses the normal subtext set if there is one available. Otherwise * a new subtext is created consisting of the content of the * notification. * @hide */ public RemoteViews makeLowPriorityContentView(boolean useRegularSubtext) { int color = mN.color; mN.color = COLOR_DEFAULT; CharSequence summary = mN.extras.getCharSequence(EXTRA_SUB_TEXT); if (!useRegularSubtext || TextUtils.isEmpty(summary)) { CharSequence newSummary = createSummaryText(); if (!TextUtils.isEmpty(newSummary)) { mN.extras.putCharSequence(EXTRA_SUB_TEXT, newSummary); } } RemoteViews header = makeNotificationHeader(); if (summary != null) { mN.extras.putCharSequence(EXTRA_SUB_TEXT, summary); } else { mN.extras.remove(EXTRA_SUB_TEXT); } mN.color = color; return header; } private CharSequence createSummaryText() { CharSequence titleText = mN.extras.getCharSequence(Notification.EXTRA_TITLE); if (USE_ONLY_TITLE_IN_LOW_PRIORITY_SUMMARY) { return titleText; } SpannableStringBuilder summary = new SpannableStringBuilder(); if (titleText == null) { titleText = mN.extras.getCharSequence(Notification.EXTRA_TITLE_BIG); } BidiFormatter bidi = BidiFormatter.getInstance(); if (titleText != null) { summary.append(bidi.unicodeWrap(titleText)); } CharSequence contentText = mN.extras.getCharSequence(Notification.EXTRA_TEXT); if (titleText != null && contentText != null) { summary.append(bidi.unicodeWrap(mContext.getText( R.string.notification_header_divider_symbol_with_spaces))); } if (contentText != null) { summary.append(bidi.unicodeWrap(contentText)); } return summary; } private RemoteViews generateActionButton(Action action, boolean emphazisedMode, boolean oddAction, boolean ambient) { Loading
core/res/res/layout/notification_template_header.xml +3 −2 Original line number Diff line number Diff line Loading @@ -20,10 +20,11 @@ android:id="@+id/notification_header" android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="53dp" android:layout_height="48dp" android:clipChildren="false" android:paddingTop="10dp" android:paddingBottom="16dp" android:paddingBottom="11dp" android:layout_marginBottom="5dp" android:paddingStart="@dimen/notification_content_margin_start" android:paddingEnd="16dp"> <com.android.internal.widget.CachingIconView Loading
core/res/res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -578,6 +578,9 @@ <!-- The divider symbol between different parts of the notification header. not translatable [CHAR LIMIT=1] --> <string name="notification_header_divider_symbol" translatable="false">•</string> <!-- The divider symbol between different parts of the notification header including spaces. not translatable [CHAR LIMIT=3] --> <string name="notification_header_divider_symbol_with_spaces" translatable="false">" • "</string> <!-- Text shown in place of notification contents when the notification is hidden on a secure lockscreen --> <string name="notification_hidden_text">Contents hidden</string> Loading
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -2788,6 +2788,7 @@ <java-symbol type="drawable" name="lockscreen_notselected" /> <java-symbol type="drawable" name="lockscreen_selected" /> <java-symbol type="string" name="notification_header_divider_symbol_with_spaces" /> <java-symbol type="string" name="config_defaultCellBroadcastReceiverComponent" /> <java-symbol type="string" name="app_category_game" /> Loading
packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +5 −2 Original line number Diff line number Diff line Loading @@ -1524,8 +1524,9 @@ public abstract class BaseStatusBar extends SystemUI implements entry.notification.getUser().getIdentifier()); final StatusBarNotification sbn = entry.notification; boolean isLowPriority = mNotificationData.isAmbient(sbn.getKey()); try { entry.cacheContentViews(mContext, null); entry.cacheContentViews(mContext, null, isLowPriority); } catch (RuntimeException e) { Log.e(TAG, "Unable to get notification remote views", e); return false; Loading Loading @@ -1597,6 +1598,7 @@ public abstract class BaseStatusBar extends SystemUI implements workAroundBadLayerDrawableOpacity(row); bindDismissRunnable(row); row.setIsLowPriority(isLowPriority); // NB: the large icon is now handled entirely by the template Loading Loading @@ -2283,7 +2285,8 @@ public abstract class BaseStatusBar extends SystemUI implements boolean applyInPlace; try { applyInPlace = entry.cacheContentViews(mContext, notification.getNotification()); applyInPlace = entry.cacheContentViews(mContext, notification.getNotification(), mNotificationData.isAmbient(key)); } catch (RuntimeException e) { Log.e(TAG, "Unable to get notification remote views", e); applyInPlace = false; Loading