Skip to content

Make isTesterSignedIn more reliable #4493

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 1 commit into from
Jan 3, 2023

Conversation

lfkellogg
Copy link
Contributor

@lfkellogg lfkellogg commented Dec 22, 2022

There was an edge case where, if the first thing you did when opening the app was to call signOutTester, calling isTesterSignedIn immediately afterwords would return true. This makes a few tweaks which should prevent this from happening in any reasonable scenario:

  • Sets the sign in status in storage immediately when signOutTester() is called
  • Stores SharedPreferences even when getSignInStatusBlocking() is called

Also adds some more tests to cover the failure mode, and some general test cleanup.

@google-oss-bot
Copy link
Contributor

1 Warning
⚠️ Did you forget to add a changelog entry? (Add the 'no-changelog' label to the PR to silence this warning.)

Generated by 🚫 Danger

@google-oss-bot
Copy link
Contributor

Coverage Report 1

Affected Products

  • firebase-appdistribution

    Overall coverage changed from ? (c785db4) to 77.18% (649e8f3) by ?.

    42 individual files with coverage change

    FilenameBase (c785db4)Merge (649e8f3)Diff
    AabUpdater.java?98.67%?
    ApkInstaller.java?96.88%?
    ApkUpdater.java?93.97%?
    AppDistributionReleaseImpl.java?100.00%?
    AppDistributionReleaseInternal.java?100.00%?
    AppIconSource.java?84.62%?
    AutoValue_AppDistributionReleaseImpl.java?65.45%?
    AutoValue_AppDistributionReleaseInternal.java?71.58%?
    AutoValue_ImageUtils_ImageSize.java?35.00%?
    AutoValue_TesterApiDisabledErrorDetails.java?29.41%?
    AutoValue_TesterApiDisabledErrorDetails_HelpLink.java?54.17%?
    AutoValue_UpdateProgressImpl.java?65.96%?
    ErrorMessages.java?0.00%?
    FeedbackActivity.java?1.12%?
    FeedbackSender.java?84.62%?
    FirebaseAppDistributionExceptions.java?80.00%?
    FirebaseAppDistributionFileProvider.java?0.00%?
    FirebaseAppDistributionImpl.java?90.00%?
    FirebaseAppDistributionLifecycleNotifier.java?92.91%?
    FirebaseAppDistributionNotificationsManager.java?87.18%?
    FirebaseAppDistributionRegistrar.java?86.27%?
    FirebaseAppDistributionTesterApiClient.java?88.54%?
    HttpsUrlConnectionFactory.java?50.00%?
    ImageUtils.java?100.00%?
    InstallActivity.java?2.67%?
    LogWrapper.java?100.00%?
    NewReleaseFetcher.java?80.85%?
    PackageInfoUtils.java?42.86%?
    ReleaseIdentifier.java?85.54%?
    ReleaseUtils.java?83.33%?
    ScreenshotTaker.java?41.18%?
    SequentialReference.java?100.00%?
    SignInResultActivity.java?0.00%?
    SignInStorage.java?100.00%?
    TakeScreenshotAndStartFeedbackActivity.java?0.00%?
    TaskCache.java?100.00%?
    TaskUtils.java?91.67%?
    TesterApiDisabledErrorDetails.java?93.75%?
    TesterApiHttpClient.java?90.18%?
    TesterSignInManager.java?96.12%?
    UpdateProgressImpl.java?100.00%?
    UpdateTaskImpl.java?76.00%?

Test Logs

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

@github-actions
Copy link
Contributor

Unit Test Results

166 tests   166 ✔️  52s ⏱️
  16 suites      0 💤
  16 files        0

Results for commit 33a722b.

@lfkellogg lfkellogg requested a review from kaibolay December 22, 2022 22:28
@google-oss-bot
Copy link
Contributor

Size Report 1

Affected Products

  • base

    TypeBase (c785db4)Merge (649e8f3)Diff
    apk (aggressive)?8.39 kB? (?)
    apk (release)?8.65 kB? (?)
  • firebase-annotations

    TypeBase (c785db4)Merge (649e8f3)Diff
    apk (aggressive)?8.39 kB? (?)
    apk (release)?9.46 kB? (?)
  • firebase-appdistribution

    TypeBase (c785db4)Merge (649e8f3)Diff
    aar?152 kB? (?)
    apk (aggressive)?833 kB? (?)
    apk (release)?2.01 MB? (?)
  • firebase-appdistribution-api

    TypeBase (c785db4)Merge (649e8f3)Diff
    aar?16.0 kB? (?)
    apk (aggressive)?95.8 kB? (?)
    apk (release)?706 kB? (?)
  • firebase-common

    TypeBase (c785db4)Merge (649e8f3)Diff
    aar?67.4 kB? (?)
    apk (aggressive)?95.1 kB? (?)
    apk (release)?700 kB? (?)
  • firebase-components

    TypeBase (c785db4)Merge (649e8f3)Diff
    aar?44.9 kB? (?)
    apk (aggressive)?8.68 kB? (?)
    apk (release)?33.6 kB? (?)
  • firebase-installations

    TypeBase (c785db4)Merge (649e8f3)Diff
    aar?55.0 kB? (?)
    apk (aggressive)?96.6 kB? (?)
    apk (release)?724 kB? (?)
  • firebase-installations-interop

    TypeBase (c785db4)Merge (649e8f3)Diff
    aar?8.05 kB? (?)
    apk (aggressive)?65.0 kB? (?)
    apk (release)?651 kB? (?)

Test Logs

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

@google-oss-bot
Copy link
Contributor

Startup Time Report 1

Note: Layout is sometimes suboptimal due to limited formatting support on GitHub. Please check this report on GCS.

Startup time comparison between the CI merge commit (649e8f3) and the base commit (c785db4) are not available.

No macrobenchmark data found for the base commit (c785db4). Analysis for the CI merge commit (649e8f3) can be found at:

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

@@ -54,12 +57,14 @@ Task<Boolean> getSignInStatus() {
}

boolean getSignInStatusBlocking() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this method be renamed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No I don't think so. It still returns the sign in status, and it is still potentially blocking.

I changed getSharedPreferencesBlocking() to getAndCacheSharedPreferences() because if I included Blocking it would be super long and I didn't think it was necessary for the private method name to communicate that it blocks.

@lfkellogg lfkellogg merged commit a28c43e into fad/in-app-feedback Jan 3, 2023
@lfkellogg lfkellogg deleted the lk/harden-signinstorage branch January 3, 2023 18:21
lfkellogg added a commit that referenced this pull request Jan 5, 2023
kaibolay pushed a commit that referenced this pull request Jan 23, 2023
lfkellogg added a commit that referenced this pull request Jan 25, 2023
lfkellogg added a commit that referenced this pull request Jan 25, 2023
@firebase firebase locked and limited conversation to collaborators Feb 3, 2023
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.

3 participants