Skip to content

Conversation

@landomen
Copy link
Contributor

@landomen landomen commented Jan 27, 2026

Task/Issue URL: https://app.asana.com/1/137249556945/project/488551667048375/task/1212998192770911?focus=true

Description

Declares the missing FGS permissions and provide foreground service type in startForeground() call.

Steps to test this PR

Smoke test PIR initial scanning

UI changes

No UI changes


Note

Aligns PIR foreground services with Android FGS requirements and adds diagnostics.

  • AndroidManifest: declares FOREGROUND_SERVICE and FOREGROUND_SERVICE_SPECIAL_USE; services use foregroundServiceType="specialUse" with PROPERTY_SPECIAL_USE_FGS_SUBTYPE
  • Foreground services (PirForegroundScanService, PirForegroundOptOutService): switch to ServiceCompat.startForeground with FOREGROUND_SERVICE_TYPE_SPECIAL_USE on SDK >= 34, add try/catch; on failure stop service and, for scans, emit m_dbp_foreground-run_start-failed
  • Telemetry: define new pixels m_dbp_foreground-run_start-failed and m_dbp_foreground-run_low-memory; plumb through PirPixel, PirPixelSender (new reportManualScanStartFailed/LowMemory, enqueueFire), and allowlist in PirPixelInterceptor (adds man param)
  • Memory signals: PirForegroundScanService emits low-memory pixel in onLowMemory
  • Tests updated/added for interceptor and sender to cover new pixels and query params

Written by Cursor Bugbot for commit 8ffc74c. This will update automatically on new commits. Configure here.

android:process=":pir">
<property
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="Executing operations for the Personal Information Removal feature" />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

}

override fun reportManualScanStartFailed() {
enqueueFire(PIR_FOREGROUND_RUN_START_FAILED)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@karlenDimla I've had to use enqueueFire here instead of regular fire because we call stopSelf() right after we fire the pixel and for some reason it's not sent. It seems the service gets destroyed and along with it likely other dependencies.

I've confirmed that with enqueueFire the pixel gets fired on next app launch.

@github-actions
Copy link
Contributor

Privacy Review task: https://app.asana.com/0/69071770703008/1213011073757604

try {
ServiceCompat.startForeground(
this,
1,
Copy link
Contributor

Choose a reason for hiding this comment

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

This has been a placeholder id since the PoC. Is now the best time to replace this? At least let’s assign it to variable.

Copy link
Contributor

@karlenDimla karlenDimla left a comment

Choose a reason for hiding this comment

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

One comment and also pending privacy triage. Works as expected.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants