Skip to content

Refactor out cached ApkHashExtractor #3767

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 4 commits into from
Jun 1, 2022
Merged

Conversation

lfkellogg
Copy link
Contributor

This will be useful for in-app feedback because we'll be using the APK hash to identify the release.

@lfkellogg lfkellogg changed the title Refactor out ApkHashExtractor Refactor out cached ApkHashExtractor May 31, 2022
@lfkellogg lfkellogg requested a review from kaibolay May 31, 2022 22:15
@google-oss-bot
Copy link
Contributor

google-oss-bot commented May 31, 2022

Coverage Report 1

Affected Products

  • firebase-appdistribution

    Overall coverage changed from ? (fd109a8) to 79.88% (a365966) by ?.

    30 individual files with coverage change

    FilenameBase (fd109a8)Merge (a365966)Diff
    AabUpdater.java?98.68%?
    ApkHashExtractor.java?92.86%?
    ApkInstaller.java?96.88%?
    ApkUpdater.java?93.75%?
    AppDistributionReleaseImpl.java?100.00%?
    AppDistributionReleaseInternal.java?100.00%?
    AppIconSource.java?85.71%?
    AutoValue_AppDistributionReleaseImpl.java?65.45%?
    AutoValue_AppDistributionReleaseInternal.java?67.86%?
    AutoValue_UpdateProgressImpl.java?65.96%?
    ErrorMessages.java?0.00%?
    FirebaseAppDistributionExceptions.java?80.00%?
    FirebaseAppDistributionFileProvider.java?0.00%?
    FirebaseAppDistributionImpl.java?94.90%?
    FirebaseAppDistributionLifecycleNotifier.java?73.68%?
    FirebaseAppDistributionNotificationsManager.java?80.00%?
    FirebaseAppDistributionRegistrar.java?92.31%?
    FirebaseAppDistributionTesterApiClient.java?91.40%?
    HttpsUrlConnectionFactory.java?50.00%?
    InstallActivity.java?2.53%?
    LogWrapper.java?46.67%?
    NewReleaseFetcher.java?87.67%?
    ReleaseIdentificationUtils.java?54.55%?
    ReleaseUtils.java?83.33%?
    SignInResultActivity.java?0.00%?
    SignInStorage.java?57.14%?
    TaskUtils.java?96.30%?
    TesterSignInManager.java?93.62%?
    UpdateProgressImpl.java?100.00%?
    UpdateTaskImpl.java?75.71%?

Test Logs

Notes

  • Commit (a365966) is created by Prow via merging PR base commit (fd109a8) and head commit (ab9d427).
  • 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/7vcYuiwtZL.html

@google-oss-bot
Copy link
Contributor

google-oss-bot commented May 31, 2022

Size Report 1

Affected Products

  • firebase-appdistribution

    TypeBase (fd109a8)Merge (a365966)Diff
    aar121 kB122 kB+951 B (+0.8%)
    apk (aggressive)751 kB751 kB+96 B (+0.0%)
    apk (release)1.59 MB1.59 MB+20 B (+0.0%)

Test Logs

Notes

  • Commit (a365966) is created by Prow via merging PR base commit (fd109a8) and head commit (ab9d427).

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

@Nullable
String calculateApkHash(@NonNull File file) {
LogWrapper.getInstance().v(TAG + "Calculating release id for " + file.getPath());
LogWrapper.getInstance().v(TAG + "File size: " + file.length());
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: please merge this with the previous log statement

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

} finally {
long elapsed = System.currentTimeMillis() - start;
if (elapsed > 2 * 1000) {
LogWrapper.getInstance()
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe log this always and merge the log statements?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@kaibolay
Copy link
Contributor

kaibolay commented Jun 1, 2022

This will be useful for in-app feedback because we'll be using the APK hash to identify the release.

...or the package identifier for AABs. So I'm curious: Why not keep those two related things in ReleaseIdentificationUtils?

@lfkellogg lfkellogg force-pushed the lk/apk-hash-extractor branch 2 times, most recently from c5e87bd to a566d15 Compare June 1, 2022 18:14
@lfkellogg lfkellogg force-pushed the lk/apk-hash-extractor branch from a566d15 to 5ae822b Compare June 1, 2022 18:16
@lfkellogg
Copy link
Contributor Author

This will be useful for in-app feedback because we'll be using the APK hash to identify the release.

...or the package identifier for AABs. So I'm curious: Why not keep those two related things in ReleaseIdentificationUtils?

The main reason is the caching of the APK hash. That used to be maintained in the NewReleaseFetcher, but we'll want to take advantage of that caching for IAF as well. So now that's all isolated to the ApkHashExtractor.

We could instead have the class be something like "BinaryIdentifierExtractor" and handle the AAB vs. APK logic there, but the APK specific stuff seems like enough of a responsibility on its own. Maybe that could be a separate class that depends on an injected ApkHashExtractor.

@lfkellogg
Copy link
Contributor Author

/test check-coverage-changed

@lfkellogg lfkellogg merged commit 9220e61 into master Jun 1, 2022
@lfkellogg lfkellogg deleted the lk/apk-hash-extractor branch June 1, 2022 20:06
@firebase firebase locked and limited conversation to collaborators Jul 2, 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.

3 participants