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

Commit cd8cdf3c authored by Sudheer Shanka's avatar Sudheer Shanka
Browse files

Make timestamps of notification related events a bit more accurate.

Instead of using the timestamps at which the events are about to be
reported, generate the timestamps closer to when the events are
triggered.

Bug: 206518114
Test: atest services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
Test: atest services/tests/uiservicestests/src/com/android/server/notification/NotificationPermissionMigrationTest.java
Test: atest ./tests/tests/app.usage/src/android/app/usage/cts/UsageStatsTest.java

Change-Id: I8efbca5a166d3e96defd8091b55c619750583b51
parent b47bc5c3
Loading
Loading
Loading
Loading
+65 −36
Original line number Diff line number Diff line
@@ -124,6 +124,7 @@ import static com.android.server.utils.PriorityDump.PRIORITY_ARG_NORMAL;
import android.Manifest;
import android.Manifest.permission;
import android.annotation.ElapsedRealtimeLong;
import android.annotation.MainThread;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -851,7 +852,8 @@ public class NotificationManagerService extends SystemService {
        }
        if (summary.getSbn().getNotification().flags != oldFlags) {
            mHandler.post(new EnqueueNotificationRunnable(userId, summary, isAppForeground));
            mHandler.post(new EnqueueNotificationRunnable(userId, summary, isAppForeground,
                    SystemClock.elapsedRealtime()));
        }
    }
@@ -1373,7 +1375,7 @@ public class NotificationManagerService extends SystemService {
                        // Force isAppForeground true here, because for sysui's purposes we
                        // want to adjust the flag behaviour.
                        mHandler.post(new EnqueueNotificationRunnable(r.getUser().getIdentifier(),
                                r, true /* isAppForeground*/));
                                r, true /* isAppForeground*/, SystemClock.elapsedRealtime()));
                    }
                }
            }
@@ -1404,7 +1406,7 @@ public class NotificationManagerService extends SystemService {
                        r.getNotification().flags |= FLAG_ONLY_ALERT_ONCE;
                        mHandler.post(
                                new EnqueueNotificationRunnable(r.getUser().getIdentifier(), r,
                                        true /* isAppForeground */));
                                        true /* isAppForeground */, SystemClock.elapsedRealtime()));
                    }
                }
            }
@@ -2556,7 +2558,8 @@ public class NotificationManagerService extends SystemService {
                if (r != null) {
                    final boolean isAppForeground =
                            mActivityManager.getPackageImportance(pkg) == IMPORTANCE_FOREGROUND;
                    mHandler.post(new EnqueueNotificationRunnable(userId, r, isAppForeground));
                    mHandler.post(new EnqueueNotificationRunnable(userId, r, isAppForeground,
                            SystemClock.elapsedRealtime()));
                }
            }
@@ -5752,7 +5755,8 @@ public class NotificationManagerService extends SystemService {
            final NotificationRecord removed = findNotificationByKeyLocked(summaries.remove(pkg));
            if (removed != null) {
                boolean wasPosted = removeFromNotificationListsLocked(removed);
                cancelNotificationLocked(removed, false, REASON_UNAUTOBUNDLED, wasPosted, null);
                cancelNotificationLocked(removed, false, REASON_UNAUTOBUNDLED, wasPosted, null,
                        SystemClock.elapsedRealtime());
            }
        }
    }
@@ -6483,7 +6487,8 @@ public class NotificationManagerService extends SystemService {
        } finally {
            Binder.restoreCallingIdentity(token);
        }
        mHandler.post(new EnqueueNotificationRunnable(userId, r, isAppForeground));
        mHandler.post(new EnqueueNotificationRunnable(userId, r, isAppForeground,
                SystemClock.elapsedRealtime()));
    }
    private void onConversationRemovedInternal(String pkg, int uid, Set<String> shortcuts) {
@@ -6627,7 +6632,8 @@ public class NotificationManagerService extends SystemService {
                            r.getNotification().flags |= FLAG_ONLY_ALERT_ONCE;
                            mHandler.post(
                                    new NotificationManagerService.EnqueueNotificationRunnable(
                                            r.getUser().getIdentifier(), r, isAppForeground));
                                            r.getUser().getIdentifier(), r, isAppForeground,
                                            SystemClock.elapsedRealtime()));
                        }
                    }
                }
