feat(onboarding): deep-link battery step nearer the per-app background-activity screen (best-effort) #173

Merged
JMR-dev merged 8 commits from feat-150-battery-deeplink into main 2026-07-03 00:55:54 +00:00
8 Commits
Author SHA1 Message Date
Jason Ross 73f69c5326 Merge main into feat-150-battery-deeplink 2026-07-02 19:44:32 -05:00
Jason Ross 96fb91ce8c Merge main into feat-150-battery-deeplink 2026-07-02 19:33:13 -05:00
Jason Ross 52d99d2bf9 Merge main into feat-150-battery-deeplink 2026-07-02 19:21:15 -05:00
Jason Ross 036df6b2fe Merge main into feat-150-battery-deeplink 2026-07-02 19:09:00 -05:00
Jason Ross 4b61c5f875 Merge branch 'main' into feat-150-battery-deeplink 2026-07-02 18:48:12 -05:00
Jason Ross 6490e5e461 Merge branch 'main' into feat-150-battery-deeplink 2026-07-02 18:37:23 -05:00
github-actions[bot] 8230eae962 Merge main into feat-150-battery-deeplink 2026-07-02 22:25:51 +00:00
JMR-devandClaude Opus 4.8 01841e9faf feat(onboarding): deep-link battery step nearer the per-app background-activity screen (best-effort)
Spiked #150 against the AOSP Settings source (not just the reference docs): no
public, non-hidden Settings action opens the "Unrestricted/Optimized/Restricted"
screen directly for a specific package. ACTION_VIEW_ADVANCED_POWER_USAGE_DETAIL
would, but it's @hide/non-SDK; the other public battery action,
ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS, isn't package-scoped and is a worse
landing for one known app. So ACTION_APPLICATION_DETAILS_SETTINGS (one tap from
the target via "Battery" on stock/Pixel/AOSP) stays the primary target.

BatteryOptimizationManager.settingsIntent() is restructured into a verified,
never-dead-end fallback chain: try app-details, and if it doesn't resolve on
some device, fall back to the battery-optimization list rather than nothing.
The ordering/selection logic is extracted into a small Android-free helper so
it's directly unit-testable; a new instrumented test checks the real candidate
intents/order against a real PackageManager.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-02 17:19:42 -05:00