Skip to content

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

Merged
merged 2 commits into from
Feb 17, 2022
Merged

Show dialogs on UI thread #3464

merged 2 commits into from
Feb 17, 2022

Conversation

lfkellogg
Copy link
Contributor

No description provided.

// 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(
Copy link
Contributor

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?

Copy link
Contributor Author

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 :)

Copy link
Contributor

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()

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)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good catch. Fixed!

@lfkellogg lfkellogg force-pushed the lk/show-dialog-on-ui-thread-2 branch from 0e7b970 to 62d414b Compare February 17, 2022 19:01
@google-oss-bot
Copy link
Contributor

google-oss-bot commented Feb 17, 2022

Coverage Report 1

Affected Products

  • firebase-appdistribution

    Overall coverage changed from 76.43% (d54c7c0) to 76.50% (df3c41a) by +0.07%.

    FilenameBase (d54c7c0)Merge (df3c41a)Diff
    FirebaseAppDistribution.java94.47%94.58%+0.11%

Test Logs

Notes

  • Commit (df3c41a) is created by Prow via merging PR base commit (d54c7c0) and head commit (62d414b).
  • Run gradle <product>:checkCoverage to produce HTML coverage reports locally. After gradle commands finished, report files can be found under <product-build-dir>/reports/jacoco/.

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/AFIgtCQh86.html

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Feb 17, 2022

Size Report 1

Affected Products

  • firebase-appdistribution

    TypeBase (d54c7c0)Merge (df3c41a)Diff
    aar123 kB124 kB+214 B (+0.2%)
    apk (aggressive)743 kB744 kB+668 B (+0.1%)
    apk (release)1.57 MB1.57 MB+296 B (+0.0%)

Test Logs

Notes

  • Commit (df3c41a) is created by Prow via merging PR base commit (d54c7c0) and head commit (62d414b).

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/IOTD5oItqj.html

@google-oss-bot
Copy link
Contributor

@lfkellogg: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
smoke-tests 62d414b link /test smoke-tests

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.

@lfkellogg lfkellogg merged commit 7d9a5a7 into master Feb 17, 2022
@lfkellogg lfkellogg deleted the lk/show-dialog-on-ui-thread-2 branch February 17, 2022 19:34
jeremyjiang-dev pushed a commit that referenced this pull request Mar 9, 2022
* Show dialogs on UI thread

* Fix test names
@firebase firebase locked and limited conversation to collaborators Mar 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants