Skip to content

feat: after an update the web page comes back by itself, nothing else (2.27.0) - #289

Merged
compot-dev merged 2 commits into
v2from
feat/update-web-288
Nov 19, 2026
Merged

compot-dev merged 2 commits into
v2from
feat/update-web-288

Conversation

@compot-dev

Copy link
Copy Markdown
Collaborator

Closes #288. The owner's rule (2026-11-19): after an app update the app brings back by itself only what draws no traffic and starts no video — the web page; otherwise nothing.

  • BootReceiver also takes ACTION_MY_PACKAGE_REPLACED (sent only to the updated app; starting a foreground service from it is exempt from the background limits) and calls WebService.startAfterUpdate.
  • WebService: a foreground service (specialUse, with the subtype property; a quiet notification "Web page on port N (updated; open to play)" that opens the app) keeps DebugServer, since a process with only a receiver is cached and may be frozen or killed. It stops when the app's screen resumes. Nothing starts with Settings → Allow remote access off or while the app is open. No camera, no camex tunnel, no activity.
  • A force-stopped app is in the "stopped" state and Android sends it no broadcast, MY_PACKAGE_REPLACED included: then nothing comes back until the app is opened (documented).
  • Permissions FOREGROUND_SERVICE and FOREGROUND_SERVICE_SPECIAL_USE (the camex library declares them too).
  • 2.27.0 (versionCode 63), CHANGELOG, docs/debug.md, docs/testing.md.

Tests (local, Docker):

  • testDebugUnitTest lintDebug assembleDebug: pass, lint 13 warnings as before.
  • tests/e2e.sh installs the same APK over the running app: the page answers on 8085 (through adb forward, with the password), no new camera read, no tun0, no resumed activity. TRANSPORT=TCP API 34: 20 passed; TRANSPORT=TCP API 21: 20 passed; UDP API 34: 19 passed.

… (2.27.0)

The owner's rule (2026-11-19): after an app update bring back only what draws
no traffic and starts no video. BootReceiver also takes MY_PACKAGE_REPLACED and
starts WebService: a foreground service (specialUse, a quiet notification) that
keeps DebugServer until the app's screen opens; no camera, no camex tunnel, no
activity; nothing with Allow remote access off. A force-stopped app gets no
broadcast, so nothing comes back then.

tests/e2e.sh: the same APK installed over the running app: the page answers,
no camera is read, no tunnel, no screen.

Closes #288
@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Restore only the web page after an app update

✨ Enhancement 🧪 Tests 📝 Documentation ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Restore the web page after an update without opening the app, camera, or tunnel.
• Keep the page available until the app opens, only when remote access is allowed.
• Add update-install coverage and document the behavior and force-stop exception.
Merge Risk 🟡 Medium

Blast radius 🟢 Low 💥 1 capability

  • 1 affected end-to-end capability after fault-specific containment; implementation boundaries do not widen its functional scope.
  • The changed receiver, foreground service, DebugServer instance, port-settling callback, and activity handoff all implement one bounded user/system outcome: keeping the decoder's read-only web page reachable across an APK update.
  • Camera playback and camex tunneling are explicitly excluded by the update path and are not separate affected capabilities.
  • The activity's onResume stop is the consumer handoff for this same web-access behavior.
Behavioral complexity 🟡 Medium 🧩 Interacting branches, Coordinated invariants

  • Before: MY_PACKAGE_REPLACED was not handled, so the update path did not coordinate any temporary service with the normal Decoder lifecycle.
  • After: the receiver branches on update versus boot, gates startup on remote-access permission and activity state, starts a foreground service, shares the process-wide DebugServer, refreshes the notification after asynchronous port settlement, and stops the temporary service when Decoder resumes.
  • New correctness condition: across update, service-start, server-port-settlement, remote-access-off, app-open, and failure states, exactly the read-only web page may run after an update, while camera streams, the camex tunnel, and the Decoder screen must remain stopped until the app opens; the handoff must not leave duplicate services or stop unrelated normal-app web behavior.
  • The existing WebPort validation, DebugServer retry, and notification APIs are reused, but their interaction with a new update-service lifecycle creates the changed state/invariant.
