Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b4ee870e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Hides audibly alerted icon after 30 seconds."

parents 5f861a81 7306b905
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -41084,12 +41084,12 @@ 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();
    method public java.lang.CharSequence getImportanceExplanation();
    method public java.lang.String getKey();
    method public long getLastAudiblyAlertedMillis();
    method public java.lang.String getOverrideGroupKey();
    method public int getRank();
    method public int getSuppressedVisualEffects();
+24 −16
Original line number Diff line number Diff line
@@ -1482,7 +1482,7 @@ public abstract class NotificationListenerService extends Service {
        private boolean mShowBadge;
        private @UserSentiment int mUserSentiment = USER_SENTIMENT_NEUTRAL;
        private boolean mHidden;
        private boolean mAudiblyAlerted;
        private long mLastAudiblyAlertedMs;
        private boolean mNoisy;
        private ArrayList<Notification.Action> mSmartActions;
        private ArrayList<CharSequence> mSmartReplies;
@@ -1650,12 +1650,12 @@ public abstract class NotificationListenerService extends Service {
        }

        /**
         * Returns whether this notification alerted the user via sound or vibration.
         * Returns the last time this notification alerted the user via sound or vibration.
         *
         * @return true if the notification alerted the user, false otherwise.
         * @return the time of the last alerting behavior, in milliseconds.
         */
        public boolean audiblyAlerted() {
            return mAudiblyAlerted;
        public long getLastAudiblyAlertedMillis() {
            return mLastAudiblyAlertedMs;
        }

        /** @hide */
@@ -1672,7 +1672,7 @@ public abstract class NotificationListenerService extends Service {
                CharSequence explanation, String overrideGroupKey,
                NotificationChannel channel, ArrayList<String> overridePeople,
                ArrayList<SnoozeCriterion> snoozeCriteria, boolean showBadge,
                int userSentiment, boolean hidden, boolean audiblyAlerted,
                int userSentiment, boolean hidden, long lastAudiblyAlertedMs,
                boolean noisy, ArrayList<Notification.Action> smartActions,
                ArrayList<CharSequence> smartReplies) {
            mKey = key;
@@ -1690,7 +1690,7 @@ public abstract class NotificationListenerService extends Service {
            mShowBadge = showBadge;
            mUserSentiment = userSentiment;
            mHidden = hidden;
            mAudiblyAlerted = audiblyAlerted;
            mLastAudiblyAlertedMs = lastAudiblyAlertedMs;
            mNoisy = noisy;
            mSmartActions = smartActions;
            mSmartReplies = smartReplies;
@@ -1743,7 +1743,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, Long> mLastAudiblyAlerted;
        private ArrayMap<String, Boolean> mNoisy;
        private ArrayMap<String, ArrayList<Notification.Action>> mSmartActions;
        private ArrayMap<String, ArrayList<CharSequence>> mSmartReplies;
@@ -1776,7 +1776,7 @@ public abstract class NotificationListenerService extends Service {
                    getImportance(key), getImportanceExplanation(key), getOverrideGroupKey(key),
                    getChannel(key), getOverridePeople(key), getSnoozeCriteria(key),
                    getShowBadge(key), getUserSentiment(key), getHidden(key),
                    getAudiblyAlerted(key), getNoisy(key), getSmartActions(key),
                    getLastAudiblyAlerted(key), getNoisy(key), getSmartActions(key),
                    getSmartReplies(key));
            return rank >= 0;
        }
@@ -1915,14 +1915,14 @@ public abstract class NotificationListenerService extends Service {
            return hidden == null ? false : hidden.booleanValue();
        }

        private boolean getAudiblyAlerted(String key) {
        private long getLastAudiblyAlerted(String key) {
            synchronized (this) {
                if (mAudiblyAlerted == null) {
                    buildAudiblyAlertedLocked();
                if (mLastAudiblyAlerted == null) {
                    buildLastAudiblyAlertedLocked();
                }
            }
            Boolean audiblyAlerted = mAudiblyAlerted.get(key);
            return audiblyAlerted == null ? false : audiblyAlerted.booleanValue();
            Long lastAudibleAlerted = mLastAudiblyAlerted.get(key);
            return lastAudibleAlerted == null ? -1 : lastAudibleAlerted.longValue();
        }

        private boolean getNoisy(String key) {
@@ -1994,6 +1994,14 @@ public abstract class NotificationListenerService extends Service {
            return newMap;
        }

        private ArrayMap<String, Long> buildLongMapFromBundle(Bundle bundle) {
            ArrayMap<String, Long> newMap = new ArrayMap<>(bundle.size());
            for (String key : bundle.keySet()) {
                newMap.put(key, bundle.getLong(key));
            }
            return newMap;
        }

        // Locked by 'this'
        private void buildVisibilityOverridesLocked() {
            mVisibilityOverrides = buildIntMapFromBundle(mRankingUpdate.getVisibilityOverrides());
@@ -2070,8 +2078,8 @@ public abstract class NotificationListenerService extends Service {
        }

        // Locked by 'this'
        private void buildAudiblyAlertedLocked() {
            mAudiblyAlerted = buildBooleanMapFromBundle(mRankingUpdate.getAudiblyAlerted());
        private void buildLastAudiblyAlertedLocked() {
            mLastAudiblyAlerted = buildLongMapFromBundle(mRankingUpdate.getLastAudiblyAlerted());
        }

        // Locked by 'this'
+7 −7
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ public class NotificationRankingUpdate implements Parcelable {
    private final Bundle mHidden;
    private final Bundle mSmartActions;
    private final Bundle mSmartReplies;
    private final Bundle mAudiblyAlerted;
    private final Bundle mLastAudiblyAlerted;
    private final Bundle mNoisy;

    public NotificationRankingUpdate(String[] keys, String[] interceptedKeys,
@@ -47,7 +47,7 @@ public class NotificationRankingUpdate implements Parcelable {
            int[] importance, Bundle explanation, Bundle overrideGroupKeys,
            Bundle channels, Bundle overridePeople, Bundle snoozeCriteria,
            Bundle showBadge, Bundle userSentiment, Bundle hidden, Bundle smartActions,
            Bundle smartReplies, Bundle audiblyAlerted, Bundle noisy) {
            Bundle smartReplies, Bundle lastAudiblyAlerted, Bundle noisy) {
        mKeys = keys;
        mInterceptedKeys = interceptedKeys;
        mVisibilityOverrides = visibilityOverrides;
@@ -63,7 +63,7 @@ public class NotificationRankingUpdate implements Parcelable {
        mHidden = hidden;
        mSmartActions = smartActions;
        mSmartReplies = smartReplies;
        mAudiblyAlerted = audiblyAlerted;
        mLastAudiblyAlerted = lastAudiblyAlerted;
        mNoisy = noisy;
    }

@@ -84,7 +84,7 @@ public class NotificationRankingUpdate implements Parcelable {
        mHidden = in.readBundle();
        mSmartActions = in.readBundle();
        mSmartReplies = in.readBundle();
        mAudiblyAlerted = in.readBundle();
        mLastAudiblyAlerted = in.readBundle();
        mNoisy = in.readBundle();
    }

@@ -110,7 +110,7 @@ public class NotificationRankingUpdate implements Parcelable {
        out.writeBundle(mHidden);
        out.writeBundle(mSmartActions);
        out.writeBundle(mSmartReplies);
        out.writeBundle(mAudiblyAlerted);
        out.writeBundle(mLastAudiblyAlerted);
        out.writeBundle(mNoisy);
    }

@@ -185,8 +185,8 @@ public class NotificationRankingUpdate implements Parcelable {
        return mSmartReplies;
    }

    public Bundle getAudiblyAlerted() {
        return mAudiblyAlerted;
    public Bundle getLastAudiblyAlerted() {
        return mLastAudiblyAlerted;
    }

    public Bundle getNoisy() {
+1 −1
Original line number Diff line number Diff line
@@ -340,7 +340,7 @@ public class NotificationHeaderView extends ViewGroup {
    }

    /** Updates icon visibility based on the noisiness of the notification. */
    public void setAudiblyAlerted(boolean audiblyAlerted) {
    public void setRecentlyAudiblyAlerted(boolean audiblyAlerted) {
        mAudiblyAlertedIcon.setVisibility(audiblyAlerted ? View.VISIBLE : View.GONE);
    }

+1 −1
Original line number Diff line number Diff line
@@ -437,7 +437,7 @@ public class NotificationViewHierarchyManager {
            }

            row.showAppOpsIcons(entry.mActiveAppOps);
            row.setAudiblyAlerted(entry.audiblyAlerted);
            row.setLastAudiblyAlertedMs(entry.lastAudiblyAlertedMs);
        }

        Trace.beginSection("NotificationPresenter#onUpdateRowStates");
Loading