From e896ee918a8b2817d706ef5479415170e420c27a Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Thu, 23 Feb 2023 05:51:47 +0000 Subject: Add more logging when view methods are called from the wrong thread Bug: 270446029 Test: Just extending the logging Change-Id: I7212ca245dad6c77a51797f07e1587edbf6af475 --- core/java/android/view/ViewRootImpl.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 953f17a3a827..f9e84114a7da 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -9883,9 +9883,12 @@ public final class ViewRootImpl implements ViewParent, } void checkThread() { - if (mThread != Thread.currentThread()) { + Thread current = Thread.currentThread(); + if (mThread != current) { throw new CalledFromWrongThreadException( - "Only the original thread that created a view hierarchy can touch its views."); + "Only the original thread that created a view hierarchy can touch its views." + + " Expected: " + mThread.getName() + + " Calling: " + current.getName()); } } -- cgit v1.2.3-59-g8ed1b