Repository navigation
Restart tracking after a reboot or an app update - #159
Merged
Merged
Conversation
Add a BOOT_COMPLETED / MY_PACKAGE_REPLACED receiver that starts the tracking service when tracking is on, a car is paired and the Bluetooth and notification permissions are still granted. It reuses BleTrackingService.start, which reconnects the paired cars; a refused start is now logged (no VIN or key). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0129RzhbEE2cboMcYyZMuxqX
Contributor
ScreenshotsCaptured from the demo build at 807473b. Debug APK: zip from Android CI (GitHub sign-in needed) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Tracking only started when the app was opened, so a reboot or an update left it off until then. This adds a manifest-declared receiver for
BOOT_COMPLETEDandMY_PACKAGE_REPLACED(plusRECEIVE_BOOT_COMPLETED). There is no issue for this; the owner approved it directly on 2026-10-08.The receiver starts
BleTrackingServicethrough the existingBleTrackingService.start(context)only when all of these hold:BleControllerHolder.get(context).state);Vehicle.isPaired; the controller already drops key slots with no stored key on load);POST_NOTIFICATIONSare still granted.Otherwise it does nothing. The decision is a pure function,
shouldAutoStartTracking. It deliberately does not useshouldTrack(), which needs a READY connection.TeslaBleController.ktis untouched (#158). The service'sonStartCommandalready callsensureConnected(), so no connection logic is duplicated.BleTrackingService.startalready caughtIllegalStateException(coversForegroundServiceStartNotAllowedException); it now logs the exception class name, with no VIN or key, instead of swallowing it silently.The README gains a short note: tracking resumes after a reboot or update; some phones (Xiaomi, Huawei, Oppo/Vivo, Samsung "sleeping apps") need autostart allowed or battery set to unrestricted; after a force stop nothing restarts until the app is opened. The master plan has a new checked line.
Type
Testing
./gradlew :core:test :app:assembleDebug :app:testDebugUnitTest :app:lintDebug ktlintCheck detektpass locally.AutoStartTestcovers the start decision (all conditions true; each one false in turn).Manual check for the owner:
adb install -r app-debug.apk. The notification should come back without opening the app.Checklist
expected.txtregenerated, not hand-edited (n/a, no protocol change)SPDX-License-Identifier: AGPL-3.0-only🤖 Generated with Claude Code
https://claude.ai/code/session_0129RzhbEE2cboMcYyZMuxqX
Generated by Claude Code