watch: wake stopped apps for sync and open launches
- Commit
e4a2b827982d5b765db2cb2774b2ced731ac85f6- Author
- Vayun Mathur <[email protected]>
- When
- 2026-12-06 15:51 UTC (1 hour ago)
- Parents
29d7105
ConduitSyncScheduler's sync-trigger broadcast had the same stopped-package hole as the open-on-phone wake: without FLAG_INCLUDE_STOPPED_PACKAGES a never-launched or force-stopped app never receives its manifest sync trigger either. Add the flag. Camera's AndroidPhoneCameraLauncher meanwhile duplicated the shared launcher's plain startActivity, so it inherited the Android 14+ background-launch block; delegate to OpenOnPhoneLauncher so camera gets the PendingIntent BAL grant and duplicate suppression like every other app. Verified: :watch and :camera lint and lintVitalRelease pass; :camera testDevUnitTest passes.
Diff
camera/src/main/java/com/vayunmathur/camera/platform/WearCameraSync.kt
diff --git a/camera/src/main/java/com/vayunmathur/camera/platform/WearCameraSync.kt b/camera/src/main/java/com/vayunmathur/camera/platform/WearCameraSync.ktindex 443ca6c443..1fab4e5761 100644--- a/camera/src/main/java/com/vayunmathur/camera/platform/WearCameraSync.kt+++ b/camera/src/main/java/com/vayunmathur/camera/platform/WearCameraSync.kt@@ -153,11 +153,12 @@ interface PhoneCameraLauncher { /** Launches [MainActivity] as a new task top; the only phone-side launcher for the watch handoff. */ class AndroidPhoneCameraLauncher(private val context: Context) : PhoneCameraLauncher { override fun launchCamera() {- val intent = Intent(context, MainActivity::class.java).apply {- flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP- }- runCatching { context.startActivity(intent) }- .onFailure { Log.status("WearCameraSync", "open-on-phone launch failed: ${it.message}") }+ // Shared launcher: PendingIntent background-start hardening on+ // Android 14+ lives there, not in a camera-local startActivity.+ val launched =+ com.vayunmathur.library.wearlink.conduit.OpenOnPhoneLauncher+ .launch(context, MainActivity::class.java, "")+ if (!launched) Log.status("WearCameraSync", "open-on-phone launch failed") } }
watch/src/main/java/com/vayunmathur/watch/service/ConduitSyncScheduler.kt
diff --git a/watch/src/main/java/com/vayunmathur/watch/service/ConduitSyncScheduler.kt b/watch/src/main/java/com/vayunmathur/watch/service/ConduitSyncScheduler.ktindex 3b163077bb..ece91c1403 100644--- a/watch/src/main/java/com/vayunmathur/watch/service/ConduitSyncScheduler.kt+++ b/watch/src/main/java/com/vayunmathur/watch/service/ConduitSyncScheduler.kt@@ -134,6 +134,9 @@ class ConduitSyncScheduler( val intent = Intent(ConduitSync.ACTION).apply { setPackage(packageName)+ // Wake stopped (never-launched / force-stopped) apps too:+ // without this flag the platform drops the broadcast.+ addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES) putExtra(ConduitSync.EXTRA_APP_ID, appId) } // Only receivers holding the signature permission may receive it.