Potential damage 🟡 Medium 🩹 Temporary loss

  • The affected end-to-end capability is the post-update local debug web page.
  • A startup or service fault can make that page unavailable until the user opens the app or otherwise restarts the normal application lifecycle.
  • Reverting the APK prevents future faulty update handling but does not itself restore a page already absent on a device; no persistent decoder state or external side effect is introduced by this path.
  • The source supports recovery when the user opens Decoder: onResume stops WebService and starts the normal streams/server lifecycle, but it does not establish unattended repair after a failed service start.
  • Under the equal-importance baseline, loss of this diagnostic/read-only web capability is temporary and recoverable, not a serious integrity or confidentiality failure.
  • Code rollback removes the new update-service path but does not repair a currently unavailable service.
  • Supported recovery is to open the app, which invokes WebService.stop and starts the normal activity lifecycle; if the app is not opened, automatic recovery is not established.
  • Existing server retry behavior may recover a port-bind failure, but service-start and foreground-service admission failures have no demonstrated worker or scheduler repair path.
Assessed commit 750892c
Diagram

graph TD
  Update["App update"] --> Receiver["BootReceiver"] --> Allowed{"Remote access allowed and screen closed?"}
  Allowed -->|yes| Service["WebService foreground"] --> Server["DebugServer HTTP"]
  Allowed -->|no| Idle["Nothing starts"]
  Screen["Decoder resumes"] -->|stops service| Service
Loading
High-Level Assessment

The dedicated foreground service fits the requirement to keep only the existing web server alive after the broadcast. Receiver-only startup would not reliably retain the process; reusing the camera or tunnel lifecycle would restart components the owner explicitly excludes.

Files changed (9) +173 / -4

Enhancement (3) +113 / -0
BootReceiver.javaHandle app updates separately from device boot +5/-0

Handle app updates separately from device boot

• Routes MY_PACKAGE_REPLACED to WebService and returns before the boot path that can open the activity.

android/app/src/main/java/com/openipc/decoder/BootReceiver.java

Decoder.javaStop the update-only service when the app resumes +2/-0

Stop the update-only service when the app resumes

• Stops WebService in onResume so the open app takes over keeping the existing web server process active.

android/app/src/main/java/com/openipc/decoder/Decoder.java

WebService.javaKeep only the web page alive after an update +106/-0

Keep only the web page alive after an update

• Introduces a non-sticky foreground service that starts the existing DebugServer when remote access is allowed and the app is closed. It supplies a low-importance notification that opens the app, without starting video or the tunnel.

android/app/src/main/java/com/openipc/decoder/WebService.java

Tests (1) +28 / -0
e2e.shVerify page-only recovery after reinstall +28/-0

Verify page-only recovery after reinstall

• Reinstalls the same APK, waits for the password-protected page, and checks that camera reads do not increase. Also verifies that no tunnel interface or resumed app activity appears.

tests/e2e.sh

Documentation (3) +13 / -1
CHANGELOG.mdDocument the 2.27.0 update behavior +11/-0

Document the 2.27.0 update behavior

• Records that an update restores only the web page when remote access is allowed. Notes the foreground notification, force-stop exception, and end-to-end coverage.

CHANGELOG.md

debug.mdExplain post-update web-page availability +1/-0

Explain post-update web-page availability

• Documents the notification-backed page, remote-access prerequisite, and Android's force-stop broadcast exception.

docs/debug.md

testing.mdDescribe the expanded emulator checks +1/-1

Describe the expanded emulator checks

• Updates the expected end-to-end check counts and describes the reinstall test for page-only recovery.

docs/testing.md

Other (2) +19 / -3
build.gradleBump the app version to 2.27.0 +2/-2

Bump the app version to 2.27.0

