Skip to content

In-app update check, Play-safe by design - #24

Merged
GothwadTech merged 1 commit into
mainfrom
feat/updater
Dec 2, 2026
Merged

GothwadTech merged 1 commit into
mainfrom
feat/updater

Conversation

@GothwadTech

@GothwadTech GothwadTech commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

Settings > About now has a working Check for updates row.

The policy constraint drives the design

Google Play's Device and Network Abuse policy: "An app distributed via Google Play may not modify, replace, or update itself using any method other than Google Play's update mechanism."

So the row does one of two things, decided at runtime by the install source:

Installed from What the button does
Google Play (com.android.vending) Opens the Play listing. No APK is ever downloaded.
Sideload / GitHub / website Downloads the release APK, verifies it, installs it

No build flavour is needed: a Play install can never reach the self-install path, so the Play-distributed build cannot violate the policy.

The sideload path trusts nothing

  1. Signature match — the APK's signing certificate must equal the running app's certificate byte for byte (UpdateInstaller.verifySignature). A mismatch deletes the file and reports it.
  2. versionCode — must be newer than the installed build.
  3. Checksum — if the release publishes a .apk.sha256 asset, the download is verified against it.

A file that fails any check is deleted, never handed to the installer.

Also in here

  • UpdateChecker reads the GitHub releases feed; dotted versions compare numerically, so 1.0.99 is correctly older than 1.0.100 (5 unit tests).
  • Unknown-sources permission goes through the proper per-app screen (ACTION_MANAGE_UNKNOWN_APP_SOURCES).
  • The About screen shows the real version name — it was hardcoded to 1.0.0 before.
  • REQUEST_INSTALL_PACKAGES is declared, with a comment explaining it exists only for the sideload path.

Honest limits

  • Play In-App Updates API (PlayCore) is not used; the Play path opens the listing instead. That is simpler and needs no extra dependency, but the update is not "in-app" for Play users.
  • If a sideloaded build has a higher versionCode than the Play build, Play cannot update it until Play's version code catches up. Keep the Play version ahead.
  • The red "Automatic Dependency Submission (Gradle)" check is a GitHub-managed workflow (no file in this repo). It runs Gradle without the Android SDK and fails at configuration. It cannot be fixed from code; it is switched off in Settings > Code security > Dependency graph.

Summary by CodeRabbit

  • New Features
    • Added update controls to the About screen, including version information, update checks, download progress, and installation actions.
    • Play-installed builds open the app’s Play listing. Other builds can download and install verified updates; installation may require enabling permission in Android settings.
  • Documentation
    • Documented how updates work for Play and sideloaded installations.

Settings > About now has a real "Check for updates" row.

- UpdateChecker reads the GitHub releases feed and compares dotted versions numerically
  (1.0.99 < 1.0.100), so the check works without any account or API key
- The action depends on the install source, which is the only compliant design:
  * installed from Google Play -> opens the Play listing, no APK is downloaded
    (Play's Device and Network Abuse policy forbids self-updating a Play-distributed app)
  * sideloaded -> downloads the release APK and installs it
- The sideload path verifies before it trusts anything: signing certificate must match the
  running app, versionCode must be newer, and a published .apk.sha256 is checked when present.
  A file that fails any check is deleted, never offered to the installer
- Unknown-sources permission is requested through the proper per-app settings screen
- The About screen now shows the real version name instead of the hardcoded 1.0.0
- 5 unit tests for the version comparison
@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

Walkthrough

Changes

This change adds update checking and APK installation for sideloaded builds, while Play-installed builds open the Play listing. The About settings screen displays the app version, update state, and available update actions.

Update management

Layer / File(s) Summary
Release metadata and version checks
app/src/main/java/com/bansify/browser/updater/UpdateModels.kt, app/src/main/java/com/bansify/browser/updater/UpdateChecker.kt, app/src/test/java/com/bansify/browser/UpdateCheckerTest.kt
Adds release and update-state models, fetches the latest GitHub release, compares versions, and tests version comparison behavior.
Download and install update flow
app/src/main/AndroidManifest.xml, app/src/main/java/com/bansify/browser/updater/UpdateInstaller.kt, app/src/main/java/com/bansify/browser/viewmodel/BrowserViewModel.kt, docs/ARCHITECTURE.md
Adds update download, APK and version verification, permission checks, and installer actions. The view model manages update state and routes Play-installed builds to the Play listing. The manifest declares install-package permission, and the architecture documentation describes the update paths.
Update controls in About settings
app/src/main/java/com/bansify/browser/ui/BrowserApp.kt, app/src/main/java/com/bansify/browser/ui/screens/SettingsScreen.kt, app/src/main/java/com/bansify/browser/ui/screens/SettingsSubScreens.kt
Passes update state and actions to settings. The About screen displays the app version and state-specific update text and actions.

Change: Feature

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@GothwadTech
GothwadTech merged commit 56a6be3 into main Dec 2, 2026
3 of 5 checks passed
@GothwadTech
GothwadTech deleted the feat/updater branch December 2, 2026 13:08
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.

1 participant