Skip to content

[iOS, macOS] fix screen time watchdog crash and fire pixel when there is data on launch - #6619

Merged
samsymons merged 2 commits into
release/ios/7.236.0from
report-screentime-record-count-on-foreground
Sep 1, 2026
Merged

[iOS, macOS] fix screen time watchdog crash and fire pixel when there is data on launch#6619
samsymons merged 2 commits into
release/ios/7.236.0from
report-screentime-record-count-on-foreground

Conversation

@brindy

@brindy brindy commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Task/Issue URL: https://app.asana.com/1/137249556945/project/414235014887631/task/1216744184761157?focus=true
Tech Design URL:
CC:

Description

Improves Screen Time data cleanup on iOS/macOS 26 by using the dedicated system API while retaining the existing fallback. Adds daily and count telemetry when Screen Time records remain at launch, without reporting record counts or URLs.

Testing Steps

  1. On iOS 26, disable the Screen Time cleaning feature flag.

  2. Launch the app and visit a website.

  3. Background and relaunch the app → screen-time_records-present daily and count pixels are emitted.

  4. Enable the Screen Time cleaning feature flag.

  5. Background the app to trigger cleanup.

  6. Relaunch the app → no Screen Time records pixel is emitted.

  7. Build the iOS Browser scheme → build succeeds.

  8. Smoke test macOS app

Impact

High: A cleanup regression could leave browsing activity visible through Screen Time, affecting user privacy.

What could go wrong?

Screen Time records could remain after cleanup → mitigated by retaining the existing WebKit cleanup as a fallback.

The telemetry could report false positives → mitigated by checking both the dedicated Screen Time API and WebKit data stores.

Quality Considerations

  • The dedicated Screen Time work runs outside the main actor to reduce watchdog risk.
  • The WebKit cross-check remains main-actor isolated as required by the SDK and includes cancellation checks.
  • Telemetry reports only whether records exist. It does not include URLs, record counts, or other browsing information.
  • The change applies only to iOS/macOS 26 and later.

Internal references:

Definition of Done | Engineering Expectations | Tech Design Template


Note

High Risk
Changes the Screen Time cleanup and detection path for privacy-sensitive browsing history; a regression could leave records visible or affect launch-time behavior, though WebKit fallback remains.

Overview
On iOS/macOS 26+, ScreenTimeDataCleaner now tries the Screen Time STWebHistory path first for both detecting and removing browsing history, and only falls back to scanning/removing WKWebsiteDataTypeScreenTime across WebKit data stores when that path is unavailable or fails. Public cleanup/detection APIs are no longer fully @MainActor; WebKit work stays on the main actor with cancellation checks, and the cleaner is marked Sendable.

Launch registers an iOS 26+ startup task that calls hasScreenTimeData() and fires the screen-time_records-present pixel (daily + count) when records still exist—without URLs or counts. A matching pixel definition is added in screen_time.json5.

Reviewed by Cursor Bugbot for commit 83b6e05. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

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.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit de89392. Configure here.

@brindy
brindy requested a review from samsymons September 1, 2026 20:27

@samsymons samsymons left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, worked as expected - thanks!

@samsymons
samsymons merged commit 811876c into release/ios/7.236.0 Sep 1, 2026
58 checks passed
@samsymons
samsymons deleted the report-screentime-record-count-on-foreground branch September 1, 2026 21:39
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