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

Commit 2c674d8a authored by Caitlin Shkuratov's avatar Caitlin Shkuratov Committed by Android (Google) Code Review
Browse files

Merge changes I426d8365,Ic05b6542 into main

* changes:
  [Notif] Fix most of the IDE warnings in HeadsUpManagerImpl.
  [Notif] HeadsUpManagerImpl: protected -> private for fields & methods.
parents 7bf3913d 67e99c14
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -45,7 +45,6 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntry
import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder
import com.android.systemui.statusbar.notification.collection.provider.visualStabilityProvider
import com.android.systemui.statusbar.notification.collection.render.GroupMembershipManager
import com.android.systemui.statusbar.notification.headsup.HeadsUpManagerImpl.HeadsUpEntry
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
import com.android.systemui.statusbar.notification.row.NotificationTestHelper
import com.android.systemui.statusbar.notification.shared.NotificationThrottleHun
+94 −105
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ import com.android.systemui.shade.domain.interactor.ShadeInteractor;
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.chips.notification.shared.StatusBarNotifChips;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.collection.coordinator.HeadsUpCoordinator;
import com.android.systemui.statusbar.notification.collection.provider.OnReorderingAllowedListener;
import com.android.systemui.statusbar.notification.collection.provider.OnReorderingBannedListener;
import com.android.systemui.statusbar.notification.collection.provider.VisualStabilityProvider;
@@ -65,6 +66,11 @@ import com.android.systemui.util.kotlin.JavaAdapter;
import com.android.systemui.util.settings.GlobalSettings;
import com.android.systemui.util.time.SystemClock;

import kotlinx.coroutines.flow.Flow;
import kotlinx.coroutines.flow.MutableStateFlow;
import kotlinx.coroutines.flow.StateFlow;
import kotlinx.coroutines.flow.StateFlowKt;

import org.jetbrains.annotations.NotNull;

import java.io.PrintWriter;
@@ -78,11 +84,6 @@ import java.util.stream.Stream;

import javax.inject.Inject;

import kotlinx.coroutines.flow.Flow;
import kotlinx.coroutines.flow.MutableStateFlow;
import kotlinx.coroutines.flow.StateFlow;
import kotlinx.coroutines.flow.StateFlowKt;

