ViewHierarchyExceptionHandler calls View methods on non-UI thread
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- java
- Domain
- testing-qa
Research direction
Start with ViewHierarchyExceptionHandler.java, especially handleSafely and dumpFullViewHierarchyToFile, and compare the failing stack with Espresso's UI-thread behavior. Use ArchivedTabsDialogCoordinatorTest.testContentDescription as the reported reproduction; done means view-hierarchy error handling no longer calls View methods from the background thread.
Written by the indexing model from the issue text.
Description
This stack comes up in failing chrome tests from time to time:
C 11:28:54.816 87.729s Main java.lang.AssertionError: Class was initialized on the UI thread, but current operation was performed on a background thread: Thread[Instr: org.chromium.base.test.BaseChromiumAndroidJUnitRunner,5,main]
C 11:28:54.816 87.730s Main at org.chromium.base.ThreadUtils$ThreadChecker.assertOnValidThreadHelper(ThreadUtils.java:97)
C 11:28:54.816 87.730s Main at org.chromium.base.ThreadUtils$ThreadChecker.assertOnValidThread(ThreadUtils.java:71)
C 11:28:54.816 87.730s Main at org.chromium.base.UserDataHost.checkThreadAndState(UserDataHost.java:64)
C 11:28:54.816 87.730s Main at org.chromium.base.UserDataHost.getUserData(UserDataHost.java:96)
C 11:28:54.816 87.730s Main at org.chromium.content.browser.webcontents.WebContentsImpl.getOrSetUserData(WebContentsImpl.java:1042)
C 11:28:54.816 87.730s Main at org.chromium.content.browser.input.ImeAdapterImpl.fromWebContents(ImeAdapterImpl.java:253)
C 11:28:54.816 87.730s Main at org.chromium.content_public.browser.ImeAdapter.fromWebContents(ImeAdapter.java:32)
C 11:28:54.816 87.730s Main at org.chromium.components.embedder_support.view.ContentView.onCreateInputConnection(ContentView.java:360)
C 11:28:54.816 87.730s Main at androidx.test.espresso.util.HumanReadables.describe(HumanReadables.java:247)
C 11:28:54.816 87.730s Main at androidx.test.espresso.util.HumanReadables.getViewHierarchyErrorMessage(HumanReadables.java:116)
C 11:28:54.816 87.730s Main at androidx.test.espresso.util.HumanReadables.getViewHierarchyErrorMessage(HumanReadables.java:73)
C 11:28:54.816 87.730s Main at androidx.test.espresso.base.ViewHierarchyExceptionHandler.dumpFullViewHierarchyToFile(ViewHierarchyExceptionHandler.java:96)
C 11:28:54.816 87.730s Main at androidx.test.espresso.base.ViewHierarchyExceptionHandler.handleSafely(ViewHierarchyExceptionHandler.java:65)
C 11:28:54.816 87.730s Main at androidx.test.espresso.base.ViewHierarchyExceptionHandler.handleSafely(ViewHierarchyExceptionHandler.java:38)
C 11:28:54.816 87.730s Main at androidx.test.espresso.base.DefaultFailureHandler$TypedFailureHandler.handle(DefaultFailureHandler.java:158)
C 11:28:54.816 87.730s Main at androidx.test.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:120)
C 11:28:54.816 87.730s Main at androidx.test.espresso.ViewInteraction.waitForAndHandleInteractionResults(ViewInteraction.java:385)
C 11:28:54.816 87.730s Main at androidx.test.espresso.ViewInteraction.check(ViewInteraction.java:366)
C 11:28:54.816 87.730s Main at org.chromium.chrome.browser.tasks.tab_management.ArchivedTabsDialogCoordinatorTest.testContentDescription(ArchivedTabsDialogCoordinatorTest.java:754)
Espresso normally jumps to the UI thread to interact with Views, but I think that got missed for ViewHierarchyExceptionHandler. It should do a thread hop before accessing Views.
- Dominant language
- Java
- Stars
- 1.2k
- Forks
- 342
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 5
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from android/android-test
-
Difficulty 1/5 Under an hour Newbie friendliness 62/100
android/android-test#681 · 2 comments · 1 reaction ·
-
ξεκσνδξδ Open
Difficulty 5/5 Over a week Newbie friendliness 1/100
android/android-test#2499 ·
-
ησξξσ Open
Difficulty 5/5 Over a week Newbie friendliness 1/100
android/android-test#2498 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
android/android-test#2473 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
android/android-test#2461 · 6 comments · 4 reactions ·
All issues in android/android-test
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
area/frontend
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100