Loading core/api/current.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -7009,6 +7009,7 @@ package android.app { method public boolean areNotificationsEnabled(); method public boolean areNotificationsEnabled(); method public boolean areNotificationsPaused(); method public boolean areNotificationsPaused(); method public boolean canNotifyAsPackage(@NonNull String); method public boolean canNotifyAsPackage(@NonNull String); method @FlaggedApi("android.app.api_rich_ongoing") public boolean canPostPromotedNotifications(); method public boolean canUseFullScreenIntent(); method public boolean canUseFullScreenIntent(); method public void cancel(int); method public void cancel(int); method public void cancel(@Nullable String, int); method public void cancel(@Nullable String, int); core/api/test-current.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -398,6 +398,7 @@ package android.app { method public android.content.ComponentName getEffectsSuppressor(); method public android.content.ComponentName getEffectsSuppressor(); method public boolean isNotificationPolicyAccessGrantedForPackage(@NonNull String); method public boolean isNotificationPolicyAccessGrantedForPackage(@NonNull String); method @FlaggedApi("android.app.modes_api") public boolean removeAutomaticZenRule(@NonNull String, boolean); method @FlaggedApi("android.app.modes_api") public boolean removeAutomaticZenRule(@NonNull String, boolean); method @FlaggedApi("android.app.api_rich_ongoing") public void setCanPostPromotedNotifications(@NonNull String, int, boolean); method @RequiresPermission(android.Manifest.permission.MANAGE_NOTIFICATION_LISTENERS) public void setNotificationListenerAccessGranted(@NonNull android.content.ComponentName, boolean, boolean); method @RequiresPermission(android.Manifest.permission.MANAGE_NOTIFICATION_LISTENERS) public void setNotificationListenerAccessGranted(@NonNull android.content.ComponentName, boolean, boolean); method @RequiresPermission(android.Manifest.permission.MANAGE_TOAST_RATE_LIMITING) public void setToastRateLimitingEnabled(boolean); method @RequiresPermission(android.Manifest.permission.MANAGE_TOAST_RATE_LIMITING) public void setToastRateLimitingEnabled(boolean); method @FlaggedApi("android.app.modes_api") public boolean updateAutomaticZenRule(@NonNull String, @NonNull android.app.AutomaticZenRule, boolean); method @FlaggedApi("android.app.modes_api") public boolean updateAutomaticZenRule(@NonNull String, @NonNull android.app.AutomaticZenRule, boolean); Loading core/java/android/app/INotificationManager.aidl +2 −1 Original line number Original line Diff line number Diff line Loading @@ -259,5 +259,6 @@ interface INotificationManager void unregisterCallNotificationEventListener(String packageName, in UserHandle userHandle, in ICallNotificationEventCallback listener); void unregisterCallNotificationEventListener(String packageName, in UserHandle userHandle, in ICallNotificationEventCallback listener); void setCanBePromoted(String pkg, int uid, boolean promote); void setCanBePromoted(String pkg, int uid, boolean promote); boolean canBePromoted(String pkg, int uid); boolean appCanBePromoted(String pkg, int uid); boolean canBePromoted(String pkg); } } core/java/android/app/NotificationManager.java +30 −0 Original line number Original line Diff line number Diff line Loading @@ -952,6 +952,36 @@ public class NotificationManager { } } } } /** * Returns whether the calling app's properly formatted notifications can appear in a promoted * format, which may result in higher ranking, appearances on additional surfaces, and richer * presentation. */ @FlaggedApi(android.app.Flags.FLAG_API_RICH_ONGOING) public boolean canPostPromotedNotifications() { INotificationManager service = getService(); try { return service.canBePromoted(mContext.getPackageName()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Setter for {@link #canPostPromotedNotifications()}. Only callable by the OS. * @hide */ @TestApi @FlaggedApi(android.app.Flags.FLAG_API_RICH_ONGOING) public void setCanPostPromotedNotifications(@NonNull String pkg, int uid, boolean allowed) { INotificationManager service = getService(); try { service.setCanBePromoted(pkg, uid, allowed); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** /** * Creates a group container for {@link NotificationChannel} objects. * Creates a group container for {@link NotificationChannel} objects. * * Loading services/core/java/com/android/server/notification/NotificationManagerService.java +18 −7 Original line number Original line Diff line number Diff line Loading @@ -4116,20 +4116,31 @@ public class NotificationManagerService extends SystemService { } } @Override @Override @FlaggedApi(android.app.Flags.FLAG_UI_RICH_ONGOING) @FlaggedApi(android.app.Flags.FLAG_API_RICH_ONGOING) public boolean canBePromoted(String pkg, int uid) { public boolean appCanBePromoted(String pkg, int uid) { checkCallerIsSystemOrSystemUiOrShell(); checkCallerIsSystemOrSystemUiOrShell(); if (!android.app.Flags.uiRichOngoing()) { if (!android.app.Flags.apiRichOngoing()) { return false; return false; } } return mPreferencesHelper.canBePromoted(pkg, uid); return mPreferencesHelper.canBePromoted(pkg, uid); } } @Override @Override @FlaggedApi(android.app.Flags.FLAG_UI_RICH_ONGOING) @FlaggedApi(android.app.Flags.FLAG_API_RICH_ONGOING) public boolean canBePromoted(String callingPkg) { checkCallerIsSameApp(callingPkg); if (!android.app.Flags.apiRichOngoing()) { return false; } return mPreferencesHelper.canBePromoted(callingPkg, Binder.getCallingUid()); } @Override @FlaggedApi(android.app.Flags.FLAG_API_RICH_ONGOING) public void setCanBePromoted(String pkg, int uid, boolean promote) { public void setCanBePromoted(String pkg, int uid, boolean promote) { checkCallerIsSystemOrSystemUiOrShell(); checkCallerIsSystemOrSystemUiOrShell(); if (!android.app.Flags.uiRichOngoing()) { if (!android.app.Flags.apiRichOngoing()) { return; return; } } boolean changed = mPreferencesHelper.setCanBePromoted(pkg, uid, promote); boolean changed = mPreferencesHelper.setCanBePromoted(pkg, uid, promote); Loading Loading @@ -7769,7 +7780,7 @@ public class NotificationManagerService extends SystemService { return false; return false; } } if (android.app.Flags.uiRichOngoing()) { if (android.app.Flags.apiRichOngoing()) { // This would normally be done in fixNotification(), but we need the channel info so // This would normally be done in fixNotification(), but we need the channel info so // it's done a little late // it's done a little late if (mPreferencesHelper.canBePromoted(pkg, notificationUid) if (mPreferencesHelper.canBePromoted(pkg, notificationUid) Loading Loading @@ -10733,7 +10744,7 @@ public class NotificationManagerService extends SystemService { } } @GuardedBy("mNotificationLock") @GuardedBy("mNotificationLock") @FlaggedApi(android.app.Flags.FLAG_UI_RICH_ONGOING) @FlaggedApi(android.app.Flags.FLAG_API_RICH_ONGOING) private @NonNull List<NotificationRecord> findAppNotificationByListLocked( private @NonNull List<NotificationRecord> findAppNotificationByListLocked( ArrayList<NotificationRecord> list, String pkg, int userId) { ArrayList<NotificationRecord> list, String pkg, int userId) { List<NotificationRecord> records = new ArrayList<>(); List<NotificationRecord> records = new ArrayList<>(); Loading Loading
core/api/current.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -7009,6 +7009,7 @@ package android.app { method public boolean areNotificationsEnabled(); method public boolean areNotificationsEnabled(); method public boolean areNotificationsPaused(); method public boolean areNotificationsPaused(); method public boolean canNotifyAsPackage(@NonNull String); method public boolean canNotifyAsPackage(@NonNull String); method @FlaggedApi("android.app.api_rich_ongoing") public boolean canPostPromotedNotifications(); method public boolean canUseFullScreenIntent(); method public boolean canUseFullScreenIntent(); method public void cancel(int); method public void cancel(int); method public void cancel(@Nullable String, int); method public void cancel(@Nullable String, int);
core/api/test-current.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -398,6 +398,7 @@ package android.app { method public android.content.ComponentName getEffectsSuppressor(); method public android.content.ComponentName getEffectsSuppressor(); method public boolean isNotificationPolicyAccessGrantedForPackage(@NonNull String); method public boolean isNotificationPolicyAccessGrantedForPackage(@NonNull String); method @FlaggedApi("android.app.modes_api") public boolean removeAutomaticZenRule(@NonNull String, boolean); method @FlaggedApi("android.app.modes_api") public boolean removeAutomaticZenRule(@NonNull String, boolean); method @FlaggedApi("android.app.api_rich_ongoing") public void setCanPostPromotedNotifications(@NonNull String, int, boolean); method @RequiresPermission(android.Manifest.permission.MANAGE_NOTIFICATION_LISTENERS) public void setNotificationListenerAccessGranted(@NonNull android.content.ComponentName, boolean, boolean); method @RequiresPermission(android.Manifest.permission.MANAGE_NOTIFICATION_LISTENERS) public void setNotificationListenerAccessGranted(@NonNull android.content.ComponentName, boolean, boolean); method @RequiresPermission(android.Manifest.permission.MANAGE_TOAST_RATE_LIMITING) public void setToastRateLimitingEnabled(boolean); method @RequiresPermission(android.Manifest.permission.MANAGE_TOAST_RATE_LIMITING) public void setToastRateLimitingEnabled(boolean); method @FlaggedApi("android.app.modes_api") public boolean updateAutomaticZenRule(@NonNull String, @NonNull android.app.AutomaticZenRule, boolean); method @FlaggedApi("android.app.modes_api") public boolean updateAutomaticZenRule(@NonNull String, @NonNull android.app.AutomaticZenRule, boolean); Loading
core/java/android/app/INotificationManager.aidl +2 −1 Original line number Original line Diff line number Diff line Loading @@ -259,5 +259,6 @@ interface INotificationManager void unregisterCallNotificationEventListener(String packageName, in UserHandle userHandle, in ICallNotificationEventCallback listener); void unregisterCallNotificationEventListener(String packageName, in UserHandle userHandle, in ICallNotificationEventCallback listener); void setCanBePromoted(String pkg, int uid, boolean promote); void setCanBePromoted(String pkg, int uid, boolean promote); boolean canBePromoted(String pkg, int uid); boolean appCanBePromoted(String pkg, int uid); boolean canBePromoted(String pkg); } }
core/java/android/app/NotificationManager.java +30 −0 Original line number Original line Diff line number Diff line Loading @@ -952,6 +952,36 @@ public class NotificationManager { } } } } /** * Returns whether the calling app's properly formatted notifications can appear in a promoted * format, which may result in higher ranking, appearances on additional surfaces, and richer * presentation. */ @FlaggedApi(android.app.Flags.FLAG_API_RICH_ONGOING) public boolean canPostPromotedNotifications() { INotificationManager service = getService(); try { return service.canBePromoted(mContext.getPackageName()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Setter for {@link #canPostPromotedNotifications()}. Only callable by the OS. * @hide */ @TestApi @FlaggedApi(android.app.Flags.FLAG_API_RICH_ONGOING) public void setCanPostPromotedNotifications(@NonNull String pkg, int uid, boolean allowed) { INotificationManager service = getService(); try { service.setCanBePromoted(pkg, uid, allowed); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** /** * Creates a group container for {@link NotificationChannel} objects. * Creates a group container for {@link NotificationChannel} objects. * * Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +18 −7 Original line number Original line Diff line number Diff line Loading @@ -4116,20 +4116,31 @@ public class NotificationManagerService extends SystemService { } } @Override @Override @FlaggedApi(android.app.Flags.FLAG_UI_RICH_ONGOING) @FlaggedApi(android.app.Flags.FLAG_API_RICH_ONGOING) public boolean canBePromoted(String pkg, int uid) { public boolean appCanBePromoted(String pkg, int uid) { checkCallerIsSystemOrSystemUiOrShell(); checkCallerIsSystemOrSystemUiOrShell(); if (!android.app.Flags.uiRichOngoing()) { if (!android.app.Flags.apiRichOngoing()) { return false; return false; } } return mPreferencesHelper.canBePromoted(pkg, uid); return mPreferencesHelper.canBePromoted(pkg, uid); } } @Override @Override @FlaggedApi(android.app.Flags.FLAG_UI_RICH_ONGOING) @FlaggedApi(android.app.Flags.FLAG_API_RICH_ONGOING) public boolean canBePromoted(String callingPkg) { checkCallerIsSameApp(callingPkg); if (!android.app.Flags.apiRichOngoing()) { return false; } return mPreferencesHelper.canBePromoted(callingPkg, Binder.getCallingUid()); } @Override @FlaggedApi(android.app.Flags.FLAG_API_RICH_ONGOING) public void setCanBePromoted(String pkg, int uid, boolean promote) { public void setCanBePromoted(String pkg, int uid, boolean promote) { checkCallerIsSystemOrSystemUiOrShell(); checkCallerIsSystemOrSystemUiOrShell(); if (!android.app.Flags.uiRichOngoing()) { if (!android.app.Flags.apiRichOngoing()) { return; return; } } boolean changed = mPreferencesHelper.setCanBePromoted(pkg, uid, promote); boolean changed = mPreferencesHelper.setCanBePromoted(pkg, uid, promote); Loading Loading @@ -7769,7 +7780,7 @@ public class NotificationManagerService extends SystemService { return false; return false; } } if (android.app.Flags.uiRichOngoing()) { if (android.app.Flags.apiRichOngoing()) { // This would normally be done in fixNotification(), but we need the channel info so // This would normally be done in fixNotification(), but we need the channel info so // it's done a little late // it's done a little late if (mPreferencesHelper.canBePromoted(pkg, notificationUid) if (mPreferencesHelper.canBePromoted(pkg, notificationUid) Loading Loading @@ -10733,7 +10744,7 @@ public class NotificationManagerService extends SystemService { } } @GuardedBy("mNotificationLock") @GuardedBy("mNotificationLock") @FlaggedApi(android.app.Flags.FLAG_UI_RICH_ONGOING) @FlaggedApi(android.app.Flags.FLAG_API_RICH_ONGOING) private @NonNull List<NotificationRecord> findAppNotificationByListLocked( private @NonNull List<NotificationRecord> findAppNotificationByListLocked( ArrayList<NotificationRecord> list, String pkg, int userId) { ArrayList<NotificationRecord> list, String pkg, int userId) { List<NotificationRecord> records = new ArrayList<>(); List<NotificationRecord> records = new ArrayList<>(); Loading