/**
 * A manager which handles heads up notifications which is a special mode where
 * they simply peek from the top of the screen.
@@ -93,15 +94,15 @@ public class HeadsUpManagerImpl
    private static final String TAG = "BaseHeadsUpManager";
    private static final String SETTING_HEADS_UP_SNOOZE_LENGTH_MS = "heads_up_snooze_length_ms";
    private static final String REASON_REORDER_ALLOWED = "mOnReorderingAllowedListener";
    protected final ListenerSet<OnHeadsUpChangedListener> mListeners = new ListenerSet<>();
    private final ListenerSet<OnHeadsUpChangedListener> mListeners = new ListenerSet<>();

    protected final Context mContext;
    private final Context mContext;

    protected int mTouchAcceptanceDelay;
    protected int mSnoozeLengthMs;
    protected boolean mHasPinnedNotification;
    private final int mTouchAcceptanceDelay;
    private int mSnoozeLengthMs;
    private boolean mHasPinnedNotification;
    private PinnedStatus mPinnedNotificationStatus = PinnedStatus.NotPinned;
    protected int mUser;
    private int mUser;

    private final ArrayMap<String, Long> mSnoozedPackages;
    private final AccessibilityManagerWrapper mAccessibilityMgr;
@@ -113,13 +114,14 @@ public class HeadsUpManagerImpl
    private final List<OnHeadsUpPhoneListenerChange> mHeadsUpPhoneListeners = new ArrayList<>();
    private final VisualStabilityProvider mVisualStabilityProvider;

    protected final SystemClock mSystemClock;
    protected final ArrayMap<String, HeadsUpEntry> mHeadsUpEntryMap = new ArrayMap<>();
    protected final HeadsUpManagerLogger mLogger;
    protected int mMinimumDisplayTime;
    protected int mStickyForSomeTimeAutoDismissTime;
    protected int mAutoDismissTime;
    protected DelayableExecutor mExecutor;
    private final SystemClock mSystemClock;
    @VisibleForTesting
    final ArrayMap<String, HeadsUpEntry> mHeadsUpEntryMap = new ArrayMap<>();
    private final HeadsUpManagerLogger mLogger;
    private final int mMinimumDisplayTime;
    private final int mStickyForSomeTimeAutoDismissTime;
    private final int mAutoDismissTime;
    private final DelayableExecutor mExecutor;

    private final int mExtensionTime;

@@ -133,7 +135,7 @@ public class HeadsUpManagerImpl
    private final HashSet<String> mSwipedOutKeys = new HashSet<>();
    private final HashSet<NotificationEntry> mEntriesToRemoveAfterExpand = new HashSet<>();
    @VisibleForTesting
    public final ArraySet<NotificationEntry> mEntriesToRemoveWhenReorderingAllowed
    final ArraySet<NotificationEntry> mEntriesToRemoveWhenReorderingAllowed
            = new ArraySet<>();

    private boolean mReleaseOnExpandFinish;
@@ -383,9 +385,7 @@ public class HeadsUpManagerImpl
        HeadsUpEntry headsUpEntry = mHeadsUpEntryMap.get(key);
        mLogger.logUpdateNotificationRequest(key, requestedPinnedStatus, headsUpEntry != null);

        Runnable runnable = () -> {
            updateNotificationInternal(key, requestedPinnedStatus);
        };
        Runnable runnable = () -> updateNotificationInternal(key, requestedPinnedStatus);
        mAvalancheController.update(headsUpEntry, runnable, "updateNotification");
    }

@@ -407,11 +407,9 @@ public class HeadsUpManagerImpl
            headsUpEntry.updateEntry(true /* updatePostTime */, "updateNotification");
            PinnedStatus pinnedStatus =
                    getNewPinnedStatusForEntry(headsUpEntry, requestedPinnedStatus);
            if (headsUpEntry != null) {
            setEntryPinned(headsUpEntry, pinnedStatus, "updateNotificationInternal");
        }
    }
    }

    @Override
    public void setTrackingHeadsUp(boolean trackingHeadsUp) {
@@ -515,8 +513,7 @@ public class HeadsUpManagerImpl
    }

    /**
     * @param key
     * @return When a HUN entry should be removed in milliseconds from now
     * @return When a HUN entry with the given key should be removed in milliseconds from now
     */
    @Override
    public long getEarliestRemovalTime(String key) {
@@ -528,7 +525,10 @@ public class HeadsUpManagerImpl
    }

    @VisibleForTesting
    protected boolean shouldHeadsUpBecomePinned(@NonNull NotificationEntry entry) {
    boolean shouldHeadsUpBecomePinned(@Nullable NotificationEntry entry) {
        if (entry == null) {
            return false;
        }
        boolean pin = mStatusBarState == StatusBarState.SHADE && !mIsShadeOrQsExpanded;
        if (SceneContainerFlag.isEnabled()) {
            pin |= mIsQsExpanded;
@@ -549,24 +549,18 @@ public class HeadsUpManagerImpl
        return hasFullScreenIntent(entry) && !headsUpEntry.mWasUnpinned;
    }

    protected boolean hasFullScreenIntent(@NonNull NotificationEntry entry) {
        if (entry == null) {
            return false;
        }
        if (entry.getSbn() == null) {
            return false;
        }
    private boolean hasFullScreenIntent(@NonNull NotificationEntry entry) {
        if (entry.getSbn().getNotification() == null) {
            return false;
        }
        return entry.getSbn().getNotification().fullScreenIntent != null;
    }

    protected void setEntryPinned(
    private void setEntryPinned(
            @NonNull HeadsUpManagerImpl.HeadsUpEntry headsUpEntry, PinnedStatus pinnedStatus,
            String reason) {
        mLogger.logSetEntryPinned(headsUpEntry.mEntry, pinnedStatus, reason);
        NotificationEntry entry = headsUpEntry.mEntry;
        NotificationEntry entry = headsUpEntry.requireEntry();
        mLogger.logSetEntryPinned(entry, pinnedStatus, reason);
        boolean isPinned = pinnedStatus.isPinned();
        if (!isPinned) {
            headsUpEntry.mWasUnpinned = true;
@@ -574,7 +568,7 @@ public class HeadsUpManagerImpl
        if (headsUpEntry.getPinnedStatus().getValue() != pinnedStatus) {
            headsUpEntry.setRowPinnedStatus(pinnedStatus);
            updatePinnedMode();
            if (isPinned && entry.getSbn() != null) {
            if (isPinned) {
               mUiEventLogger.logWithInstanceId(
                        NotificationPeekEvent.NOTIFICATION_PEEK, entry.getSbn().getUid(),
                        entry.getSbn().getPackageName(), entry.getSbn().getInstanceId());
@@ -596,7 +590,7 @@ public class HeadsUpManagerImpl
     */
    @VisibleForTesting
     void onEntryAdded(HeadsUpEntry headsUpEntry, PinnedStatus requestedPinnedStatus) {
        NotificationEntry entry = headsUpEntry.mEntry;
        NotificationEntry entry = headsUpEntry.requireEntry();
        entry.setHeadsUp(true);

        PinnedStatus pinnedStatus = getNewPinnedStatusForEntry(headsUpEntry, requestedPinnedStatus);
@@ -635,7 +629,7 @@ public class HeadsUpManagerImpl
     * Remove a notification from the alerting entries.
     * @param key key of notification to remove
     */
    protected final void removeEntry(@NonNull String key, String reason) {
    private void removeEntry(@NonNull String key, String reason) {
        HeadsUpEntry headsUpEntry = mHeadsUpEntryMap.get(key);
        boolean isWaiting;
        if (headsUpEntry == null) {
@@ -652,10 +646,10 @@ public class HeadsUpManagerImpl
            if (finalHeadsUpEntry == null) {
                return;
            }
            NotificationEntry entry = finalHeadsUpEntry.mEntry;
            NotificationEntry entry = finalHeadsUpEntry.requireEntry();

            // If the notification is animating, we will remove it at the end of the animation.
            if (entry != null && entry.isExpandAnimationRunning()) {
            if (entry.isExpandAnimationRunning()) {
                return;
            }
            entry.demoteStickyHun();
@@ -677,8 +671,9 @@ public class HeadsUpManagerImpl
     * @param headsUpEntry entry removed
     * @param reason why onEntryRemoved was called
     */
    protected void onEntryRemoved(HeadsUpEntry headsUpEntry, String reason) {
        NotificationEntry entry = headsUpEntry.mEntry;
    @VisibleForTesting
    void onEntryRemoved(@NonNull HeadsUpEntry headsUpEntry, String reason) {
        NotificationEntry entry = headsUpEntry.requireEntry();
        entry.setHeadsUp(false);
        setEntryPinned(headsUpEntry, PinnedStatus.NotPinned, "onEntryRemoved");
        EventLogTags.writeSysuiHeadsUpStatus(entry.getKey(), 0 /* visible */);
@@ -700,15 +695,14 @@ public class HeadsUpManagerImpl
            // mEntriesToRemoveWhenReorderingAllowed, we should not remove from this list (and cause
            // ArrayIndexOutOfBoundsException). We don't need to in this case anyway, because we
            // clear mEntriesToRemoveWhenReorderingAllowed after removing these entries.
            if (!reason.equals(REASON_REORDER_ALLOWED)
                    && mEntriesToRemoveWhenReorderingAllowed.contains(notifEntry)) {
            if (!reason.equals(REASON_REORDER_ALLOWED)) {
                mEntriesToRemoveWhenReorderingAllowed.remove(notifEntry);
            }
        }
    }

    private void updateTopHeadsUpFlow() {
        mTopHeadsUpRow.setValue((HeadsUpRowRepository) getTopHeadsUpEntry());
        mTopHeadsUpRow.setValue(getTopHeadsUpEntry());
    }

    private void updateHeadsUpFlow() {
@@ -753,18 +747,7 @@ public class HeadsUpManagerImpl
        }
    }

    /**
     * Manager-specific logic, that should occur, when the entry is updated, and its posted time has
     * changed.
     *
     * @param headsUpEntry entry updated
     */
    protected void onEntryUpdated(HeadsUpEntry headsUpEntry) {
        // no need to update the list here
        updateTopHeadsUpFlow();
    }

    protected void updatePinnedMode() {
    private void updatePinnedMode() {
        boolean hasPinnedNotification = hasPinnedNotificationInternal();
        mPinnedNotificationStatus = pinnedNotificationStatusInternal();
        if (hasPinnedNotification == mHasPinnedNotification) {
@@ -806,7 +789,7 @@ public class HeadsUpManagerImpl
        keySet.addAll(mAvalancheController.getWaitingKeys());
        for (String key : keySet) {
            HeadsUpEntry entry = getHeadsUpEntry(key);
            if (entry.mEntry == null) {
            if (entry == null || entry.mEntry == null) {
                continue;
            }
            String packageName = entry.mEntry.getSbn().getPackageName();
@@ -828,7 +811,8 @@ public class HeadsUpManagerImpl
    }

    @Nullable
    protected HeadsUpEntry getHeadsUpEntry(@NonNull String key) {
    @VisibleForTesting
    HeadsUpEntry getHeadsUpEntry(@NonNull String key) {
        if (mHeadsUpEntryMap.containsKey(key)) {
            return mHeadsUpEntryMap.get(key);
        }
@@ -845,7 +829,7 @@ public class HeadsUpManagerImpl
    }

    @Nullable
    protected HeadsUpEntry getTopHeadsUpEntry() {
    private HeadsUpEntry getTopHeadsUpEntry() {
        if (mHeadsUpEntryMap.isEmpty()) {
            return null;
        }
@@ -941,7 +925,7 @@ public class HeadsUpManagerImpl
        dumpInternal(pw, args);
    }

    protected void dumpInternal(@NonNull PrintWriter pw, @NonNull String[] args) {
    private void dumpInternal(@NonNull PrintWriter pw, @NonNull String[] args) {
        pw.print("  mTouchAcceptanceDelay="); pw.println(mTouchAcceptanceDelay);
        pw.print("  mSnoozeLengthMs="); pw.println(mSnoozeLengthMs);
        pw.print("  now="); pw.println(mSystemClock.elapsedRealtime());
@@ -978,7 +962,7 @@ public class HeadsUpManagerImpl
    private boolean hasPinnedNotificationInternal() {
        for (String key : mHeadsUpEntryMap.keySet()) {
            HeadsUpEntry entry = getHeadsUpEntry(key);
            if (entry.mEntry != null && entry.mEntry.isRowPinned()) {
            if (entry != null && entry.mEntry != null && entry.mEntry.isRowPinned()) {
                return true;
            }
        }
@@ -1003,6 +987,10 @@ public class HeadsUpManagerImpl
    public void unpinAll(boolean userUnPinned) {
        for (String key : mHeadsUpEntryMap.keySet()) {
            HeadsUpEntry headsUpEntry = getHeadsUpEntry(key);
            if (headsUpEntry == null) {
                Log.wtf(TAG, "Couldn't find entry " + key + " in unpinAll");
                continue;
            }
            mLogger.logUnpinEntryRequest(key);
            Runnable runnable = () -> {
                mLogger.logUnpinEntry(key);
@@ -1013,11 +1001,11 @@ public class HeadsUpManagerImpl

                // when the user unpinned all of HUNs by moving one HUN, all of HUNs should not stay
                // on the screen.
                if (userUnPinned && headsUpEntry.mEntry != null) {
                    if (headsUpEntry.mEntry != null && headsUpEntry.mEntry.mustStayOnScreen()) {
                if (userUnPinned
                        && headsUpEntry.mEntry != null
                        && headsUpEntry.mEntry.mustStayOnScreen()) {
                    headsUpEntry.mEntry.setHeadsUpIsVisible();
                }
                }
            };
            mAvalancheController.delete(headsUpEntry, runnable, "unpinAll");
        }
@@ -1037,7 +1025,7 @@ public class HeadsUpManagerImpl
            } else {
                headsUpEntry.updateEntry(false /* updatePostTime */, "setRemoteInputActive(false)");
            }
            onEntryUpdated(headsUpEntry);
            updateTopHeadsUpFlow();
        }
    }

@@ -1113,7 +1101,7 @@ public class HeadsUpManagerImpl
     *
     * @param entry the entry that might be indirectly removed by the user's action
     *
     * @see HeadsUpCoordinator#mActionPressListener
     * @see HeadsUpCoordinator.mActionPressListener
     * @see #canRemoveImmediately(String)
     */
    public void setUserActionMayIndirectlyRemove(@NonNull NotificationEntry entry) {
@@ -1152,8 +1140,8 @@ public class HeadsUpManagerImpl
    }

    /**
     * @param key
     * @return true if the entry is (pinned and expanded) or (has an active remote input)
     * @return true if the entry with the given key is (pinned and expanded) or (has an active
     * remote input)
     */
    @Override
    public boolean isSticky(String key) {
@@ -1165,7 +1153,8 @@ public class HeadsUpManagerImpl
    }

    @NonNull
    protected HeadsUpEntry createHeadsUpEntry(NotificationEntry entry) {
    @VisibleForTesting
    HeadsUpEntry createHeadsUpEntry(NotificationEntry entry) {
        if (NotificationThrottleHun.isEnabled()) {
            return new HeadsUpEntry(entry);
        } else {
@@ -1189,7 +1178,7 @@ public class HeadsUpManagerImpl
    }

    @VisibleForTesting
    public final OnReorderingAllowedListener mOnReorderingAllowedListener = () -> {
    final OnReorderingAllowedListener mOnReorderingAllowedListener = () -> {
        if (NotificationThrottleHun.isEnabled()) {
            mAvalancheController.setEnableAtRuntime(true);
            if (mEntriesToRemoveWhenReorderingAllowed.isEmpty()) {
@@ -1266,14 +1255,15 @@ public class HeadsUpManagerImpl
        public boolean mRemoteInputActive;
        public boolean mUserActionMayIndirectlyRemove;

        protected boolean mExpanded;
        protected boolean mWasUnpinned;
        private boolean mExpanded;
        @VisibleForTesting
        boolean mWasUnpinned;

        @Nullable public NotificationEntry mEntry;
        public long mPostTime;
        public long mEarliestRemovalTime;

        @Nullable protected Runnable mRemoveRunnable;
        @Nullable private Runnable mRemoveRunnable;

        @Nullable private Runnable mCancelRemoveRunnable;

@@ -1325,7 +1315,7 @@ public class HeadsUpManagerImpl
            setEntry(entry, createRemoveRunnable(entry));
        }

        protected void setEntry(
        private void setEntry(
                @NonNull final NotificationEntry entry,
                @Nullable Runnable removeRunnable) {
            mEntry = entry;
@@ -1342,7 +1332,8 @@ public class HeadsUpManagerImpl
            }
        }

        protected void setRowPinnedStatus(PinnedStatus pinnedStatus) {
        @VisibleForTesting
        void setRowPinnedStatus(PinnedStatus pinnedStatus) {
            if (mEntry != null) mEntry.setRowPinnedStatus(pinnedStatus);
            mPinnedStatus.setValue(pinnedStatus);
        }
@@ -1350,7 +1341,7 @@ public class HeadsUpManagerImpl
        /**
         * An interface that returns the amount of time left this HUN should show.
         */
        interface FinishTimeUpdater {
        private interface FinishTimeUpdater {
            long updateAndGetTimeRemaining();
        }

@@ -1370,6 +1361,10 @@ public class HeadsUpManagerImpl
        public void updateEntry(boolean updatePostTime, boolean updateEarliestRemovalTime,
                @Nullable String reason) {
            Runnable runnable = () -> {
                if (mEntry == null) {
                    Log.wtf(TAG, "#updateEntry called with null mEntry; returning early");
                    return;
                }
                mLogger.logUpdateEntry(mEntry, updatePostTime, reason);

                final long now = mSystemClock.elapsedRealtime();
@@ -1391,25 +1386,20 @@ public class HeadsUpManagerImpl
            FinishTimeUpdater finishTimeCalculator = () -> {
                final long finishTime = calculateFinishTime();
                final long now = mSystemClock.elapsedRealtime();
                final long timeLeft = NotificationThrottleHun.isEnabled()
                return NotificationThrottleHun.isEnabled()
                        ? Math.max(finishTime, mEarliestRemovalTime) - now
                        : Math.max(finishTime - now, mMinimumDisplayTime);
                return timeLeft;
            };
            scheduleAutoRemovalCallback(finishTimeCalculator, "updateEntry (not sticky)");

            // Notify the manager, that the posted time has changed.
            onEntryUpdated(this);
            updateTopHeadsUpFlow();

            if (mEntriesToRemoveAfterExpand.contains(mEntry)) {
            mEntriesToRemoveAfterExpand.remove(mEntry);
            }
            if (!NotificationThrottleHun.isEnabled()) {
                if (mEntriesToRemoveWhenReorderingAllowed.contains(mEntry)) {
                mEntriesToRemoveWhenReorderingAllowed.remove(mEntry);
            }
        }
        }

        private void extendPulse() {
            if (!extended) {
@@ -1528,8 +1518,7 @@ public class HeadsUpManagerImpl
        @Override
        public boolean equals(@Nullable Object o) {
            if (this == o) return true;
            if (o == null || !(o instanceof HeadsUpEntry)) return false;
            HeadsUpEntry otherHeadsUpEntry = (HeadsUpEntry) o;
            if (!(o instanceof HeadsUpEntry otherHeadsUpEntry)) return false;
            if (mEntry != null && otherHeadsUpEntry.mEntry != null) {
                return mEntry.getKey().equals(otherHeadsUpEntry.mEntry.getKey());
            }
@@ -1593,10 +1582,13 @@ public class HeadsUpManagerImpl
            }
        }

        public void scheduleAutoRemovalCallback(FinishTimeUpdater finishTimeCalculator,
        private void scheduleAutoRemovalCallback(FinishTimeUpdater finishTimeCalculator,
                @NonNull String reason) {

            mLogger.logAutoRemoveRequest(this.mEntry, reason);
            if (mEntry == null) {
                Log.wtf(TAG, "#scheduleAutoRemovalCallback with null mEntry; returning early");
                return;
            }
            mLogger.logAutoRemoveRequest(mEntry, reason);
            Runnable runnable = () -> {
                long delayMs = finishTimeCalculator.updateAndGetTimeRemaining();

@@ -1636,16 +1628,14 @@ public class HeadsUpManagerImpl
        public void removeAsSoonAsPossible() {
            if (mRemoveRunnable != null) {

                FinishTimeUpdater finishTimeCalculator = () -> {
                    final long timeLeft = mEarliestRemovalTime - mSystemClock.elapsedRealtime();
                    return timeLeft;
                };
                FinishTimeUpdater finishTimeCalculator = () ->
                        mEarliestRemovalTime - mSystemClock.elapsedRealtime();
                scheduleAutoRemovalCallback(finishTimeCalculator, "removeAsSoonAsPossible");
            }
        }

        /** Creates a runnable to remove this notification from the alerting entries. */
        protected Runnable createRemoveRunnable(NotificationEntry entry) {
        private Runnable createRemoveRunnable(NotificationEntry entry) {
            return () -> {
                if (!NotificationThrottleHun.isEnabled()
                        && !mVisualStabilityProvider.isReorderingAllowed()
@@ -1669,7 +1659,7 @@ public class HeadsUpManagerImpl
         * Calculate what the post time of a notification is at some current time.
         * @return the post time
         */
        protected long calculatePostTime() {
        private long calculatePostTime() {
            // The actual post time will be just after the heads-up really slided in
            return mSystemClock.elapsedRealtime() + mTouchAcceptanceDelay;
        }
@@ -1678,7 +1668,7 @@ public class HeadsUpManagerImpl
         * @return When the notification should auto-dismiss itself, based on
         * {@link SystemClock#elapsedRealtime()}
         */
        protected long calculateFinishTime() {
        private long calculateFinishTime() {
            int requestedTimeOutMs;
            if (isStickyForSomeTime()) {
                requestedTimeOutMs = mStickyForSomeTimeAutoDismissTime;
@@ -1692,9 +1682,8 @@ public class HeadsUpManagerImpl
        /**
         * Get user-preferred or default timeout duration. The larger one will be returned.
         * @return milliseconds before auto-dismiss
         * @param requestedTimeout
         */
        protected int getRecommendedHeadsUpTimeoutMs(int requestedTimeout) {
        private int getRecommendedHeadsUpTimeoutMs(int requestedTimeout) {
            return mAccessibilityMgr.getRecommendedTimeoutMillis(
                    requestedTimeout,
                    AccessibilityManager.FLAG_CONTENT_CONTROLS
+2 −2
Original line number Diff line number Diff line
@@ -156,12 +156,12 @@ constructor(@NotificationHeadsUpLog private val buffer: LogBuffer) {
        )
    }

    fun logAutoRemoveCanceled(entry: NotificationEntry, reason: String?) {
    fun logAutoRemoveCanceled(entry: NotificationEntry?, reason: String?) {
        buffer.log(
            TAG,
            INFO,
            {
                str1 = entry.logKey
                str1 = entry?.logKey
                str2 = reason ?: "unknown"
            },
            { "cancel auto remove of $str1 reason: $str2" },