Skip to content

[Common] Replace hardcoded SDK version with Config.OLDEST_SDK (2) #7060

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rlazo
Copy link
Collaborator

@rlazo rlazo commented Jun 20, 2025

Tests will use the Config.OLDEST_SDK instead of a hardcoded SDK if the corresponding hardcoded SDK would be below our intended minSdk.

I'll also need to re-evaluate whether these tests are necessary to keep around, or if they are irrelevant when bumping the minSdk.

Related to cl/769912845

Copy link
Contributor

Firebase AI Mock Responses Check ⚠️

A newer major version of the mock responses for Firebase AI unit tests is available. update_responses.sh should be updated to clone the latest version of the responses: v14.1

Copy link
Contributor

📝 PRs merging into main branch

Our main branch should always be in a releasable state. If you are working on a larger change, or if you don't want this change to see the light of the day just yet, consider using a feature branch first, and only merge into the main branch when the code complete and ready to be released.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @rlazo, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request primarily aims to modernize test configurations by replacing specific hardcoded Android SDK versions with a dynamic Config.OLDEST_SDK constant. This change aligns tests with the project's minimum supported SDK, preparing for future minSdk bumps. Additionally, a minor correction was made to a user agent pattern in one of the tests to ensure correct assertion behavior.

Highlights

  • Standardize Test SDK Configuration: Replaced hardcoded Android SDK versions (e.g., API 21, API 22) in test configurations with Config.OLDEST_SDK. This ensures tests consistently run against the project's minimum supported SDK version, simplifying maintenance as the minSdk evolves.
  • Fix User Agent Pattern: Corrected a regex pattern in FirebasePlatformLoggingTest from android-platform to android-installer for user agent string matching. This addresses an apparent bug in the test's assertion logic.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@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

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates two test files to use Config.OLDEST_SDK instead of hardcoded SDK versions, which improves maintainability as the minimum SDK changes over time. The changes are consistent with the PR's goal. I have one point of feedback regarding a change in a test assertion that accompanies the SDK version update, for which I've requested clarification.

