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

Commit e6fdbd8c authored by Suprabh Shukla's avatar Suprabh Shukla
Browse files

Reduce logspam for BoundServiceSession errors

Only logging once for a bad session.

Binding errors from the notification service should be logged from the
listener at the time of connection.

Test: Manually inspect logs
Flag: EXEMPT logs only changes

Bug: 434679743
Change-Id: I0180cbe1b19ae1b152f4ae287e12f90e616e31e2
parent 61e5d8e4
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1606,6 +1606,10 @@ public abstract class NotificationListenerService extends Service {
                applyUpdateLocked(update);
                mCompletionListener = completionListener;
            }
            if (isConnected) {
                Log.e(TAG, "onListenerConnected called on an already connected service!"
                        + " This can result in duplicate events.");
            }
            isConnected = true;
            final SomeArgs args = SomeArgs.obtain();
            args.argl1 = dispatchToken;
+9 −2
Original line number Diff line number Diff line
@@ -78,6 +78,8 @@ public class BoundServiceSession implements IBinderSession {
    @GuardedBy("this")
    int mTotal = 0;

    private boolean mKnownBad = false;

    BoundServiceSession(BiConsumer<ConnectionRecord, Boolean> processStateUpdater,
            WeakReference<ConnectionRecord> weakCr, String debugName) {
        mProcessStateUpdater = processStateUpdater;
@@ -122,8 +124,13 @@ public class BoundServiceSession implements IBinderSession {
        // the underlying ConnectionRecord. This also ensures that there are no shenanigans that
        // the remote app can perform with the given token to remain unfrozen.
        logTraceInstant(() -> errorMessage);
        if (!mKnownBad) {
            Slog.wtfStack(TAG,
                    errorMessage + ". Current keys: " + mKeyByTag + "; Counts: " + mCountByKey);
            mKnownBad = true;
        } else {
            Slog.e(TAG, errorMessage + ". Current keys: " + mKeyByTag + "; Counts: " + mCountByKey);
        }
        mKeyByTag.clear();
        mCountByKey.clear();
        if (mTotal != 0) {