@@ -6931,7 +6937,8 @@ public class NotificationManagerService extends SystemService {
                    NotificationRecordLogger.NotificationEvent.NOTIFICATION_SNOOZED, r);
            reportUserInteraction(r);
            boolean wasPosted = removeFromNotificationListsLocked(r);
            cancelNotificationLocked(r, false, REASON_SNOOZED, wasPosted, null);
            cancelNotificationLocked(r, false, REASON_SNOOZED, wasPosted, null,
                    SystemClock.elapsedRealtime());
            updateLightsLocked();
            if (mSnoozeCriterionId != null) {
                mAssistants.notifyAssistantSnoozedLocked(r, mSnoozeCriterionId);
@@ -6958,12 +6965,14 @@ public class NotificationManagerService extends SystemService {
        private final int mRank;
        private final int mCount;
        private final ManagedServiceInfo mListener;
        private final long mCancellationElapsedTimeMs;
        CancelNotificationRunnable(final int callingUid, final int callingPid,
                final String pkg, final String tag, final int id,
                final int mustHaveFlags, final int mustNotHaveFlags, final boolean sendDelete,
                final int userId, final int reason, int rank, int count,
                final ManagedServiceInfo listener) {
                final ManagedServiceInfo listener,
                @ElapsedRealtimeLong long cancellationElapsedTimeMs) {
            this.mCallingUid = callingUid;
            this.mCallingPid = callingPid;
            this.mPkg = pkg;
@@ -6977,6 +6986,7 @@ public class NotificationManagerService extends SystemService {
            this.mRank = rank;
            this.mCount = count;
            this.mListener = listener;
            this.mCancellationElapsedTimeMs = cancellationElapsedTimeMs;
        }
        @Override
@@ -7039,9 +7049,11 @@ public class NotificationManagerService extends SystemService {
                    // Cancel the notification.
                    boolean wasPosted = removeFromNotificationListsLocked(r);
                    cancelNotificationLocked(
                            r, mSendDelete, mReason, mRank, mCount, wasPosted, listenerName);
                            r, mSendDelete, mReason, mRank, mCount, wasPosted, listenerName,
                            mCancellationElapsedTimeMs);
                    cancelGroupChildrenLocked(r, mCallingUid, mCallingPid, listenerName,
                            mSendDelete, childrenFlagChecker, mReason);
                            mSendDelete, childrenFlagChecker, mReason,
                            mCancellationElapsedTimeMs);
                    updateLightsLocked();
                    if (mShortcutHelper != null) {
                        mShortcutHelper.maybeListenForShortcutChangesForBubbles(r,
@@ -7103,11 +7115,14 @@ public class NotificationManagerService extends SystemService {
        private final NotificationRecord r;
        private final int userId;
        private final boolean isAppForeground;
        private final long enqueueElapsedTimeMs;
        EnqueueNotificationRunnable(int userId, NotificationRecord r, boolean foreground) {
        EnqueueNotificationRunnable(int userId, NotificationRecord r, boolean foreground,
                @ElapsedRealtimeLong long enqueueElapsedTimeMs) {
            this.userId = userId;
            this.r = r;
            this.isAppForeground = foreground;
            this.enqueueElapsedTimeMs = enqueueElapsedTimeMs;
        }
        @Override
@@ -7180,10 +7195,11 @@ public class NotificationManagerService extends SystemService {
                // tell the assistant service about the notification
                if (mAssistants.isEnabled()) {
                    mAssistants.onNotificationEnqueuedLocked(r);
                    mHandler.postDelayed(new PostNotificationRunnable(r.getKey()),
                    mHandler.postDelayed(
                            new PostNotificationRunnable(r.getKey(), enqueueElapsedTimeMs),
                            DELAY_FOR_ASSISTANT_TIME);
                } else {
                    mHandler.post(new PostNotificationRunnable(r.getKey()));
                    mHandler.post(new PostNotificationRunnable(r.getKey(), enqueueElapsedTimeMs));
                }
            }
        }
@@ -7206,9 +7222,11 @@ public class NotificationManagerService extends SystemService {
    protected class PostNotificationRunnable implements Runnable {
        private final String key;
        private final long postElapsedTimeMs;
        PostNotificationRunnable(String key) {
        PostNotificationRunnable(String key, @ElapsedRealtimeLong long postElapsedTimeMs) {
            this.key = key;
            this.postElapsedTimeMs = postElapsedTimeMs;
        }
        @Override
@@ -7264,7 +7282,7 @@ public class NotificationManagerService extends SystemService {
                        mNotificationList.add(r);
                        mUsageStats.registerPostedByApp(r);
                        mUsageStatsManagerInternal.reportNotificationPosted(r.getSbn().getOpPkg(),
                                r.getSbn().getUser(), SystemClock.elapsedRealtime());
                                r.getSbn().getUser(), postElapsedTimeMs);
                        final boolean isInterruptive = isVisuallyInterruptive(null, r);
                        r.setInterruptive(isInterruptive);
                        r.setTextChanged(isInterruptive);
@@ -7273,7 +7291,7 @@ public class NotificationManagerService extends SystemService {
                        mNotificationList.set(index, r);
                        mUsageStats.registerUpdatedByApp(r, old);
                        mUsageStatsManagerInternal.reportNotificationUpdated(r.getSbn().getOpPkg(),
                                r.getSbn().getUser(), SystemClock.elapsedRealtime());
                                r.getSbn().getUser(), postElapsedTimeMs);
                        // Make sure we don't lose the foreground service state.
                        notification.flags |=
                                old.getNotification().flags & FLAG_FOREGROUND_SERVICE;
@@ -7578,7 +7596,7 @@ public class NotificationManagerService extends SystemService {
        // notification was a summary and its group key changed.
        if (oldIsSummary && (!isSummary || !oldGroup.equals(group))) {
            cancelGroupChildrenLocked(old, callingUid, callingPid, null, false /* sendDelete */,
                    childrenFlagChecker, REASON_APP_CANCEL);
                    childrenFlagChecker, REASON_APP_CANCEL, SystemClock.elapsedRealtime());
        }
    }
@@ -8664,14 +8682,17 @@ public class NotificationManagerService extends SystemService {
    @GuardedBy("mNotificationLock")
    private void cancelNotificationLocked(NotificationRecord r, boolean sendDelete,
            @NotificationListenerService.NotificationCancelReason int reason,
            boolean wasPosted, String listenerName) {
        cancelNotificationLocked(r, sendDelete, reason, -1, -1, wasPosted, listenerName);
            boolean wasPosted, String listenerName,
            @ElapsedRealtimeLong long cancellationElapsedTimeMs) {
        cancelNotificationLocked(r, sendDelete, reason, -1, -1, wasPosted, listenerName,
                cancellationElapsedTimeMs);
    }
    @GuardedBy("mNotificationLock")
    private void cancelNotificationLocked(NotificationRecord r, boolean sendDelete,
            @NotificationListenerService.NotificationCancelReason int reason,
            int rank, int count, boolean wasPosted, String listenerName) {
            int rank, int count, boolean wasPosted, String listenerName,
            @ElapsedRealtimeLong long cancellationElapsedTimeMs) {
        final String canceledKey = r.getKey();
        // Get pending intent used to create alarm, use FLAG_NO_CREATE if PendingIntent
@@ -8757,7 +8778,7 @@ public class NotificationManagerService extends SystemService {
            case REASON_APP_CANCEL_ALL:
                mUsageStats.registerRemovedByApp(r);
                mUsageStatsManagerInternal.reportNotificationRemoved(r.getSbn().getOpPkg(),
                        r.getUser(), SystemClock.elapsedRealtime());
                        r.getUser(), cancellationElapsedTimeMs);
                break;
        }
@@ -8934,7 +8955,7 @@ public class NotificationManagerService extends SystemService {
     * and none of the {@code mustNotHaveFlags}.
     */
    void cancelNotification(final int callingUid, final int callingPid,
            final String pkg, final String tag, final int id,
            final String pkg, final String tag, int id,
            final int mustHaveFlags, final int mustNotHaveFlags, final boolean sendDelete,
            final int userId, final int reason, final ManagedServiceInfo listener) {
        cancelNotification(callingUid, callingPid, pkg, tag, id, mustHaveFlags, mustNotHaveFlags,
@@ -8956,7 +8977,7 @@ public class NotificationManagerService extends SystemService {
        // remove notification call ends up in not removing the notification.
        mHandler.scheduleCancelNotification(new CancelNotificationRunnable(callingUid, callingPid,
                pkg, tag, id, mustHaveFlags, mustNotHaveFlags, sendDelete, userId, reason, rank,
                count, listener));
                count, listener, SystemClock.elapsedRealtime()));
    }
    /**
@@ -8990,6 +9011,7 @@ public class NotificationManagerService extends SystemService {
    void cancelAllNotificationsInt(int callingUid, int callingPid, String pkg, String channelId,
            int mustHaveFlags, int mustNotHaveFlags, boolean doit, int userId, int reason,
            ManagedServiceInfo listener) {
        final long cancellationElapsedTimeMs = SystemClock.elapsedRealtime();
        mHandler.post(new Runnable() {
            @Override
            public void run() {
@@ -9017,11 +9039,12 @@ public class NotificationManagerService extends SystemService {
                    cancelAllNotificationsByListLocked(mNotificationList, callingUid, callingPid,
                            pkg, true /*nullPkgIndicatesUserSwitch*/, channelId, flagChecker,
                            false /*includeCurrentProfiles*/, userId, false /*sendDelete*/, reason,
                            listenerName, true /* wasPosted */);
                            listenerName, true /* wasPosted */, cancellationElapsedTimeMs);
                    cancelAllNotificationsByListLocked(mEnqueuedNotifications, callingUid,
                            callingPid, pkg, true /*nullPkgIndicatesUserSwitch*/, channelId,
                            flagChecker, false /*includeCurrentProfiles*/, userId,
                            false /*sendDelete*/, reason, listenerName, false /* wasPosted */);
                            false /*sendDelete*/, reason, listenerName, false /* wasPosted */,
                            cancellationElapsedTimeMs);
                    mSnoozeHelper.cancel(userId, pkg);
                }
            }
@@ -9037,7 +9060,8 @@ public class NotificationManagerService extends SystemService {
    private void cancelAllNotificationsByListLocked(ArrayList<NotificationRecord> notificationList,
            int callingUid, int callingPid, String pkg, boolean nullPkgIndicatesUserSwitch,
            String channelId, FlagChecker flagChecker, boolean includeCurrentProfiles, int userId,
            boolean sendDelete, int reason, String listenerName, boolean wasPosted) {
            boolean sendDelete, int reason, String listenerName, boolean wasPosted,
            @ElapsedRealtimeLong long cancellationElapsedTimeMs) {
        Set<String> childNotifications = null;
        for (int i = notificationList.size() - 1; i >= 0; --i) {
            NotificationRecord r = notificationList.get(i);
@@ -9071,7 +9095,8 @@ public class NotificationManagerService extends SystemService {
            notificationList.remove(i);
            mNotificationsByKey.remove(r.getKey());
            r.recordDismissalSentiment(NotificationStats.DISMISS_SENTIMENT_NEUTRAL);
            cancelNotificationLocked(r, sendDelete, reason, wasPosted, listenerName);
            cancelNotificationLocked(r, sendDelete, reason, wasPosted, listenerName,
                    cancellationElapsedTimeMs);
        }
        if (childNotifications != null) {
            final int M = notificationList.size();
@@ -9083,7 +9108,8 @@ public class NotificationManagerService extends SystemService {
                    notificationList.remove(i);
                    mNotificationsByKey.remove(r.getKey());
                    r.recordDismissalSentiment(NotificationStats.DISMISS_SENTIMENT_NEUTRAL);
                    cancelNotificationLocked(r, sendDelete, reason, wasPosted, listenerName);
                    cancelNotificationLocked(r, sendDelete, reason, wasPosted, listenerName,
                            cancellationElapsedTimeMs);
                }
            }
            updateLightsLocked();
@@ -9129,6 +9155,7 @@ public class NotificationManagerService extends SystemService {
    @GuardedBy("mNotificationLock")
    void cancelAllLocked(int callingUid, int callingPid, int userId, int reason,
            ManagedServiceInfo listener, boolean includeCurrentProfiles) {
        final long cancellationElapsedTimeMs = SystemClock.elapsedRealtime();
        mHandler.post(new Runnable() {
            @Override
            public void run() {
@@ -9153,11 +9180,11 @@ public class NotificationManagerService extends SystemService {
                    cancelAllNotificationsByListLocked(mNotificationList, callingUid, callingPid,
                            null, false /*nullPkgIndicatesUserSwitch*/, null, flagChecker,
                            includeCurrentProfiles, userId, true /*sendDelete*/, reason,
                            listenerName, true);
                            listenerName, true, cancellationElapsedTimeMs);
                    cancelAllNotificationsByListLocked(mEnqueuedNotifications, callingUid,
                            callingPid, null, false /*nullPkgIndicatesUserSwitch*/, null,
                            flagChecker, includeCurrentProfiles, userId, true /*sendDelete*/,
                            reason, listenerName, false);
                            reason, listenerName, false, cancellationElapsedTimeMs);
                    mSnoozeHelper.cancel(userId, includeCurrentProfiles);
                }
            }
@@ -9167,7 +9194,8 @@ public class NotificationManagerService extends SystemService {
    // Warning: The caller is responsible for invoking updateLightsLocked().
    @GuardedBy("mNotificationLock")
    private void cancelGroupChildrenLocked(NotificationRecord r, int callingUid, int callingPid,
            String listenerName, boolean sendDelete, FlagChecker flagChecker, int reason) {
            String listenerName, boolean sendDelete, FlagChecker flagChecker, int reason,
            @ElapsedRealtimeLong long cancellationElapsedTimeMs) {
        Notification n = r.getNotification();
        if (!n.isGroupSummary()) {
            return;
@@ -9181,16 +9209,16 @@ public class NotificationManagerService extends SystemService {
        }
        cancelGroupChildrenByListLocked(mNotificationList, r, callingUid, callingPid, listenerName,
                sendDelete, true, flagChecker, reason);
                sendDelete, true, flagChecker, reason, cancellationElapsedTimeMs);
        cancelGroupChildrenByListLocked(mEnqueuedNotifications, r, callingUid, callingPid,
                listenerName, sendDelete, false, flagChecker, reason);
                listenerName, sendDelete, false, flagChecker, reason, cancellationElapsedTimeMs);
    }
    @GuardedBy("mNotificationLock")
    private void cancelGroupChildrenByListLocked(ArrayList<NotificationRecord> notificationList,
            NotificationRecord parentNotification, int callingUid, int callingPid,
            String listenerName, boolean sendDelete, boolean wasPosted, FlagChecker flagChecker,
            int reason) {
            int reason, @ElapsedRealtimeLong long cancellationElapsedTimeMs) {
        final String pkg = parentNotification.getSbn().getPackageName();
        final int userId = parentNotification.getUserId();
        final int childReason = REASON_GROUP_SUMMARY_CANCELED;
@@ -9206,7 +9234,8 @@ public class NotificationManagerService extends SystemService {
                        childSbn.getTag(), userId, 0, 0, childReason, listenerName);
                notificationList.remove(i);
                mNotificationsByKey.remove(childR.getKey());
                cancelNotificationLocked(childR, sendDelete, childReason, wasPosted, listenerName);
                cancelNotificationLocked(childR, sendDelete, childReason, wasPosted, listenerName,
                        cancellationElapsedTimeMs);
            }
        }
    }
+13 −10
Original line number Diff line number Diff line
@@ -1335,7 +1335,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
        mBinderService.applyEnqueuedAdjustmentFromAssistant(null, adjustment);

        NotificationManagerService.PostNotificationRunnable runnable =
                mService.new PostNotificationRunnable(r.getKey());
                mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime());
        runnable.run();
        waitForIdle();

@@ -1356,7 +1356,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
        when(mPreferencesHelper.getImportance(anyString(), anyInt())).thenReturn(IMPORTANCE_NONE);

        NotificationManagerService.PostNotificationRunnable runnable =
                mService.new PostNotificationRunnable(r.getKey());
                mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime());
        runnable.run();
        waitForIdle();

@@ -3918,7 +3918,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
        NotificationRecord r = generateNotificationRecord(mTestNotificationChannel, 0, null, false);
        mService.addEnqueuedNotification(r);
        NotificationManagerService.PostNotificationRunnable runnable =
                mService.new PostNotificationRunnable(r.getKey());
                mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime());
        runnable.run();
        waitForIdle();

@@ -3935,7 +3935,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
        r = generateNotificationRecord(mTestNotificationChannel, 0, null, false);
        mService.addEnqueuedNotification(r);
        NotificationManagerService.PostNotificationRunnable runnable =
                mService.new PostNotificationRunnable(r.getKey());
                mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime());
        runnable.run();
        waitForIdle();

@@ -3951,7 +3951,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
        mService.addEnqueuedNotification(r);

        NotificationManagerService.PostNotificationRunnable runnable =
                mService.new PostNotificationRunnable(r.getKey());
                mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime());
        runnable.run();
        waitForIdle();

@@ -3964,12 +3964,12 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
        r.setCriticality(CriticalNotificationExtractor.CRITICAL_LOW);
        mService.addEnqueuedNotification(r);
        NotificationManagerService.PostNotificationRunnable runnable =
                mService.new PostNotificationRunnable(r.getKey());
                mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime());
        runnable.run();

        r = generateNotificationRecord(mTestNotificationChannel, 1, null, false);
        r.setCriticality(CriticalNotificationExtractor.CRITICAL);
        runnable = mService.new PostNotificationRunnable(r.getKey());
        runnable = mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime());
        mService.addEnqueuedNotification(r);

        runnable.run();
@@ -4412,7 +4412,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
        mService.addEnqueuedNotification(original);

        NotificationManagerService.PostNotificationRunnable runnable =
                mService.new PostNotificationRunnable(original.getKey());
                mService.new PostNotificationRunnable(original.getKey(),
                        SystemClock.elapsedRealtime());
        runnable.run();
        waitForIdle();

@@ -4433,7 +4434,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
        mService.addEnqueuedNotification(update);

        NotificationManagerService.PostNotificationRunnable runnable =
                mService.new PostNotificationRunnable(update.getKey());
                mService.new PostNotificationRunnable(update.getKey(),
                        SystemClock.elapsedRealtime());
        runnable.run();
        waitForIdle();

@@ -6475,7 +6477,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
        assertNull(update.getSbn().getNotification().getSmallIcon());

        NotificationManagerService.PostNotificationRunnable runnable =
                mService.new PostNotificationRunnable(update.getKey());
                mService.new PostNotificationRunnable(update.getKey(),
                        SystemClock.elapsedRealtime());
        runnable.run();
        waitForIdle();

+5 −4
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ import android.os.IBinder;
import android.os.Looper;
import android.os.Process;
import android.os.RemoteException;
import android.os.SystemClock;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
@@ -656,7 +657,7 @@ public class NotificationPermissionMigrationTest extends UiServiceTestCase {
        when(mPermissionHelper.hasPermission(anyInt())).thenReturn(false);

        NotificationManagerService.PostNotificationRunnable runnable =
                mService.new PostNotificationRunnable(r.getKey());
                mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime());
        runnable.run();
        waitForIdle();

@@ -789,7 +790,7 @@ public class NotificationPermissionMigrationTest extends UiServiceTestCase {

        mService.addEnqueuedNotification(r);
        NotificationManagerService.PostNotificationRunnable runnable =
                mService.new PostNotificationRunnable(r.getKey());
                mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime());
        runnable.run();
        waitForIdle();

@@ -805,7 +806,7 @@ public class NotificationPermissionMigrationTest extends UiServiceTestCase {
        r = new NotificationRecord(mContext, sbn, mTestNotificationChannel);

        mService.addEnqueuedNotification(r);
        runnable = mService.new PostNotificationRunnable(r.getKey());
        runnable = mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime());
        runnable.run();
        waitForIdle();

@@ -821,7 +822,7 @@ public class NotificationPermissionMigrationTest extends UiServiceTestCase {
        r = new NotificationRecord(mContext, sbn, mTestNotificationChannel);

        mService.addEnqueuedNotification(r);
        runnable = mService.new PostNotificationRunnable(r.getKey());
        runnable = mService.new PostNotificationRunnable(r.getKey(), SystemClock.elapsedRealtime());
        runnable.run();
        waitForIdle();