Skip to content

Optimize isMainProcess detection#3489

Merged
0xnm merged 1 commit into
developfrom
nogorodnikov/optimize-main-process-detection
Jun 1, 2026
Merged

Optimize isMainProcess detection#3489
0xnm merged 1 commit into
developfrom
nogorodnikov/optimize-main-process-detection

Conversation

@0xnm

@0xnm 0xnm commented Jun 1, 2026

Copy link
Copy Markdown
Member

What does this PR do?

A bit of startup optimization which can shave of a few milliseconds: querying for all packages/processes on the device may be expensive, so we just can rely on the fact that the main process has the same name as package name.

See https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/core/java/android/app/Application.java;l=339-345?q=Application.java

    /**
     * Returns the name of the current process. A package's default process name
     * is the same as its package name. Non-default processes will look like
     * "$PACKAGE_NAME:$NAME", where $NAME corresponds to an android:process
     * attribute within AndroidManifest.xml.
     */

On the versions below Android P we can use the old approach.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@0xnm
0xnm requested review from a team as code owners June 1, 2026 11:11
@codecov-commenter

codecov-commenter commented Jun 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.17%. Comparing base (e86e98d) to head (4097301).

Files with missing lines Patch % Lines
...n/com/datadog/android/core/internal/CoreFeature.kt 85.71% 0 Missing and 2 partials ⚠️
...in/com/datadog/android/core/internal/SdkFeature.kt 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3489      +/-   ##
===========================================
- Coverage    72.34%   72.17%   -0.17%     
===========================================
  Files          964      964              
  Lines        35583    35586       +3     
  Branches      5926     5928       +2     
===========================================
- Hits         25742    25684      -58     
- Misses        8249     8288      +39     
- Partials      1592     1614      +22     
Files with missing lines Coverage Δ
...in/com/datadog/android/core/internal/SdkFeature.kt 90.00% <0.00%> (ø)
...n/com/datadog/android/core/internal/CoreFeature.kt 87.09% <85.71%> (+0.11%) ⬆️

... and 33 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@0xnm

0xnm commented Jun 1, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

kikoveiga
kikoveiga previously approved these changes Jun 1, 2026
@0xnm
0xnm force-pushed the nogorodnikov/optimize-main-process-detection branch from 436174c to 4097301 Compare June 1, 2026 12:25
@0xnm
0xnm requested a review from kikoveiga June 1, 2026 12:25
@0xnm
0xnm merged commit cafc384 into develop Jun 1, 2026
27 checks passed
@0xnm
0xnm deleted the nogorodnikov/optimize-main-process-detection branch June 1, 2026 13:16
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.

3 participants