• Increments versionCode from 62 to 63 and versionName from 2.26.0 to 2.27.0.

android/app/build.gradle

AndroidManifest.xmlRegister update delivery and the web foreground service +17/-1

Register update delivery and the web foreground service

• Adds the app-update broadcast to BootReceiver and registers a non-exported special-use foreground service. Declares the foreground-service permissions and subtype.

android/app/src/main/AndroidManifest.xml

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Users see no web-page notification 🐞 Bug ≡ Correctness
Description
WebService starts a foreground service with a notification, but the update path never obtains the
notification permission. On Android 13+ when that permission has not already been granted, the page
can run without its notification appearing in the notification drawer; the existing request runs
only through the tunnel-start path.
Code

android/app/src/main/java/com/openipc/decoder/WebService.java[R65-69]

+        Notification n = notification();
+        if (Build.VERSION.SDK_INT >= 34) {
+            startForeground(NOTIFICATION_ID, n, ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE);
+        } else {
+            startForeground(NOTIFICATION_ID, n);
Evidence
The new service starts directly from the replacement broadcast and posts its only notification
without a permission request. The existing request is conditional on tunnel startup, while the test
harness explicitly grants the permission, masking the ungranted case.

android/app/src/main/java/com/openipc/decoder/BootReceiver.java[65-69]
android/app/src/main/java/com/openipc/decoder/WebService.java[64-70]
android/app/src/main/java/com/openipc/decoder/NetworkPanel.java[244-254]
tests/e2e.sh[186-191]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The update-started web service cannot request notification permission in the background, so users who have not granted it will not see the promised notification in the drawer.
## Fix Focus Areas
- android/app/src/main/java/com/openipc/decoder/WebService.java[64-70]
- android/app/src/main/java/com/openipc/decoder/NetworkPanel.java[244-254]
## Recommended Fix
Request notification permission while the activity is open when remote access is enabled, independently of whether the tunnel is enabled. Account for users who decline it rather than assuming the update path can obtain permission later.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Users get the wrong web-page port ✓ Resolved
Description
WebService.notification() displays WebPort.get(this), the configured port, before DebugServer
attempts to bind and possibly selects a fallback. When another process occupies that port, the
service keeps advertising the occupied port rather than the one serving the page.

3. The update test misses camera starts ✓ Resolved
Description
tests/e2e.sh records before=$(readers) after adb install -r, although readers() counts
historical camera-read log entries. If an update starts camera playback during installation, that
event is already in the baseline and the later comparison can pass without detecting it.

Grey Divider

Tip of the day
💡 Did you know, you can describe a rule in plain language on the Rules page and Qodo drafts it for you

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

…test counts camera reads from before it

WebService.refresh() follows the port the page settles on (taken: the next
free one) and says when none is free; tests/e2e.sh takes the camera reads
before the update, so a camera started by it is counted; docs: the
notification shows where the app may post notifications, the page runs
either way.
@compot-dev

Copy link
Copy Markdown
Collaborator Author

Qodo review on 9aa04e8:

  1. Users see no web-page notification — by design, not fixed: the notification is only a sign of the service; the page runs with or without it. Asking for the notification permission just for it is not worth a prompt (most of these devices are TV boxes, where notifications are barely seen). docs/debug.md now says the notification shows where the app may post notifications and the page runs either way.
  2. Users get the wrong web-page port — fixed: the notification starts as "Web page starting", and WebService.refresh() (called when the page settles its port) shows the port it really got, or why none is free.
  3. The update test misses camera starts — fixed: the camera reads are counted before the update.

Local: build, unit tests, lint (13 as before); e2e TCP API 34 20/20, TCP API 21 20/20.

@compot-dev
compot-dev merged commit 41aeee2 into v2 Nov 19, 2026
7 checks passed
@compot-dev
compot-dev deleted the feat/update-web-288 branch November 19, 2026 10:50
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.

After an app update: bring the web page back, nothing else

1 participant