-
Notifications
You must be signed in to change notification settings - Fork 616
Show dialogs on UI thread #3464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
// We may not be on the main (UI) thread in some cases, specifically if the developer calls | ||
// the basic config from the background. If we are already on the main thread, this will | ||
// execute immediately. | ||
hostActivity.runOnUiThread( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do the work of creating the dialog not on the UI thread? Can we just have the showing of the dialog on the UI thread?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question - we actually can't. new AlertDialog.Builder(hostActivity).create()
has to be called on the UI thread. I at first just wrapped the .show()
call and then had to figure out why it was still broken :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bummer! Great investigation!
@@ -247,6 +251,19 @@ public void updateToNewRelease_whenNewAabReleaseAvailable_showsUpdateDialog() { | |||
shadowOf(dialog).getMessage().toString()); | |||
} | |||
|
|||
@Test | |||
public void updateToNewRelease_fromABackgroundThread_showsUpdateDialog() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Nit/ No action required) I'm just now noticing that some of these tests use the old name of updateToNewRelease
, and some use the new name updateIfNewReleaseAvailable
X)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good catch. Fixed!
0e7b970
to
62d414b
Compare
Coverage Report 1Affected Products
Test Logs
Notes |
Size Report 1Affected Products
Test Logs
Notes |
@lfkellogg: The following test failed, say
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
* Show dialogs on UI thread * Fix test names
No description provided.