Loading api/system-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -545,6 +545,7 @@ package android.app { } public class NotificationManager { method @NonNull public java.util.List<java.lang.String> getAllowedAssistantCapabilities(); method @Nullable public android.content.ComponentName getAllowedNotificationAssistant(); method public boolean isNotificationAssistantAccessGranted(@NonNull android.content.ComponentName); method public void setNotificationAssistantAccessGranted(@Nullable android.content.ComponentName, boolean); Loading Loading @@ -6646,6 +6647,7 @@ package android.service.notification { method public final void adjustNotifications(@NonNull java.util.List<android.service.notification.Adjustment>); method public void onActionInvoked(@NonNull String, @NonNull android.app.Notification.Action, int); method @NonNull public final android.os.IBinder onBind(@Nullable android.content.Intent); method public void onCapabilitiesChanged(); method public void onNotificationDirectReplied(@NonNull String); method @Nullable public abstract android.service.notification.Adjustment onNotificationEnqueued(@NonNull android.service.notification.StatusBarNotification); method @Nullable public android.service.notification.Adjustment onNotificationEnqueued(@NonNull android.service.notification.StatusBarNotification, @NonNull android.app.NotificationChannel); Loading core/java/android/app/INotificationManager.aidl +4 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,10 @@ interface INotificationManager boolean areNotificationsEnabled(String pkg); int getPackageImportance(String pkg); List<String> getAllowedAssistantCapabilities(String pkg); void allowAssistantCapability(String adjustmentType); void disallowAssistantCapability(String adjustmentType); boolean shouldHideSilentStatusIcons(String callingPkg); void setHideSilentStatusIcons(boolean hide); Loading core/java/android/app/NotificationManager.java +20 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import android.os.ServiceManager; import android.os.StrictMode; import android.os.UserHandle; import android.provider.Settings.Global; import android.service.notification.Adjustment; import android.service.notification.Condition; import android.service.notification.StatusBarNotification; import android.service.notification.ZenModeConfig; Loading Loading @@ -1182,6 +1183,25 @@ public class NotificationManager { } } /** * Returns the list of {@link android.service.notification.Adjustment adjustment keys} that can * be modified by the current {@link android.service.notification.NotificationAssistantService}. * * <p>Only callable by the current * {@link android.service.notification.NotificationAssistantService}. * See {@link #isNotificationAssistantAccessGranted(ComponentName)}</p> * @hide */ @SystemApi public @NonNull @Adjustment.Keys List<String> getAllowedAssistantCapabilities() { INotificationManager service = getService(); try { return service.getAllowedAssistantCapabilities(mContext.getOpPackageName()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** @hide */ public boolean isNotificationPolicyAccessGrantedForPackage(String pkg) { INotificationManager service = getService(); Loading core/java/android/service/notification/Adjustment.java +12 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.service.notification; import android.annotation.NonNull; import android.annotation.StringDef; import android.annotation.SystemApi; import android.app.Notification; import android.os.Bundle; Loading @@ -23,6 +24,9 @@ import android.os.Parcel; import android.os.Parcelable; import android.os.UserHandle; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * Ranking updates from the Assistant. * Loading @@ -43,6 +47,14 @@ public final class Adjustment implements Parcelable { private final Bundle mSignals; private final int mUser; /** @hide */ @StringDef (prefix = { "KEY_" }, value = { KEY_CONTEXTUAL_ACTIONS, KEY_GROUP_KEY, KEY_IMPORTANCE, KEY_PEOPLE, KEY_SNOOZE_CRITERIA, KEY_TEXT_REPLIES, KEY_USER_SENTIMENT }) @Retention(RetentionPolicy.SOURCE) public @interface Keys {} /** * Data type: ArrayList of {@code String}, where each is a representation of a * {@link android.provider.ContactsContract.Contacts#CONTENT_LOOKUP_URI}. Loading core/java/android/service/notification/NotificationAssistantService.java +10 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.annotation.SdkConstant; import android.annotation.SystemApi; import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.admin.DevicePolicyManager; import android.content.ComponentName; import android.content.Context; Loading Loading @@ -141,7 +142,6 @@ public abstract class NotificationAssistantService extends NotificationListenerS return onNotificationEnqueued(sbn); } /** * Implement this method to learn when notifications are removed, how they were interacted with * before removal, and why they were removed. Loading Loading @@ -215,6 +215,15 @@ public abstract class NotificationAssistantService extends NotificationListenerS @Source int source) { } /** * Implement this to know when a user has changed which features of * their notifications the assistant can modify. * <p> Query {@link NotificationManager#getAllowedAssistantCapabilities()} to see what * {@link Adjustment adjustments} you are currently allowed to make.</p> */ public void onCapabilitiesChanged() { } /** * Updates a notification. N.B. this won’t cause * an existing notification to alert, but might allow a future update to Loading Loading
api/system-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -545,6 +545,7 @@ package android.app { } public class NotificationManager { method @NonNull public java.util.List<java.lang.String> getAllowedAssistantCapabilities(); method @Nullable public android.content.ComponentName getAllowedNotificationAssistant(); method public boolean isNotificationAssistantAccessGranted(@NonNull android.content.ComponentName); method public void setNotificationAssistantAccessGranted(@Nullable android.content.ComponentName, boolean); Loading Loading @@ -6646,6 +6647,7 @@ package android.service.notification { method public final void adjustNotifications(@NonNull java.util.List<android.service.notification.Adjustment>); method public void onActionInvoked(@NonNull String, @NonNull android.app.Notification.Action, int); method @NonNull public final android.os.IBinder onBind(@Nullable android.content.Intent); method public void onCapabilitiesChanged(); method public void onNotificationDirectReplied(@NonNull String); method @Nullable public abstract android.service.notification.Adjustment onNotificationEnqueued(@NonNull android.service.notification.StatusBarNotification); method @Nullable public android.service.notification.Adjustment onNotificationEnqueued(@NonNull android.service.notification.StatusBarNotification, @NonNull android.app.NotificationChannel); Loading
core/java/android/app/INotificationManager.aidl +4 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,10 @@ interface INotificationManager boolean areNotificationsEnabled(String pkg); int getPackageImportance(String pkg); List<String> getAllowedAssistantCapabilities(String pkg); void allowAssistantCapability(String adjustmentType); void disallowAssistantCapability(String adjustmentType); boolean shouldHideSilentStatusIcons(String callingPkg); void setHideSilentStatusIcons(boolean hide); Loading
core/java/android/app/NotificationManager.java +20 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import android.os.ServiceManager; import android.os.StrictMode; import android.os.UserHandle; import android.provider.Settings.Global; import android.service.notification.Adjustment; import android.service.notification.Condition; import android.service.notification.StatusBarNotification; import android.service.notification.ZenModeConfig; Loading Loading @@ -1182,6 +1183,25 @@ public class NotificationManager { } } /** * Returns the list of {@link android.service.notification.Adjustment adjustment keys} that can * be modified by the current {@link android.service.notification.NotificationAssistantService}. * * <p>Only callable by the current * {@link android.service.notification.NotificationAssistantService}. * See {@link #isNotificationAssistantAccessGranted(ComponentName)}</p> * @hide */ @SystemApi public @NonNull @Adjustment.Keys List<String> getAllowedAssistantCapabilities() { INotificationManager service = getService(); try { return service.getAllowedAssistantCapabilities(mContext.getOpPackageName()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** @hide */ public boolean isNotificationPolicyAccessGrantedForPackage(String pkg) { INotificationManager service = getService(); Loading
core/java/android/service/notification/Adjustment.java +12 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.service.notification; import android.annotation.NonNull; import android.annotation.StringDef; import android.annotation.SystemApi; import android.app.Notification; import android.os.Bundle; Loading @@ -23,6 +24,9 @@ import android.os.Parcel; import android.os.Parcelable; import android.os.UserHandle; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * Ranking updates from the Assistant. * Loading @@ -43,6 +47,14 @@ public final class Adjustment implements Parcelable { private final Bundle mSignals; private final int mUser; /** @hide */ @StringDef (prefix = { "KEY_" }, value = { KEY_CONTEXTUAL_ACTIONS, KEY_GROUP_KEY, KEY_IMPORTANCE, KEY_PEOPLE, KEY_SNOOZE_CRITERIA, KEY_TEXT_REPLIES, KEY_USER_SENTIMENT }) @Retention(RetentionPolicy.SOURCE) public @interface Keys {} /** * Data type: ArrayList of {@code String}, where each is a representation of a * {@link android.provider.ContactsContract.Contacts#CONTENT_LOOKUP_URI}. Loading
core/java/android/service/notification/NotificationAssistantService.java +10 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.annotation.SdkConstant; import android.annotation.SystemApi; import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.admin.DevicePolicyManager; import android.content.ComponentName; import android.content.Context; Loading Loading @@ -141,7 +142,6 @@ public abstract class NotificationAssistantService extends NotificationListenerS return onNotificationEnqueued(sbn); } /** * Implement this method to learn when notifications are removed, how they were interacted with * before removal, and why they were removed. Loading Loading @@ -215,6 +215,15 @@ public abstract class NotificationAssistantService extends NotificationListenerS @Source int source) { } /** * Implement this to know when a user has changed which features of * their notifications the assistant can modify. * <p> Query {@link NotificationManager#getAllowedAssistantCapabilities()} to see what * {@link Adjustment adjustments} you are currently allowed to make.</p> */ public void onCapabilitiesChanged() { } /** * Updates a notification. N.B. this won’t cause * an existing notification to alert, but might allow a future update to Loading