Skip to content

Clean up sign in state management #4491

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
Dec 22, 2022

Conversation

lfkellogg
Copy link
Contributor

@lfkellogg lfkellogg commented Dec 22, 2022

  • Speed up typical reads and writes by only using the background executor in SignInStorage to initialize the SharedPreferences object, not protect all references
  • Do not complete the Task returned by signInTester until the tester sign in status is updated
  • Use an actual SignInStorage instance in TesterSignInManagerTest

@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

@github-actions
Copy link
Contributor

github-actions bot commented Dec 22, 2022

Unit Test Results

163 tests   163 ✔️  40s ⏱️
  16 suites      0 💤
  16 files        0

Results for commit da17514.

♻️ This comment has been updated with latest results.

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Dec 22, 2022

Coverage Report 1

Affected Products

  • firebase-appdistribution

    Overall coverage changed from ? (973f40e) to 77.12% (b6afdae) by ?.

    42 individual files with coverage change

    FilenameBase (973f40e)Merge (b6afdae)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?89.63%?
    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/21OMjl6jpm.html

@lfkellogg lfkellogg force-pushed the lk/cleanup-signinmanager branch from dc74f3b to f1e46fe Compare December 22, 2022 19:03
@lfkellogg lfkellogg changed the title Simplify sign in state management Clean up sign in state management Dec 22, 2022
@lfkellogg lfkellogg force-pushed the lk/cleanup-signinmanager branch from f1e46fe to 43ec7a0 Compare December 22, 2022 19:13
@lfkellogg lfkellogg requested a review from kaibolay December 22, 2022 19:19

private <T> Task<T> applyToSharedPreferences(SharedPreferencesFunction<T> func) {
// Check nullness of sharedPreferences directly even though multiple threads could be calling
// this function at once. This isn't a problem because: 1) once it is set it will never be set,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: is this overlong line something :googleJavaFormat would fix?
extra-nit: "set back to null" -> "reset back to null"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Huh, it doesn't appear overlong to me (100 characters). :googleJavaFormat thinks its fine too.

I like "reset back to null", changed.

// Simulate re-entering app after successful sign in, via SignInResultActivity
testerSignInManager.onActivityCreated(mockSignInResultActivity);

awaitTaskFailure(signInTask, UNKNOWN, "Error storing tester sign in state", expectedException);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: long line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

:googleJavaFormat says this is fine too. Looks like 100 chars is the max.

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Dec 22, 2022

Size Report 1

Affected Products

  • base

    TypeBase (973f40e)Merge (b6afdae)Diff
    apk (aggressive)?8.39 kB? (?)
    apk (release)?8.65 kB? (?)
  • firebase-annotations

    TypeBase (973f40e)Merge (b6afdae)Diff
    apk (aggressive)?8.39 kB? (?)
    apk (release)?9.46 kB? (?)
  • firebase-appdistribution

    TypeBase (973f40e)Merge (b6afdae)Diff
    aar?152 kB? (?)
    apk (aggressive)?833 kB? (?)
    apk (release)?2.01 MB? (?)
  • firebase-appdistribution-api

    TypeBase (973f40e)Merge (b6afdae)Diff
    aar?16.0 kB? (?)
    apk (aggressive)?95.8 kB? (?)
    apk (release)?706 kB? (?)
  • firebase-common

    TypeBase (973f40e)Merge (b6afdae)Diff
    aar?67.4 kB? (?)
    apk (aggressive)?95.1 kB? (?)
    apk (release)?700 kB? (?)
  • firebase-components

    TypeBase (973f40e)Merge (b6afdae)Diff
    aar?44.9 kB? (?)
    apk (aggressive)?8.68 kB? (?)
    apk (release)?33.6 kB? (?)
  • firebase-installations

    TypeBase (973f40e)Merge (b6afdae)Diff
    aar?55.0 kB? (?)
    apk (aggressive)?96.6 kB? (?)
    apk (release)?724 kB? (?)
  • firebase-installations-interop

    TypeBase (973f40e)Merge (b6afdae)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/F8nGLuYQpj.html

@lfkellogg lfkellogg force-pushed the lk/cleanup-signinmanager branch from ff3ee8c to da17514 Compare December 22, 2022 19:39
@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 (b6afdae) and the base commit (973f40e) are not available.

No macrobenchmark data found for the base commit (973f40e). Analysis for the CI merge commit (b6afdae) can be found at:

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

@lfkellogg lfkellogg merged commit c785db4 into fad/in-app-feedback Dec 22, 2022
@lfkellogg lfkellogg deleted the lk/cleanup-signinmanager branch December 22, 2022 21:02
lfkellogg added a commit that referenced this pull request Jan 5, 2023
* Simplify sign in state management

* Reword comment
@firebase firebase locked and limited conversation to collaborators Jan 22, 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