Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -40366,6 +40366,7 @@ package android.service.notification { public static class NotificationListenerService.Ranking { ctor public NotificationListenerService.Ranking(); method public boolean audiblyAlerted(); method public boolean canShowBadge(); method public android.app.NotificationChannel getChannel(); method public int getImportance(); core/java/android/app/Notification.java +1 −0 Original line number Diff line number Diff line Loading @@ -4457,6 +4457,7 @@ public class Notification implements Parcelable contentView.setViewVisibility(R.id.time, View.GONE); contentView.setImageViewIcon(R.id.profile_badge, null); contentView.setViewVisibility(R.id.profile_badge, View.GONE); contentView.setViewVisibility(R.id.alerted_icon, View.GONE); mN.mUsesStandardHeader = false; } Loading core/java/android/service/notification/NotificationListenerService.java +31 −4 Original line number Diff line number Diff line Loading @@ -1461,6 +1461,7 @@ public abstract class NotificationListenerService extends Service { private boolean mShowBadge; private @UserSentiment int mUserSentiment = USER_SENTIMENT_NEUTRAL; private boolean mHidden; private boolean mAudiblyAlerted; private ArrayList<Notification.Action> mSmartActions; private ArrayList<CharSequence> mSmartReplies; Loading Loading @@ -1626,6 +1627,15 @@ public abstract class NotificationListenerService extends Service { return mHidden; } /** * Returns whether this notification alerted the user via sound or vibration. * * @return true if the notification alerted the user, false otherwise. */ public boolean audiblyAlerted() { return mAudiblyAlerted; } /** * @hide */ Loading @@ -1635,8 +1645,8 @@ public abstract class NotificationListenerService extends Service { CharSequence explanation, String overrideGroupKey, NotificationChannel channel, ArrayList<String> overridePeople, ArrayList<SnoozeCriterion> snoozeCriteria, boolean showBadge, int userSentiment, boolean hidden, ArrayList<Notification.Action> smartActions, ArrayList<CharSequence> smartReplies) { int userSentiment, boolean hidden, boolean audiblyAlerted, ArrayList<Notification.Action> smartActions, ArrayList<CharSequence> smartReplies) { mKey = key; mRank = rank; mIsAmbient = importance < NotificationManager.IMPORTANCE_LOW; Loading @@ -1652,6 +1662,7 @@ public abstract class NotificationListenerService extends Service { mShowBadge = showBadge; mUserSentiment = userSentiment; mHidden = hidden; mAudiblyAlerted = audiblyAlerted; mSmartActions = smartActions; mSmartReplies = smartReplies; } Loading Loading @@ -1703,6 +1714,7 @@ public abstract class NotificationListenerService extends Service { private ArrayMap<String, Boolean> mShowBadge; private ArrayMap<String, Integer> mUserSentiment; private ArrayMap<String, Boolean> mHidden; private ArrayMap<String, Boolean> mAudiblyAlerted; private ArrayMap<String, ArrayList<Notification.Action>> mSmartActions; private ArrayMap<String, ArrayList<CharSequence>> mSmartReplies; Loading Loading @@ -1733,8 +1745,8 @@ public abstract class NotificationListenerService extends Service { getVisibilityOverride(key), getSuppressedVisualEffects(key), getImportance(key), getImportanceExplanation(key), getOverrideGroupKey(key), getChannel(key), getOverridePeople(key), getSnoozeCriteria(key), getShowBadge(key), getUserSentiment(key), getHidden(key), getSmartActions(key), getSmartReplies(key)); getShowBadge(key), getUserSentiment(key), getHidden(key), getAudiblyAlerted(key), getSmartActions(key), getSmartReplies(key)); return rank >= 0; } Loading Loading @@ -1872,6 +1884,16 @@ public abstract class NotificationListenerService extends Service { return hidden == null ? false : hidden.booleanValue(); } private boolean getAudiblyAlerted(String key) { synchronized (this) { if (mAudiblyAlerted == null) { buildAudiblyAlertedLocked(); } } Boolean audiblyAlerted = mAudiblyAlerted.get(key); return audiblyAlerted == null ? false : audiblyAlerted.booleanValue(); } private ArrayList<Notification.Action> getSmartActions(String key) { synchronized (this) { if (mSmartActions == null) { Loading Loading @@ -2006,6 +2028,11 @@ public abstract class NotificationListenerService extends Service { mHidden = buildBooleanMapFromBundle(mRankingUpdate.getHidden()); } // Locked by 'this' private void buildAudiblyAlertedLocked() { mAudiblyAlerted = buildBooleanMapFromBundle(mRankingUpdate.getAudiblyAlerted()); } // Locked by 'this' private void buildSmartActions() { Bundle smartActions = mRankingUpdate.getSmartActions(); Loading core/java/android/service/notification/NotificationRankingUpdate.java +9 −1 Original line number Diff line number Diff line Loading @@ -39,13 +39,14 @@ public class NotificationRankingUpdate implements Parcelable { private final Bundle mHidden; private final Bundle mSmartActions; private final Bundle mSmartReplies; private final Bundle mAudiblyAlerted; public NotificationRankingUpdate(String[] keys, String[] interceptedKeys, Bundle visibilityOverrides, Bundle suppressedVisualEffects, int[] importance, Bundle explanation, Bundle overrideGroupKeys, Bundle channels, Bundle overridePeople, Bundle snoozeCriteria, Bundle showBadge, Bundle userSentiment, Bundle hidden, Bundle smartActions, Bundle smartReplies) { Bundle smartReplies, Bundle audiblyAlerted) { mKeys = keys; mInterceptedKeys = interceptedKeys; mVisibilityOverrides = visibilityOverrides; Loading @@ -61,6 +62,7 @@ public class NotificationRankingUpdate implements Parcelable { mHidden = hidden; mSmartActions = smartActions; mSmartReplies = smartReplies; mAudiblyAlerted = audiblyAlerted; } public NotificationRankingUpdate(Parcel in) { Loading @@ -80,6 +82,7 @@ public class NotificationRankingUpdate implements Parcelable { mHidden = in.readBundle(); mSmartActions = in.readBundle(); mSmartReplies = in.readBundle(); mAudiblyAlerted = in.readBundle(); } @Override Loading @@ -104,6 +107,7 @@ public class NotificationRankingUpdate implements Parcelable { out.writeBundle(mHidden); out.writeBundle(mSmartActions); out.writeBundle(mSmartReplies); out.writeBundle(mAudiblyAlerted); } public static final Parcelable.Creator<NotificationRankingUpdate> CREATOR Loading Loading @@ -176,4 +180,8 @@ public class NotificationRankingUpdate implements Parcelable { public Bundle getSmartReplies() { return mSmartReplies; } public Bundle getAudiblyAlerted() { return mAudiblyAlerted; } } core/java/android/view/NotificationHeaderView.java +12 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ public class NotificationHeaderView extends ViewGroup { private View mCameraIcon; private View mMicIcon; private View mAppOps; private View mAudiblyAlertedIcon; private int mIconColor; private int mOriginalNotificationColor; private boolean mExpanded; Loading Loading @@ -121,6 +122,7 @@ public class NotificationHeaderView extends ViewGroup { mMicIcon = findViewById(com.android.internal.R.id.mic); mOverlayIcon = findViewById(com.android.internal.R.id.overlay); mAppOps = findViewById(com.android.internal.R.id.app_ops); mAudiblyAlertedIcon = findViewById(com.android.internal.R.id.alerted_icon); } @Override Loading Loading @@ -216,6 +218,11 @@ public class NotificationHeaderView extends ViewGroup { layoutRight = end - paddingEnd; end = layoutLeft = layoutRight - child.getMeasuredWidth(); } if (child == mAudiblyAlertedIcon) { int paddingEnd = mContentEndMargin; layoutRight = end - paddingEnd; end = layoutLeft = layoutRight - child.getMeasuredWidth(); } if (getLayoutDirection() == LAYOUT_DIRECTION_RTL) { int ltrLeft = layoutLeft; layoutLeft = getWidth() - layoutRight; Loading Loading @@ -337,6 +344,11 @@ public class NotificationHeaderView extends ViewGroup { ? View.VISIBLE : View.GONE); } /** Updates icon visibility based on the noisiness of the notification. */ public void setAudiblyAlerted(boolean audiblyAlerted) { mAudiblyAlertedIcon.setVisibility(audiblyAlerted ? View.VISIBLE : View.GONE); } private void updateExpandButton() { int drawableId; int contentDescriptionId; Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -40366,6 +40366,7 @@ package android.service.notification { public static class NotificationListenerService.Ranking { ctor public NotificationListenerService.Ranking(); method public boolean audiblyAlerted(); method public boolean canShowBadge(); method public android.app.NotificationChannel getChannel(); method public int getImportance();
core/java/android/app/Notification.java +1 −0 Original line number Diff line number Diff line Loading @@ -4457,6 +4457,7 @@ public class Notification implements Parcelable contentView.setViewVisibility(R.id.time, View.GONE); contentView.setImageViewIcon(R.id.profile_badge, null); contentView.setViewVisibility(R.id.profile_badge, View.GONE); contentView.setViewVisibility(R.id.alerted_icon, View.GONE); mN.mUsesStandardHeader = false; } Loading
core/java/android/service/notification/NotificationListenerService.java +31 −4 Original line number Diff line number Diff line Loading @@ -1461,6 +1461,7 @@ public abstract class NotificationListenerService extends Service { private boolean mShowBadge; private @UserSentiment int mUserSentiment = USER_SENTIMENT_NEUTRAL; private boolean mHidden; private boolean mAudiblyAlerted; private ArrayList<Notification.Action> mSmartActions; private ArrayList<CharSequence> mSmartReplies; Loading Loading @@ -1626,6 +1627,15 @@ public abstract class NotificationListenerService extends Service { return mHidden; } /** * Returns whether this notification alerted the user via sound or vibration. * * @return true if the notification alerted the user, false otherwise. */ public boolean audiblyAlerted() { return mAudiblyAlerted; } /** * @hide */ Loading @@ -1635,8 +1645,8 @@ public abstract class NotificationListenerService extends Service { CharSequence explanation, String overrideGroupKey, NotificationChannel channel, ArrayList<String> overridePeople, ArrayList<SnoozeCriterion> snoozeCriteria, boolean showBadge, int userSentiment, boolean hidden, ArrayList<Notification.Action> smartActions, ArrayList<CharSequence> smartReplies) { int userSentiment, boolean hidden, boolean audiblyAlerted, ArrayList<Notification.Action> smartActions, ArrayList<CharSequence> smartReplies) { mKey = key; mRank = rank; mIsAmbient = importance < NotificationManager.IMPORTANCE_LOW; Loading @@ -1652,6 +1662,7 @@ public abstract class NotificationListenerService extends Service { mShowBadge = showBadge; mUserSentiment = userSentiment; mHidden = hidden; mAudiblyAlerted = audiblyAlerted; mSmartActions = smartActions; mSmartReplies = smartReplies; } Loading Loading @@ -1703,6 +1714,7 @@ public abstract class NotificationListenerService extends Service { private ArrayMap<String, Boolean> mShowBadge; private ArrayMap<String, Integer> mUserSentiment; private ArrayMap<String, Boolean> mHidden; private ArrayMap<String, Boolean> mAudiblyAlerted; private ArrayMap<String, ArrayList<Notification.Action>> mSmartActions; private ArrayMap<String, ArrayList<CharSequence>> mSmartReplies; Loading Loading @@ -1733,8 +1745,8 @@ public abstract class NotificationListenerService extends Service { getVisibilityOverride(key), getSuppressedVisualEffects(key), getImportance(key), getImportanceExplanation(key), getOverrideGroupKey(key), getChannel(key), getOverridePeople(key), getSnoozeCriteria(key), getShowBadge(key), getUserSentiment(key), getHidden(key), getSmartActions(key), getSmartReplies(key)); getShowBadge(key), getUserSentiment(key), getHidden(key), getAudiblyAlerted(key), getSmartActions(key), getSmartReplies(key)); return rank >= 0; } Loading Loading @@ -1872,6 +1884,16 @@ public abstract class NotificationListenerService extends Service { return hidden == null ? false : hidden.booleanValue(); } private boolean getAudiblyAlerted(String key) { synchronized (this) { if (mAudiblyAlerted == null) { buildAudiblyAlertedLocked(); } } Boolean audiblyAlerted = mAudiblyAlerted.get(key); return audiblyAlerted == null ? false : audiblyAlerted.booleanValue(); } private ArrayList<Notification.Action> getSmartActions(String key) { synchronized (this) { if (mSmartActions == null) { Loading Loading @@ -2006,6 +2028,11 @@ public abstract class NotificationListenerService extends Service { mHidden = buildBooleanMapFromBundle(mRankingUpdate.getHidden()); } // Locked by 'this' private void buildAudiblyAlertedLocked() { mAudiblyAlerted = buildBooleanMapFromBundle(mRankingUpdate.getAudiblyAlerted()); } // Locked by 'this' private void buildSmartActions() { Bundle smartActions = mRankingUpdate.getSmartActions(); Loading
core/java/android/service/notification/NotificationRankingUpdate.java +9 −1 Original line number Diff line number Diff line Loading @@ -39,13 +39,14 @@ public class NotificationRankingUpdate implements Parcelable { private final Bundle mHidden; private final Bundle mSmartActions; private final Bundle mSmartReplies; private final Bundle mAudiblyAlerted; public NotificationRankingUpdate(String[] keys, String[] interceptedKeys, Bundle visibilityOverrides, Bundle suppressedVisualEffects, int[] importance, Bundle explanation, Bundle overrideGroupKeys, Bundle channels, Bundle overridePeople, Bundle snoozeCriteria, Bundle showBadge, Bundle userSentiment, Bundle hidden, Bundle smartActions, Bundle smartReplies) { Bundle smartReplies, Bundle audiblyAlerted) { mKeys = keys; mInterceptedKeys = interceptedKeys; mVisibilityOverrides = visibilityOverrides; Loading @@ -61,6 +62,7 @@ public class NotificationRankingUpdate implements Parcelable { mHidden = hidden; mSmartActions = smartActions; mSmartReplies = smartReplies; mAudiblyAlerted = audiblyAlerted; } public NotificationRankingUpdate(Parcel in) { Loading @@ -80,6 +82,7 @@ public class NotificationRankingUpdate implements Parcelable { mHidden = in.readBundle(); mSmartActions = in.readBundle(); mSmartReplies = in.readBundle(); mAudiblyAlerted = in.readBundle(); } @Override Loading @@ -104,6 +107,7 @@ public class NotificationRankingUpdate implements Parcelable { out.writeBundle(mHidden); out.writeBundle(mSmartActions); out.writeBundle(mSmartReplies); out.writeBundle(mAudiblyAlerted); } public static final Parcelable.Creator<NotificationRankingUpdate> CREATOR Loading Loading @@ -176,4 +180,8 @@ public class NotificationRankingUpdate implements Parcelable { public Bundle getSmartReplies() { return mSmartReplies; } public Bundle getAudiblyAlerted() { return mAudiblyAlerted; } }
core/java/android/view/NotificationHeaderView.java +12 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ public class NotificationHeaderView extends ViewGroup { private View mCameraIcon; private View mMicIcon; private View mAppOps; private View mAudiblyAlertedIcon; private int mIconColor; private int mOriginalNotificationColor; private boolean mExpanded; Loading Loading @@ -121,6 +122,7 @@ public class NotificationHeaderView extends ViewGroup { mMicIcon = findViewById(com.android.internal.R.id.mic); mOverlayIcon = findViewById(com.android.internal.R.id.overlay); mAppOps = findViewById(com.android.internal.R.id.app_ops); mAudiblyAlertedIcon = findViewById(com.android.internal.R.id.alerted_icon); } @Override Loading Loading @@ -216,6 +218,11 @@ public class NotificationHeaderView extends ViewGroup { layoutRight = end - paddingEnd; end = layoutLeft = layoutRight - child.getMeasuredWidth(); } if (child == mAudiblyAlertedIcon) { int paddingEnd = mContentEndMargin; layoutRight = end - paddingEnd; end = layoutLeft = layoutRight - child.getMeasuredWidth(); } if (getLayoutDirection() == LAYOUT_DIRECTION_RTL) { int ltrLeft = layoutLeft; layoutLeft = getWidth() - layoutRight; Loading Loading @@ -337,6 +344,11 @@ public class NotificationHeaderView extends ViewGroup { ? View.VISIBLE : View.GONE); } /** Updates icon visibility based on the noisiness of the notification. */ public void setAudiblyAlerted(boolean audiblyAlerted) { mAudiblyAlertedIcon.setVisibility(audiblyAlerted ? View.VISIBLE : View.GONE); } private void updateExpandButton() { int drawableId; int contentDescriptionId; Loading