Loading core/java/android/app/Notification.java +22 −3 Original line number Diff line number Diff line Loading @@ -5226,6 +5226,7 @@ public class Notification implements Parcelable if (mStyle != null) { mStyle.reduceImageSizes(mContext); mStyle.purgeResources(); mStyle.validate(mContext); mStyle.buildStyled(mN); } mN.reduceImageSizes(mContext); Loading Loading @@ -5795,6 +5796,13 @@ public class Notification implements Parcelable */ public void reduceImageSizes(Context context) { } /** * Validate that this style was properly composed. This is called at build time. * @hide */ public void validate(Context context) { } } /** Loading Loading @@ -6185,12 +6193,23 @@ public class Notification implements Parcelable * @param user Required - The person displayed for any messages that are sent by the * user. Any messages added with {@link #addMessage(Notification.MessagingStyle.Message)} * who don't have a Person associated with it will be displayed as if they were sent * by this user. The user also needs to have a valid name associated with it. * by this user. The user also needs to have a valid name associated with it, which will * be enforced starting in Android P. */ public MessagingStyle(@NonNull Person user) { mUser = user; if (user == null || user.getName() == null) { throw new RuntimeException("user must be valid and have a name"); } /** * Validate that this style was properly composed. This is called at build time. * @hide */ @Override public void validate(Context context) { super.validate(context); if (context.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.P && (mUser == null || mUser.getName() == null)) { throw new RuntimeException("User must be valid and have a name."); } } Loading Loading
core/java/android/app/Notification.java +22 −3 Original line number Diff line number Diff line Loading @@ -5226,6 +5226,7 @@ public class Notification implements Parcelable if (mStyle != null) { mStyle.reduceImageSizes(mContext); mStyle.purgeResources(); mStyle.validate(mContext); mStyle.buildStyled(mN); } mN.reduceImageSizes(mContext); Loading Loading @@ -5795,6 +5796,13 @@ public class Notification implements Parcelable */ public void reduceImageSizes(Context context) { } /** * Validate that this style was properly composed. This is called at build time. * @hide */ public void validate(Context context) { } } /** Loading Loading @@ -6185,12 +6193,23 @@ public class Notification implements Parcelable * @param user Required - The person displayed for any messages that are sent by the * user. Any messages added with {@link #addMessage(Notification.MessagingStyle.Message)} * who don't have a Person associated with it will be displayed as if they were sent * by this user. The user also needs to have a valid name associated with it. * by this user. The user also needs to have a valid name associated with it, which will * be enforced starting in Android P. */ public MessagingStyle(@NonNull Person user) { mUser = user; if (user == null || user.getName() == null) { throw new RuntimeException("user must be valid and have a name"); } /** * Validate that this style was properly composed. This is called at build time. * @hide */ @Override public void validate(Context context) { super.validate(context); if (context.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.P && (mUser == null || mUser.getName() == null)) { throw new RuntimeException("User must be valid and have a name."); } } Loading