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

Commit 2563d216 authored by Beverly's avatar Beverly
Browse files

Add extra logging for Assert.isMainThread

Test: atest SystemUiTests
Bug: 147685528
Change-Id: Ia041f98acaa35e5a89303cbdfa72c8965e8eab75
parent 1035b49a
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ package com.android.systemui.util;

import android.os.Looper;

import com.android.internal.annotations.VisibleForTesting;
import androidx.annotation.VisibleForTesting;

/**
 * Helper providing common assertions.
@@ -30,7 +30,9 @@ public class Assert {

    public static void isMainThread() {
        if (!sMainLooper.isCurrentThread()) {
            throw new IllegalStateException("should be called from the main thread.");
            throw new IllegalStateException("should be called from the main thread."
                    + " sMainLooper.threadName=" + sMainLooper.getThread().getName()
                    + " Thread.currentThread()=" + Thread.currentThread().getName());
        }
    }

+1 −0
Original line number Diff line number Diff line
@@ -234,6 +234,7 @@ public class TestableLooper {
            try {
                mLooper = setAsMain ? Looper.getMainLooper() : createLooper();
                mTestableLooper = new TestableLooper(mLooper, false);
                mTestableLooper.getLooper().getThread().setName(test.getClass().getName());
            } catch (Exception e) {
                throw new RuntimeException(e);
            }