@@ -98,7 +98,7 @@ public void test_auto_atNotHighEnoughApiLevel() {
app -> {
UserAgentPublisher ua = app.get(UserAgentPublisher.class);

assertThat(ua.getUserAgent()).containsMatch(Pattern.compile("android-platform/($|\\s)"));
assertThat(ua.getUserAgent()).containsMatch(Pattern.compile("android-installer/($|\\s)"));

Choose a reason for hiding this comment

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

medium

This change updates the expected user agent string from android-platform/ to android-installer/. While this might be correct due to the change in SDK version for this test (from LOLLIPOP_MR1 to OLDEST_SDK), it's a functional change in the test's expectation that isn't explained in the pull request description.

Could you please clarify why this change is needed? For example, is there a specific SDK level where the fallback behavior for platform detection changes from an empty platform string to an empty installer string?

Adding a brief explanation to the PR description would be helpful for future readers to understand the context of this change.

@google-oss-bot
Copy link
Contributor

Copy link
Contributor

Test Results

 50 files   -  1 008   50 suites   - 1 008   1m 8s ⏱️ - 34m 16s
 76 tests  -  5 909   76 ✅  -  5 887  0 💤  - 22  0 ❌ ±0 
168 runs   - 11 865  168 ✅  - 11 821  0 💤  - 44  0 ❌ ±0 

Results for commit 9a869a3. ± Comparison against base commit 9b510c4.

This pull request removes 5909 tests.
com.google.android.datatransport.cct.CctBackendFactoryTest ‑ create_returnCCTBackend_WhenBackendNameIsCCT
com.google.android.datatransport.cct.CctDestinationTest ‑ cctDestination_shouldOnlySupportProtoAndJson
com.google.android.datatransport.cct.CctDestinationTest ‑ cctDestination_shouldSupportProtoAndJson
com.google.android.datatransport.cct.CctTransportBackendTest ‑ decorate_whenOffline_shouldProperlyPopulateNetworkInfo
com.google.android.datatransport.cct.CctTransportBackendTest ‑ decorate_whenOnline_shouldProperlyPopulateNetworkInfo
com.google.android.datatransport.cct.CctTransportBackendTest ‑ schedule_shouldAddCookieOnPseudonymousIds
com.google.android.datatransport.cct.CctTransportBackendTest ‑ schedule_shouldDropCookieOnMixedPseudonymousIds
com.google.android.datatransport.cct.CctTransportBackendTest ‑ send_CompressedResponseIsUncompressed
com.google.android.datatransport.cct.CctTransportBackendTest ‑ send_whenBackendRedirectsMoreThan5Times_shouldOnlyRedirect4Times
com.google.android.datatransport.cct.CctTransportBackendTest ‑ send_whenBackendRedirects_shouldCorrectlyFollowTheRedirectViaPost
…

@google-oss-bot
Copy link
Contributor

@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.

Notes

Startup Times

  • ComponentDiscovery

    DeviceStatisticsDistributions
    oriole-32
    Percentile9b510c4e3c2fc9DiffSignificant (?)
    p10986 ±55 μs955 ±50 μs-30.8 μs (-3.1%)NO
    p251.08 ±0.06 ms1.04 ±0.04 ms-34.5 μs (-3.2%)NO
    p501.20 ±0.07 ms1.19 ±0.05 ms-10.9 μs (-0.9%)NO
    p751.41 ±0.1 ms1.41 ±0.08 ms-7.36 μs (-0.5%)NO
    p901.71 ±0.2 ms1.70 ±0.1 ms-3.00 μs (-0.2%)NO

    20 test runs in comparison
    CommitTest Runs
    9b510c4
    • 2025-06-20_21:43:51.650907_CVMu
    • 2025-06-20_21:43:51.650950_tHuJ
    • 2025-06-20_21:43:51.650959_wNNT
    • 2025-06-20_21:43:51.650967_kXiu
    • 2025-06-20_21:43:51.650974_XEbc
    • 2025-06-20_21:43:51.650981_xOlN
    • 2025-06-20_21:43:51.650989_cSfz
    • 2025-06-20_21:43:51.650996_uMIs
    • 2025-06-20_21:43:51.651003_ihVf
    • 2025-06-20_21:43:51.651010_SzXi
    e3c2fc9
    • 2025-06-20_23:33:29.026862_PiWK
    • 2025-06-20_23:33:29.026903_eccD
    • 2025-06-20_23:33:29.026914_fntS
    • 2025-06-20_23:33:29.026923_jkmM
    • 2025-06-20_23:33:29.026930_lOmI
    • 2025-06-20_23:33:29.026937_lKfQ
    • 2025-06-20_23:33:29.026944_VsYm
    • 2025-06-20_23:33:29.026951_gXrh
    • 2025-06-20_23:33:29.026957_Sksk
    • 2025-06-20_23:33:29.026963_PPkz
    redfin-30
    Percentile9b510c4e3c2fc9DiffSignificant (?)
    p10822 ±24 μs824 ±15 μs+1.38 μs (+0.2%)NO
    p25860 ±24 μs859 ±17 μs-813 ns (-0.1%)NO
    p50929 ±22 μs938 ±23 μs+9.02 μs (+1.0%)NO
    p751.17 ±0.07 ms1.19 ±0.1 ms+15.6 μs (+1.3%)NO
    p901.63 ±0.2 ms1.69 ±0.2 ms+59.7 μs (+3.7%)NO

    20 test runs in comparison
    CommitTest Runs
    9b510c4
    • 2025-06-20_21:43:51.650907_CVMu
    • 2025-06-20_21:43:51.650950_tHuJ
    • 2025-06-20_21:43:51.650959_wNNT
    • 2025-06-20_21:43:51.650967_kXiu
    • 2025-06-20_21:43:51.650974_XEbc
    • 2025-06-20_21:43:51.650981_xOlN
    • 2025-06-20_21:43:51.650989_cSfz
    • 2025-06-20_21:43:51.650996_uMIs
    • 2025-06-20_21:43:51.651003_ihVf
    • 2025-06-20_21:43:51.651010_SzXi
    e3c2fc9
    • 2025-06-20_23:33:29.026862_PiWK
    • 2025-06-20_23:33:29.026903_eccD
    • 2025-06-20_23:33:29.026914_fntS
    • 2025-06-20_23:33:29.026923_jkmM
    • 2025-06-20_23:33:29.026930_lOmI
    • 2025-06-20_23:33:29.026937_lKfQ
    • 2025-06-20_23:33:29.026944_VsYm
    • 2025-06-20_23:33:29.026951_gXrh
    • 2025-06-20_23:33:29.026957_Sksk
    • 2025-06-20_23:33:29.026963_PPkz
  • Firebase

    DeviceStatisticsDistributions
    oriole-32
    Percentile9b510c4e3c2fc9DiffSignificant (?)
    p105.39 ±0.1 ms5.31 ±0.1 ms-80.2 μs (-1.5%)NO
    p255.63 ±0.1 ms5.53 ±0.1 ms-103 μs (-1.8%)NO
    p506.02 ±0.2 ms5.95 ±0.1 ms-74.3 μs (-1.2%)NO
    p756.61 ±0.2 ms6.56 ±0.2 ms-56.8 μs (-0.9%)NO
    p907.22 ±0.4 ms7.27 ±0.2 ms+50.3 μs (+0.7%)NO

    20 test runs in comparison
    CommitTest Runs
    9b510c4
    • 2025-06-20_21:43:51.650907_CVMu
    • 2025-06-20_21:43:51.650950_tHuJ
    • 2025-06-20_21:43:51.650959_wNNT
    • 2025-06-20_21:43:51.650967_kXiu
    • 2025-06-20_21:43:51.650974_XEbc
    • 2025-06-20_21:43:51.650981_xOlN
    • 2025-06-20_21:43:51.650989_cSfz
    • 2025-06-20_21:43:51.650996_uMIs
    • 2025-06-20_21:43:51.651003_ihVf
    • 2025-06-20_21:43:51.651010_SzXi
    e3c2fc9
    • 2025-06-20_23:33:29.026862_PiWK
    • 2025-06-20_23:33:29.026903_eccD
    • 2025-06-20_23:33:29.026914_fntS
    • 2025-06-20_23:33:29.026923_jkmM
    • 2025-06-20_23:33:29.026930_lOmI
    • 2025-06-20_23:33:29.026937_lKfQ
    • 2025-06-20_23:33:29.026944_VsYm
    • 2025-06-20_23:33:29.026951_gXrh
    • 2025-06-20_23:33:29.026957_Sksk
    • 2025-06-20_23:33:29.026963_PPkz
    redfin-30
    Percentile9b510c4e3c2fc9DiffSignificant (?)
    p108.57 ±0.4 ms8.37 ±0.2 ms-192 μs (-2.2%)NO
    p258.81 ±0.4 ms8.64 ±0.2 ms-172 μs (-2.0%)NO
    p509.28 ±0.4 ms9.13 ±0.2 ms-147 μs (-1.6%)NO
    p7510.0 ±0.4 ms9.96 ±0.4 ms-54.7 μs (-0.5%)NO
    p9011.3 ±0.4 ms11.3 ±0.8 ms-19.7 μs (-0.2%)NO

    20 test runs in comparison
    CommitTest Runs
    9b510c4
    • 2025-06-20_21:43:51.650907_CVMu
    • 2025-06-20_21:43:51.650950_tHuJ
    • 2025-06-20_21:43:51.650959_wNNT
    • 2025-06-20_21:43:51.650967_kXiu
    • 2025-06-20_21:43:51.650974_XEbc
    • 2025-06-20_21:43:51.650981_xOlN
    • 2025-06-20_21:43:51.650989_cSfz
    • 2025-06-20_21:43:51.650996_uMIs
    • 2025-06-20_21:43:51.651003_ihVf
    • 2025-06-20_21:43:51.651010_SzXi
    e3c2fc9
    • 2025-06-20_23:33:29.026862_PiWK
    • 2025-06-20_23:33:29.026903_eccD
    • 2025-06-20_23:33:29.026914_fntS
    • 2025-06-20_23:33:29.026923_jkmM
    • 2025-06-20_23:33:29.026930_lOmI
    • 2025-06-20_23:33:29.026937_lKfQ
    • 2025-06-20_23:33:29.026944_VsYm
    • 2025-06-20_23:33:29.026951_gXrh
    • 2025-06-20_23:33:29.026957_Sksk
    • 2025-06-20_23:33:29.026963_PPkz
  • Runtime

    DeviceStatisticsDistributions
    oriole-32
    Percentile9b510c4e3c2fc9DiffSignificant (?)
    p104.29 ±0.08 ms4.24 ±0.09 ms-51.4 μs (-1.2%)NO
    p254.44 ±0.1 ms4.38 ±0.1 ms-60.7 μs (-1.4%)NO
    p504.71 ±0.2 ms4.65 ±0.1 ms-67.8 μs (-1.4%)NO
    p755.15 ±0.2 ms5.12 ±0.1 ms-31.9 μs (-0.6%)NO
    p905.68 ±0.3 ms5.74 ±0.2 ms+67.5 μs (+1.2%)NO

    20 test runs in comparison
    CommitTest Runs
    9b510c4
    • 2025-06-20_21:43:51.650907_CVMu
    • 2025-06-20_21:43:51.650950_tHuJ
    • 2025-06-20_21:43:51.650959_wNNT
    • 2025-06-20_21:43:51.650967_kXiu
    • 2025-06-20_21:43:51.650974_XEbc
    • 2025-06-20_21:43:51.650981_xOlN
    • 2025-06-20_21:43:51.650989_cSfz
    • 2025-06-20_21:43:51.650996_uMIs
    • 2025-06-20_21:43:51.651003_ihVf
    • 2025-06-20_21:43:51.651010_SzXi
    e3c2fc9
    • 2025-06-20_23:33:29.026862_PiWK
    • 2025-06-20_23:33:29.026903_eccD
    • 2025-06-20_23:33:29.026914_fntS
    • 2025-06-20_23:33:29.026923_jkmM
    • 2025-06-20_23:33:29.026930_lOmI
    • 2025-06-20_23:33:29.026937_lKfQ
    • 2025-06-20_23:33:29.026944_VsYm
    • 2025-06-20_23:33:29.026951_gXrh
    • 2025-06-20_23:33:29.026957_Sksk
    • 2025-06-20_23:33:29.026963_PPkz
    redfin-30
    Percentile9b510c4e3c2fc9DiffSignificant (?)
    p107.55 ±0.3 ms7.40 ±0.2 ms-153 μs (-2.0%)NO
    p257.79 ±0.4 ms7.63 ±0.2 ms-160 μs (-2.1%)NO
    p508.15 ±0.4 ms7.99 ±0.2 ms-164 μs (-2.0%)NO
    p758.70 ±0.4 ms8.60 ±0.4 ms-101 μs (-1.2%)NO
    p909.57 ±0.5 ms9.53 ±0.7 ms-32.8 μs (-0.3%)NO

    20 test runs in comparison
    CommitTest Runs
    9b510c4
    • 2025-06-20_21:43:51.650907_CVMu
    • 2025-06-20_21:43:51.650950_tHuJ
    • 2025-06-20_21:43:51.650959_wNNT
    • 2025-06-20_21:43:51.650967_kXiu
    • 2025-06-20_21:43:51.650974_XEbc
    • 2025-06-20_21:43:51.650981_xOlN
    • 2025-06-20_21:43:51.650989_cSfz
    • 2025-06-20_21:43:51.650996_uMIs
    • 2025-06-20_21:43:51.651003_ihVf
    • 2025-06-20_21:43:51.651010_SzXi
    e3c2fc9
    • 2025-06-20_23:33:29.026862_PiWK
    • 2025-06-20_23:33:29.026903_eccD
    • 2025-06-20_23:33:29.026914_fntS
    • 2025-06-20_23:33:29.026923_jkmM
    • 2025-06-20_23:33:29.026930_lOmI
    • 2025-06-20_23:33:29.026937_lKfQ
    • 2025-06-20_23:33:29.026944_VsYm
    • 2025-06-20_23:33:29.026951_gXrh
    • 2025-06-20_23:33:29.026957_Sksk
    • 2025-06-20_23:33:29.026963_PPkz
  • timeToInitialDisplay

    DeviceStatisticsDistributions
    oriole-32
    Percentile9b510c4e3c2fc9DiffSignificant (?)
    p10198 ±4 ms200 ±4 ms+1.92 ms (+1.0%)NO
    p25203 ±3 ms205 ±3 ms+2.53 ms (+1.2%)NO
    p50209 ±4 ms212 ±3 ms+3.51 ms (+1.7%)NO
    p75216 ±4 ms220 ±3 ms+3.49 ms (+1.6%)NO
    p90225 ±5 ms229 ±4 ms+4.00 ms (+1.8%)NO

    20 test runs in comparison
    CommitTest Runs
    9b510c4
    • 2025-06-20_21:43:51.650907_CVMu
    • 2025-06-20_21:43:51.650950_tHuJ
    • 2025-06-20_21:43:51.650959_wNNT
    • 2025-06-20_21:43:51.650967_kXiu
    • 2025-06-20_21:43:51.650974_XEbc
    • 2025-06-20_21:43:51.650981_xOlN
    • 2025-06-20_21:43:51.650989_cSfz
    • 2025-06-20_21:43:51.650996_uMIs
    • 2025-06-20_21:43:51.651003_ihVf
    • 2025-06-20_21:43:51.651010_SzXi
    e3c2fc9
    • 2025-06-20_23:33:29.026862_PiWK
    • 2025-06-20_23:33:29.026903_eccD
    • 2025-06-20_23:33:29.026914_fntS
    • 2025-06-20_23:33:29.026923_jkmM
    • 2025-06-20_23:33:29.026930_lOmI
    • 2025-06-20_23:33:29.026937_lKfQ
    • 2025-06-20_23:33:29.026944_VsYm
    • 2025-06-20_23:33:29.026951_gXrh
    • 2025-06-20_23:33:29.026957_Sksk
    • 2025-06-20_23:33:29.026963_PPkz
    redfin-30
    Percentile9b510c4e3c2fc9DiffSignificant (?)
    p10225 ±7 ms248 ±2 ms+22.5 ms (+10.0%)MAYBE
    p25232 ±7 ms254 ±4 ms+22.4 ms (+9.7%)MAYBE
    p50239 ±9 ms262 ±4 ms+22.1 ms (+9.2%)NO
    p75249 ±12 ms271 ±4 ms+21.5 ms (+8.6%)NO
    p90260 ±15 ms283 ±5 ms+23.0 ms (+8.9%)NO

    20 test runs in comparison
    CommitTest Runs
    9b510c4
    • 2025-06-20_21:43:51.650907_CVMu
    • 2025-06-20_21:43:51.650950_tHuJ
    • 2025-06-20_21:43:51.650959_wNNT
    • 2025-06-20_21:43:51.650967_kXiu
    • 2025-06-20_21:43:51.650974_XEbc
    • 2025-06-20_21:43:51.650981_xOlN
    • 2025-06-20_21:43:51.650989_cSfz
    • 2025-06-20_21:43:51.650996_uMIs
    • 2025-06-20_21:43:51.651003_ihVf
    • 2025-06-20_21:43:51.651010_SzXi
    e3c2fc9
    • 2025-06-20_23:33:29.026862_PiWK
    • 2025-06-20_23:33:29.026903_eccD
    • 2025-06-20_23:33:29.026914_fntS
    • 2025-06-20_23:33:29.026923_jkmM
    • 2025-06-20_23:33:29.026930_lOmI
    • 2025-06-20_23:33:29.026937_lKfQ
    • 2025-06-20_23:33:29.026944_VsYm
    • 2025-06-20_23:33:29.026951_gXrh
    • 2025-06-20_23:33:29.026957_Sksk
    • 2025-06-20_23:33:29.026963_PPkz

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants