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

Commit 99f17ced authored by Brad Ebinger's avatar Brad Ebinger
Browse files

Expose ConnectionService Handler to remove flaky tests

Test: atest TelecomUnitTests
Change-Id: Ibb80b5739083ad9f85ee06f4d9f0017f4cb605bd
parent 28b12c34
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
import android.telecom.Logging.Session;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.os.SomeArgs;
import com.android.internal.telecom.IConnectionService;
import com.android.internal.telecom.IConnectionServiceAdapter;
@@ -2672,4 +2673,13 @@ public abstract class ConnectionService extends Service {
            return ++mId;
        }
    }

    /**
     * Returns this handler, ONLY FOR TESTING.
     * @hide
     */
    @VisibleForTesting
    public Handler getHandler() {
        return mHandler;
    }
}
+14 −0
Original line number Diff line number Diff line
@@ -391,6 +391,20 @@ public class SessionManager {
        return mCurrentThreadId.get();
    }

    /**
     * @return A String representation of the active sessions at the time that this method is
     * called.
     */
    @VisibleForTesting
    public synchronized String printActiveSessions() {
        StringBuilder message = new StringBuilder();
        for (ConcurrentHashMap.Entry<Integer, Session> entry : mSessionMapper.entrySet()) {
            message.append(entry.getValue().printFullSessionTree());
            message.append("\n");
        }
        return message.toString();
    }

    @VisibleForTesting
    public synchronized void cleanupStaleSessions(long timeoutMs) {
        String logMessage = "Stale Sessions Cleaned:\n";