Loading core/java/android/app/Notification.java +42 −29 Original line number Original line Diff line number Diff line Loading @@ -895,6 +895,11 @@ public class Notification implements Parcelable */ */ public static final String EXTRA_BUILDER_APPLICATION_INFO = "android.appInfo"; public static final String EXTRA_BUILDER_APPLICATION_INFO = "android.appInfo"; /** * @hide */ public static final String EXTRA_CONTAINS_CUSTOM_VIEW = "android.contains.customView"; private Icon mSmallIcon; private Icon mSmallIcon; private Icon mLargeIcon; private Icon mLargeIcon; Loading Loading @@ -3425,6 +3430,10 @@ public class Notification implements Parcelable mN.extras.putStringArray(EXTRA_PEOPLE, mN.extras.putStringArray(EXTRA_PEOPLE, mPersonList.toArray(new String[mPersonList.size()])); mPersonList.toArray(new String[mPersonList.size()])); } } if (mN.bigContentView != null || mN.contentView != null || mN.headsUpContentView != null) { mN.extras.putBoolean(EXTRA_CONTAINS_CUSTOM_VIEW, true); } return mN; return mN; } } Loading Loading @@ -4137,6 +4146,7 @@ public class Notification implements Parcelable final float density = mBuilder.mContext.getResources().getDisplayMetrics().density; final float density = mBuilder.mContext.getResources().getDisplayMetrics().density; int topPadding = (int) (5 * density); int topPadding = (int) (5 * density); int bottomPadding = (int) (13 * density); int bottomPadding = (int) (13 * density); boolean first = true; while (i < mTexts.size() && i < rowIds.length) { while (i < mTexts.size() && i < rowIds.length) { CharSequence str = mTexts.get(i); CharSequence str = mTexts.get(i); if (str != null && !str.equals("")) { if (str != null && !str.equals("")) { Loading @@ -4148,24 +4158,27 @@ public class Notification implements Parcelable } } contentView.setViewPadding(rowIds[i], 0, topPadding, 0, contentView.setViewPadding(rowIds[i], 0, topPadding, 0, i == rowIds.length - 1 || i == mTexts.size() - 1 ? bottomPadding : 0); i == rowIds.length - 1 || i == mTexts.size() - 1 ? bottomPadding : 0); handleInboxImageMargin(contentView, rowIds[i], first); first = false; } } i++; i++; } } handleInboxImageMargin(contentView, rowIds[0]); return contentView; return contentView; } } private void handleInboxImageMargin(RemoteViews contentView, int id) { private void handleInboxImageMargin(RemoteViews contentView, int id, boolean first) { int endMargin = 0; if (first) { final int max = mBuilder.mN.extras.getInt(EXTRA_PROGRESS_MAX, 0); final int max = mBuilder.mN.extras.getInt(EXTRA_PROGRESS_MAX, 0); final boolean ind = mBuilder.mN.extras.getBoolean(EXTRA_PROGRESS_INDETERMINATE); final boolean ind = mBuilder.mN.extras.getBoolean(EXTRA_PROGRESS_INDETERMINATE); boolean hasProgress = max != 0 || ind; boolean hasProgress = max != 0 || ind; int endMargin = 0; if (mBuilder.mN.mLargeIcon != null && !hasProgress) { if (mTexts.size() > 0 && mBuilder.mN.mLargeIcon != null && !hasProgress) { endMargin = mBuilder.mContext.getResources().getDimensionPixelSize( endMargin = mBuilder.mContext.getResources().getDimensionPixelSize( R.dimen.notification_content_picture_margin); R.dimen.notification_content_picture_margin); } } } contentView.setViewLayoutMarginEnd(id, endMargin); contentView.setViewLayoutMarginEnd(id, endMargin); } } } } Loading Loading @@ -4347,13 +4360,11 @@ public class Notification implements Parcelable } } handleImage(view); handleImage(view); // handle the content margin // handle the content margin int endMargin; int endMargin = mBuilder.mContext.getResources().getDimensionPixelSize( R.dimen.notification_content_margin_end);; if (mBuilder.mN.mLargeIcon != null) { if (mBuilder.mN.mLargeIcon != null) { endMargin = mBuilder.mContext.getResources().getDimensionPixelSize( endMargin += mBuilder.mContext.getResources().getDimensionPixelSize( R.dimen.notification_content_picture_margin_media); R.dimen.notification_content_picture_margin); } else { endMargin = mBuilder.mContext.getResources().getDimensionPixelSize( R.dimen.notification_content_margin_end); } } view.setViewLayoutMarginEnd(R.id.notification_main_column, endMargin); view.setViewLayoutMarginEnd(R.id.notification_main_column, endMargin); return view; return view; Loading Loading @@ -4463,9 +4474,6 @@ public class Notification implements Parcelable return makeDecoratedHeadsUpContentView(); return makeDecoratedHeadsUpContentView(); } } /** * @hide */ private RemoteViews makeDecoratedHeadsUpContentView() { private RemoteViews makeDecoratedHeadsUpContentView() { RemoteViews headsUpContentView = mBuilder.mN.headsUpContentView == null RemoteViews headsUpContentView = mBuilder.mN.headsUpContentView == null ? mBuilder.mN.contentView ? mBuilder.mN.contentView Loading @@ -4475,25 +4483,17 @@ public class Notification implements Parcelable } } RemoteViews remoteViews = mBuilder.applyStandardTemplateWithActions( RemoteViews remoteViews = mBuilder.applyStandardTemplateWithActions( mBuilder.getBigBaseLayoutResource()); mBuilder.getBigBaseLayoutResource()); remoteViews.removeAllViews(R.id.notification_main_column); buildIntoRemoteViewContent(remoteViews, headsUpContentView); remoteViews.addView(R.id.notification_main_column, headsUpContentView); return remoteViews; return remoteViews; } } /** * @hide */ private RemoteViews makeStandardTemplateWithCustomContent(RemoteViews customContent) { private RemoteViews makeStandardTemplateWithCustomContent(RemoteViews customContent) { RemoteViews remoteViews = mBuilder.applyStandardTemplate( RemoteViews remoteViews = mBuilder.applyStandardTemplate( mBuilder.getBaseLayoutResource()); mBuilder.getBaseLayoutResource()); remoteViews.removeAllViews(R.id.notification_main_column); buildIntoRemoteViewContent(remoteViews, customContent); remoteViews.addView(R.id.notification_main_column, customContent); return remoteViews; return remoteViews; } } /** * @hide */ private RemoteViews makeDecoratedBigContentView() { private RemoteViews makeDecoratedBigContentView() { RemoteViews bigContentView = mBuilder.mN.bigContentView == null RemoteViews bigContentView = mBuilder.mN.bigContentView == null ? mBuilder.mN.contentView ? mBuilder.mN.contentView Loading @@ -4503,10 +4503,23 @@ public class Notification implements Parcelable } } RemoteViews remoteViews = mBuilder.applyStandardTemplateWithActions( RemoteViews remoteViews = mBuilder.applyStandardTemplateWithActions( mBuilder.getBigBaseLayoutResource()); mBuilder.getBigBaseLayoutResource()); remoteViews.removeAllViews(R.id.notification_main_column); buildIntoRemoteViewContent(remoteViews, bigContentView); remoteViews.addView(R.id.notification_main_column, bigContentView); return remoteViews; return remoteViews; } } private void buildIntoRemoteViewContent(RemoteViews remoteViews, RemoteViews customContent) { remoteViews.removeAllViews(R.id.notification_main_column); remoteViews.addView(R.id.notification_main_column, customContent); // also update the end margin if there is an image int endMargin = mBuilder.mContext.getResources().getDimensionPixelSize( R.dimen.notification_content_margin_end); if (mBuilder.mN.mLargeIcon != null) { endMargin += mBuilder.mContext.getResources().getDimensionPixelSize( R.dimen.notification_content_picture_margin); } remoteViews.setViewLayoutMarginEnd(R.id.notification_main_column, endMargin); } } } // When adding a new Style subclass here, don't forget to update // When adding a new Style subclass here, don't forget to update Loading core/res/res/values/dimens.xml +0 −3 Original line number Original line Diff line number Diff line Loading @@ -150,9 +150,6 @@ <!-- The margin on the end of the content view with a picture.--> <!-- The margin on the end of the content view with a picture.--> <dimen name="notification_content_picture_margin">56dp</dimen> <dimen name="notification_content_picture_margin">56dp</dimen> <!-- The margin on the end of the content view with a picture in the compact media.--> <dimen name="notification_content_picture_margin_media">72dp</dimen> <!-- height of the content margin to accomodate for the header --> <!-- height of the content margin to accomodate for the header --> <dimen name="notification_content_margin_top">30dp</dimen> <dimen name="notification_content_margin_top">30dp</dimen> Loading core/res/res/values/symbols.xml +0 −1 Original line number Original line Diff line number Diff line Loading @@ -2512,7 +2512,6 @@ <java-symbol type="dimen" name="media_notification_expanded_image_max_size" /> <java-symbol type="dimen" name="media_notification_expanded_image_max_size" /> <java-symbol type="dimen" name="media_notification_expanded_image_margin_bottom" /> <java-symbol type="dimen" name="media_notification_expanded_image_margin_bottom" /> <java-symbol type="dimen" name="notification_content_image_margin_end" /> <java-symbol type="dimen" name="notification_content_image_margin_end" /> <java-symbol type="dimen" name="notification_content_picture_margin_media" /> <java-symbol type="bool" name="config_strongAuthRequiredOnBoot" /> <java-symbol type="bool" name="config_strongAuthRequiredOnBoot" /> Loading packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java +8 −1 Original line number Original line Diff line number Diff line Loading @@ -34,6 +34,7 @@ import java.io.PrintWriter; import java.util.ArrayList; import java.util.ArrayList; import java.util.Collections; import java.util.Collections; import java.util.Comparator; import java.util.Comparator; import java.util.Objects; /** /** * The list of currently displaying notifications. * The list of currently displaying notifications. Loading Loading @@ -118,10 +119,16 @@ public class NotificationData { final RemoteViews newPublicNotification final RemoteViews newPublicNotification = updatedNotificationBuilder.makePublicContentView(); = updatedNotificationBuilder.makePublicContentView(); boolean sameCustomView = Objects.equals( notification.getNotification().extras.getBoolean( Notification.EXTRA_CONTAINS_CUSTOM_VIEW), updatedNotification.extras.getBoolean( Notification.EXTRA_CONTAINS_CUSTOM_VIEW)); applyInPlace = compareRemoteViews(cachedContentView, newContentView) applyInPlace = compareRemoteViews(cachedContentView, newContentView) && compareRemoteViews(cachedBigContentView, newBigContentView) && compareRemoteViews(cachedBigContentView, newBigContentView) && compareRemoteViews(cachedHeadsUpContentView, newHeadsUpContentView) && compareRemoteViews(cachedHeadsUpContentView, newHeadsUpContentView) && compareRemoteViews(cachedPublicContentView, newPublicNotification); && compareRemoteViews(cachedPublicContentView, newPublicNotification) && sameCustomView; cachedPublicContentView = newPublicNotification; cachedPublicContentView = newPublicNotification; cachedHeadsUpContentView = newHeadsUpContentView; cachedHeadsUpContentView = newHeadsUpContentView; cachedBigContentView = newBigContentView; cachedBigContentView = newBigContentView; Loading Loading
core/java/android/app/Notification.java +42 −29 Original line number Original line Diff line number Diff line Loading @@ -895,6 +895,11 @@ public class Notification implements Parcelable */ */ public static final String EXTRA_BUILDER_APPLICATION_INFO = "android.appInfo"; public static final String EXTRA_BUILDER_APPLICATION_INFO = "android.appInfo"; /** * @hide */ public static final String EXTRA_CONTAINS_CUSTOM_VIEW = "android.contains.customView"; private Icon mSmallIcon; private Icon mSmallIcon; private Icon mLargeIcon; private Icon mLargeIcon; Loading Loading @@ -3425,6 +3430,10 @@ public class Notification implements Parcelable mN.extras.putStringArray(EXTRA_PEOPLE, mN.extras.putStringArray(EXTRA_PEOPLE, mPersonList.toArray(new String[mPersonList.size()])); mPersonList.toArray(new String[mPersonList.size()])); } } if (mN.bigContentView != null || mN.contentView != null || mN.headsUpContentView != null) { mN.extras.putBoolean(EXTRA_CONTAINS_CUSTOM_VIEW, true); } return mN; return mN; } } Loading Loading @@ -4137,6 +4146,7 @@ public class Notification implements Parcelable final float density = mBuilder.mContext.getResources().getDisplayMetrics().density; final float density = mBuilder.mContext.getResources().getDisplayMetrics().density; int topPadding = (int) (5 * density); int topPadding = (int) (5 * density); int bottomPadding = (int) (13 * density); int bottomPadding = (int) (13 * density); boolean first = true; while (i < mTexts.size() && i < rowIds.length) { while (i < mTexts.size() && i < rowIds.length) { CharSequence str = mTexts.get(i); CharSequence str = mTexts.get(i); if (str != null && !str.equals("")) { if (str != null && !str.equals("")) { Loading @@ -4148,24 +4158,27 @@ public class Notification implements Parcelable } } contentView.setViewPadding(rowIds[i], 0, topPadding, 0, contentView.setViewPadding(rowIds[i], 0, topPadding, 0, i == rowIds.length - 1 || i == mTexts.size() - 1 ? bottomPadding : 0); i == rowIds.length - 1 || i == mTexts.size() - 1 ? bottomPadding : 0); handleInboxImageMargin(contentView, rowIds[i], first); first = false; } } i++; i++; } } handleInboxImageMargin(contentView, rowIds[0]); return contentView; return contentView; } } private void handleInboxImageMargin(RemoteViews contentView, int id) { private void handleInboxImageMargin(RemoteViews contentView, int id, boolean first) { int endMargin = 0; if (first) { final int max = mBuilder.mN.extras.getInt(EXTRA_PROGRESS_MAX, 0); final int max = mBuilder.mN.extras.getInt(EXTRA_PROGRESS_MAX, 0); final boolean ind = mBuilder.mN.extras.getBoolean(EXTRA_PROGRESS_INDETERMINATE); final boolean ind = mBuilder.mN.extras.getBoolean(EXTRA_PROGRESS_INDETERMINATE); boolean hasProgress = max != 0 || ind; boolean hasProgress = max != 0 || ind; int endMargin = 0; if (mBuilder.mN.mLargeIcon != null && !hasProgress) { if (mTexts.size() > 0 && mBuilder.mN.mLargeIcon != null && !hasProgress) { endMargin = mBuilder.mContext.getResources().getDimensionPixelSize( endMargin = mBuilder.mContext.getResources().getDimensionPixelSize( R.dimen.notification_content_picture_margin); R.dimen.notification_content_picture_margin); } } } contentView.setViewLayoutMarginEnd(id, endMargin); contentView.setViewLayoutMarginEnd(id, endMargin); } } } } Loading Loading @@ -4347,13 +4360,11 @@ public class Notification implements Parcelable } } handleImage(view); handleImage(view); // handle the content margin // handle the content margin int endMargin; int endMargin = mBuilder.mContext.getResources().getDimensionPixelSize( R.dimen.notification_content_margin_end);; if (mBuilder.mN.mLargeIcon != null) { if (mBuilder.mN.mLargeIcon != null) { endMargin = mBuilder.mContext.getResources().getDimensionPixelSize( endMargin += mBuilder.mContext.getResources().getDimensionPixelSize( R.dimen.notification_content_picture_margin_media); R.dimen.notification_content_picture_margin); } else { endMargin = mBuilder.mContext.getResources().getDimensionPixelSize( R.dimen.notification_content_margin_end); } } view.setViewLayoutMarginEnd(R.id.notification_main_column, endMargin); view.setViewLayoutMarginEnd(R.id.notification_main_column, endMargin); return view; return view; Loading Loading @@ -4463,9 +4474,6 @@ public class Notification implements Parcelable return makeDecoratedHeadsUpContentView(); return makeDecoratedHeadsUpContentView(); } } /** * @hide */ private RemoteViews makeDecoratedHeadsUpContentView() { private RemoteViews makeDecoratedHeadsUpContentView() { RemoteViews headsUpContentView = mBuilder.mN.headsUpContentView == null RemoteViews headsUpContentView = mBuilder.mN.headsUpContentView == null ? mBuilder.mN.contentView ? mBuilder.mN.contentView Loading @@ -4475,25 +4483,17 @@ public class Notification implements Parcelable } } RemoteViews remoteViews = mBuilder.applyStandardTemplateWithActions( RemoteViews remoteViews = mBuilder.applyStandardTemplateWithActions( mBuilder.getBigBaseLayoutResource()); mBuilder.getBigBaseLayoutResource()); remoteViews.removeAllViews(R.id.notification_main_column); buildIntoRemoteViewContent(remoteViews, headsUpContentView); remoteViews.addView(R.id.notification_main_column, headsUpContentView); return remoteViews; return remoteViews; } } /** * @hide */ private RemoteViews makeStandardTemplateWithCustomContent(RemoteViews customContent) { private RemoteViews makeStandardTemplateWithCustomContent(RemoteViews customContent) { RemoteViews remoteViews = mBuilder.applyStandardTemplate( RemoteViews remoteViews = mBuilder.applyStandardTemplate( mBuilder.getBaseLayoutResource()); mBuilder.getBaseLayoutResource()); remoteViews.removeAllViews(R.id.notification_main_column); buildIntoRemoteViewContent(remoteViews, customContent); remoteViews.addView(R.id.notification_main_column, customContent); return remoteViews; return remoteViews; } } /** * @hide */ private RemoteViews makeDecoratedBigContentView() { private RemoteViews makeDecoratedBigContentView() { RemoteViews bigContentView = mBuilder.mN.bigContentView == null RemoteViews bigContentView = mBuilder.mN.bigContentView == null ? mBuilder.mN.contentView ? mBuilder.mN.contentView Loading @@ -4503,10 +4503,23 @@ public class Notification implements Parcelable } } RemoteViews remoteViews = mBuilder.applyStandardTemplateWithActions( RemoteViews remoteViews = mBuilder.applyStandardTemplateWithActions( mBuilder.getBigBaseLayoutResource()); mBuilder.getBigBaseLayoutResource()); remoteViews.removeAllViews(R.id.notification_main_column); buildIntoRemoteViewContent(remoteViews, bigContentView); remoteViews.addView(R.id.notification_main_column, bigContentView); return remoteViews; return remoteViews; } } private void buildIntoRemoteViewContent(RemoteViews remoteViews, RemoteViews customContent) { remoteViews.removeAllViews(R.id.notification_main_column); remoteViews.addView(R.id.notification_main_column, customContent); // also update the end margin if there is an image int endMargin = mBuilder.mContext.getResources().getDimensionPixelSize( R.dimen.notification_content_margin_end); if (mBuilder.mN.mLargeIcon != null) { endMargin += mBuilder.mContext.getResources().getDimensionPixelSize( R.dimen.notification_content_picture_margin); } remoteViews.setViewLayoutMarginEnd(R.id.notification_main_column, endMargin); } } } // When adding a new Style subclass here, don't forget to update // When adding a new Style subclass here, don't forget to update Loading
core/res/res/values/dimens.xml +0 −3 Original line number Original line Diff line number Diff line Loading @@ -150,9 +150,6 @@ <!-- The margin on the end of the content view with a picture.--> <!-- The margin on the end of the content view with a picture.--> <dimen name="notification_content_picture_margin">56dp</dimen> <dimen name="notification_content_picture_margin">56dp</dimen> <!-- The margin on the end of the content view with a picture in the compact media.--> <dimen name="notification_content_picture_margin_media">72dp</dimen> <!-- height of the content margin to accomodate for the header --> <!-- height of the content margin to accomodate for the header --> <dimen name="notification_content_margin_top">30dp</dimen> <dimen name="notification_content_margin_top">30dp</dimen> Loading
core/res/res/values/symbols.xml +0 −1 Original line number Original line Diff line number Diff line Loading @@ -2512,7 +2512,6 @@ <java-symbol type="dimen" name="media_notification_expanded_image_max_size" /> <java-symbol type="dimen" name="media_notification_expanded_image_max_size" /> <java-symbol type="dimen" name="media_notification_expanded_image_margin_bottom" /> <java-symbol type="dimen" name="media_notification_expanded_image_margin_bottom" /> <java-symbol type="dimen" name="notification_content_image_margin_end" /> <java-symbol type="dimen" name="notification_content_image_margin_end" /> <java-symbol type="dimen" name="notification_content_picture_margin_media" /> <java-symbol type="bool" name="config_strongAuthRequiredOnBoot" /> <java-symbol type="bool" name="config_strongAuthRequiredOnBoot" /> Loading
packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java +8 −1 Original line number Original line Diff line number Diff line Loading @@ -34,6 +34,7 @@ import java.io.PrintWriter; import java.util.ArrayList; import java.util.ArrayList; import java.util.Collections; import java.util.Collections; import java.util.Comparator; import java.util.Comparator; import java.util.Objects; /** /** * The list of currently displaying notifications. * The list of currently displaying notifications. Loading Loading @@ -118,10 +119,16 @@ public class NotificationData { final RemoteViews newPublicNotification final RemoteViews newPublicNotification = updatedNotificationBuilder.makePublicContentView(); = updatedNotificationBuilder.makePublicContentView(); boolean sameCustomView = Objects.equals( notification.getNotification().extras.getBoolean( Notification.EXTRA_CONTAINS_CUSTOM_VIEW), updatedNotification.extras.getBoolean( Notification.EXTRA_CONTAINS_CUSTOM_VIEW)); applyInPlace = compareRemoteViews(cachedContentView, newContentView) applyInPlace = compareRemoteViews(cachedContentView, newContentView) && compareRemoteViews(cachedBigContentView, newBigContentView) && compareRemoteViews(cachedBigContentView, newBigContentView) && compareRemoteViews(cachedHeadsUpContentView, newHeadsUpContentView) && compareRemoteViews(cachedHeadsUpContentView, newHeadsUpContentView) && compareRemoteViews(cachedPublicContentView, newPublicNotification); && compareRemoteViews(cachedPublicContentView, newPublicNotification) && sameCustomView; cachedPublicContentView = newPublicNotification; cachedPublicContentView = newPublicNotification; cachedHeadsUpContentView = newHeadsUpContentView; cachedHeadsUpContentView = newHeadsUpContentView; cachedBigContentView = newBigContentView; cachedBigContentView = newBigContentView; Loading