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

Commit 2fa84617 authored by Vaibhav Devmurari's avatar Vaibhav Devmurari
Browse files

Add logs to start and close for InputManagerGlobal.TestSession

Tests can be affected if a non-hermetic test starts a test session
but never closes it. In order to monitor this, add logs when a
test session is strted or closed.

Bug: 245989146
Test: atest CtsInputTestCases
Flag: EXEMPT logs_only
Change-Id: Idc33219964073b02c757b1a1b22700ddb76e56b3
parent c8d0c48c
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -206,7 +206,14 @@ public final class InputManagerGlobal {
        synchronized (InputManagerGlobal.class) {
            final var oldInstance = sInstance;
            sInstance = new InputManagerGlobal(inputManagerService);
            return () -> sInstance = oldInstance;
            Log.d(TAG, "Starting InputManagerGlobal test session with new service instance "
                    + inputManagerService + ", old service instance = "
                    + (oldInstance != null ? oldInstance.getInputManagerService() : "null"));
            return () -> {
                Log.d(TAG, "Closing test session and restoring service instance to "
                        + (oldInstance != null ? oldInstance.getInputManagerService() : "null"));
                sInstance = oldInstance;
            };
        }
    }