You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(update): add opt-in in-app updates with delta packages and redesign About - #766
NeriPlayer has no way to tell users about new builds; they have to watch GitHub Releases by hand. This PR adds an opt-in in-app updater with delta downloads and redesigns the About page around it.
Updates (Settings → About → App updates)
Three channels: Release (releases/latest), Nightly (newest nightly-* prerelease) and CI (a new rolling ci-build prerelease). Choosing Nightly or CI shows a risk warning first; switching back to Release does not.
Manual check, channel and delta updates are always available. Check automatically is off by default and can be turned on in onboarding (Permissions step) or on the page. It only checks Release, at most once every 6 hours at launch, and prompts with the changelog highlights; a version can be skipped.
A build is newer when its build_uuid differs and its build_timestamp is later, so nothing is ever downgraded. The APK is picked by the installed package's ABI.
Install goes through a PackageInstaller session with setAppPackageName, so the system always shows its confirmation and refuses a package with another name. There is no pre-check of "install unknown apps": on Android 17 the default "Ask every time" mode reports canRequestPackageInstalls() == false although the system installer would ask anyway.
Delta updates (NPDELTA1)
.github/scripts/apk_delta.py inflates the deflated entries of both APKs, diffs the inflated content with bsdiff, and records the zlib level that reproduces each entry. The device patches, deflates those entries again at the same level, and accepts the result only if its SHA-256 matches the release metadata; otherwise it downloads the full APK.
Measured on NeriPlayer-693842c8.11262018 → NeriPlayer-91b1379e.11281532 (arm64): 5.3 MB patch vs 15.8 MB APK. Python, JDK and the Android 17 arm64 platform Deflater all reproduced the dex entries byte for byte, and the Kotlin patcher rebuilt the official APK with SHA-256 788f182b….
Release tooling
manual_release.yml builds patches against the previous build of the same channel and replays each one before upload. A failed patch step never blocks the release.
android_ci.yml gets publish-ci-channel: after every gate passes on a master push, it uploads the APK and patches, overwrites the metadata last, moves the ci-build tag and removes stale assets. Actions artifacts cannot be downloaded without a login, which is why the CI channel needs a release.
About page
Brand hero (adaptive launcher icon, theme glow, version/build-type/ABI chips), an App updates entry with live status, build info (version with the 7-tap developer mode, build UUID, build time), project links and a footer. Works in Material and Clean, light and dark.
App updates is a second-level page of About (backTargetPage), so back and predictive back return to About.
Risks and compatibility
New permission REQUEST_INSTALL_PACKAGES and a non-exported AppUpdateInstallReceiver.
New settings keys app_update_check_enabled (default false), app_update_channel (default release) and app_update_delta_enabled (default true); last-check time and skipped build stay in a separate local DataStore and are not exported.
The first master push after merge creates the public ci-build prerelease. CI only builds arm64-v8a, so other ABIs see "no package for this device" on that channel.
The privacy notice gets one bullet about update checks and its date moves to 2026-11-29.
Debug builds cannot install release APKs (different package); the session fails with the install error, by design.
类型 / Type
Bug 修复 / Bug fix
新功能 / New feature
文档更新 / Documentation update
其他(请描述)/ Other (please describe): release and CI workflows publish delta patches and the ci-build channel
修复或解决的问题 / Issues fixed or closed by this PR
None (no tracking issue).
清单 / Checklist
我已阅读并遵循贡献指南 / I have read and followed the contribution guidelines
我已在本地测试这些更改 / I have tested these changes locally
我已运行必要的构建、测试或静态检查 / I have run the required build, tests, or static checks
我已更新相关文档或注释(如适用)/ I have updated relevant documentation or comments (if applicable)
本次更改没有破坏原有行为 / This change does not break existing behavior
本次更改向下兼容(如适用)/ This change is backward compatible (if applicable)
没有提交密钥、Token 或其他敏感信息 / No secrets, tokens, or other sensitive information are committed
UI 变更已附截图或录屏(如适用)/ UI changes include screenshots or recordings (if applicable)
其他信息 / Additional information
How it was tested (macOS, local):
python3 -B -m unittest discover -s .github/scripts -p 'test_*.py': 79 tests pass, including the new test_apk_delta.py. The new workflow shell steps pass bash -n, and the publish-ci-channel step was dry-run against a fake gh for both the first-create and update paths. actionlint was not run locally.
New JVM tests cover the patcher (fixtures produced by apk_delta.py), resolver, GitHub source (MockWebServer), downloader with delta fallback, manager state machine, notes parsing, settings wiring and Compose UI for the status card, channel warning and onboarding card.
verifyModularization passes (all owned JVM tests, CRAP, domain dependencies, lint). After the last changes, the update, settings, onboarding and architecture tests (600) and :app:lintDebug were rerun and pass. The new core/update code is not added to the CRAP scope.
Pixel_10_Pro_XL emulator (API 37) with a debug build stamped older than the latest release: startup prompt, download and SHA-256 check of the 16 MB APK, Nightly and CI checks, channel warning, settings search, About → App updates → back. The install step ends with the expected package-name rejection on a debug build.
A release build signed with the release key was installed over an existing release on a OnePlus PLK110 (Android 17). A full self-update install was not exercised: every published build is older than the build on that phone. It needs the first ci-build or Nightly after merge.
Screenshots (emulator, Clean dark) will be attached in a comment, so the screenshot box is left unchecked for now.
Add .github/scripts/apk_delta.py, which builds NPDELTA1 patches: it inflates
deflated APK entries, diffs them with bsdiff, and records the zlib level
that reproduces each entry so the device can rebuild the signed APK byte
for byte. Every patch is replayed and checked against the target SHA-256
before it is published.
- manual_release.yml builds patches against the previous build of the
same channel (latest Release, or the Nightly that is about to be pruned).
A failed patch step never blocks the release.
- android_ci.yml gets publish-ci-channel: after every gate passes on a
master push it syncs the APK, patches and metadata to the rolling
ci-build prerelease, because Actions artifacts need a login to download.
Settings → About → App updates checks GitHub Releases on three channels:
Release, Nightly and CI (the rolling ci-build prerelease). Manual checks,
the channel picker and delta updates are always available. Automatic
checks are off by default, can be turned on during setup or on that page,
and only prompt at launch for Release builds that were not skipped.
Switching to Nightly or CI asks for confirmation first.
- core/update resolves the newest build by build UUID and timestamp,
prefers a delta patch that matches the installed APK, verifies every
file with SHA-256, falls back to the full APK, and installs through a
PackageInstaller session so the system always confirms.
- The About page gets a brand hero, an update entry, build info and
project links. App updates is nested under About so back returns there.
- The privacy notice, READMEs and contributing guides describe the new
behaviour and the release tooling.
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
- Cancel an in-flight check when the channel changes, and drop a result
whose channel is no longer selected.
- Skip the startup cleanup while a download or install is running, so an
Activity recreation no longer deletes the partial file or patch work dir.
- Download through awaitResponse so cancelling closes the socket at once
instead of waiting for a blocked read.
- A 404 for a package drops the offer, and a failed download offers a
fresh check next to Retry, so a superseded CI or Nightly build is not
requested again and again.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
Until the rolling ci-build prerelease exists, the CI channel reads the
latest successful Android CI run on master whose neri-apk artifact has not
expired. A run from the installed commit, or one that started before this
build, counts as up to date; a newer run is shown as a new CI build with a
link to the run, because Actions artifacts need a GitHub login.
- Tag each check with a generation so a cancelled or superseded check can
no longer overwrite a newer result, and share a file lock between
downloads and the startup cleanup.
- Report progress while expanding the base APK so cancellation is
noticed there too, end the Inflater behind each patch stream, and make
the patch range checks overflow-safe.
- Cache the installed APK digest only after a successful read.
- Keep the release page next to Retry and Check for updates on failure.
- Shorten the up-to-date title, move "newer than this channel" into the
detail line, split the subtitle into two lines and show the last check
as a clock time instead of a relative time that went stale.
- publish-ci-channel skips a build older than the one ci-build already
serves, since serial publishing does not keep commit order.
Addressed the grouped CodeRabbit findings in 1dd3223 and 5fe6eeb:
Installed APK digest: only a successful read is cached now.
OkHttp cancellation: downloads go through awaitResponse, so cancelling closes the call immediately (1dd3223).
Base APK expansion: progress is reported per entry, so cancellation is noticed during expansion.
openStream: the Inflater is ended when its stream closes.
Patch range checks: the offset is checked against the bound first and lengths are compared by subtraction, so Long overflow can't pass parsing (new malformed-header case).
Channel switch during a check: checks carry a generation; discardResult invalidates it and a late result is dropped, including the startup path (1dd3223, 5fe6eeb).
Old check overwriting a new result after cancel: covered by the same generation guard, with a regression test.
Startup cleanup vs. a new download: both share a Mutex; cleanup only runs if it can take the lock.
"Last checked" time: shown as a clock time instead of a relative time.
Failed card: the release page button stays next to Retry and Check for updates.
publish-ci-channel: skips a build older than the one ci-build already serves.
Cancel test: waits for the first progress event before cancelling and times only the cancellation.
…ckage
An arm64 device running the armeabi-v7a APK only searched for armeabi-v7a
packages, so the arm64-only CI build was reported as incompatible. The
installed ABI still comes first; the device's other ABIs follow.
awaitResponse returned as soon as the coroutine was cancelled while the
OkHttp callback could still be writing, so the partial file and file lock
were released early and a late progress callback set the state back to
Downloading. The socket is still cancelled at once, but the download now
waits for the writer to exit, and progress from a cancelled job is dropped.
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
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.
描述 / Description
NeriPlayer has no way to tell users about new builds; they have to watch GitHub Releases by hand. This PR adds an opt-in in-app updater with delta downloads and redesigns the About page around it.
Updates (Settings → About → App updates)
releases/latest), Nightly (newestnightly-*prerelease) and CI (a new rollingci-buildprerelease). Choosing Nightly or CI shows a risk warning first; switching back to Release does not.build_uuiddiffers and itsbuild_timestampis later, so nothing is ever downgraded. The APK is picked by the installed package's ABI.PackageInstallersession withsetAppPackageName, so the system always shows its confirmation and refuses a package with another name. There is no pre-check of "install unknown apps": on Android 17 the default "Ask every time" mode reportscanRequestPackageInstalls() == falsealthough the system installer would ask anyway.Delta updates (NPDELTA1)
.github/scripts/apk_delta.pyinflates the deflated entries of both APKs, diffs the inflated content withbsdiff, and records the zlib level that reproduces each entry. The device patches, deflates those entries again at the same level, and accepts the result only if its SHA-256 matches the release metadata; otherwise it downloads the full APK.NeriPlayer-693842c8.11262018→NeriPlayer-91b1379e.11281532(arm64): 5.3 MB patch vs 15.8 MB APK. Python, JDK and the Android 17 arm64 platformDeflaterall reproduced the dex entries byte for byte, and the Kotlin patcher rebuilt the official APK with SHA-256788f182b….Release tooling
manual_release.ymlbuilds patches against the previous build of the same channel and replays each one before upload. A failed patch step never blocks the release.android_ci.ymlgetspublish-ci-channel: after every gate passes on a master push, it uploads the APK and patches, overwrites the metadata last, moves theci-buildtag and removes stale assets. Actions artifacts cannot be downloaded without a login, which is why the CI channel needs a release.About page
backTargetPage), so back and predictive back return to About.Risks and compatibility
REQUEST_INSTALL_PACKAGESand a non-exportedAppUpdateInstallReceiver.app_update_check_enabled(defaultfalse),app_update_channel(defaultrelease) andapp_update_delta_enabled(defaulttrue); last-check time and skipped build stay in a separate local DataStore and are not exported.ci-buildprerelease. CI only buildsarm64-v8a, so other ABIs see "no package for this device" on that channel.类型 / Type
ci-buildchannel修复或解决的问题 / Issues fixed or closed by this PR
None (no tracking issue).
清单 / Checklist
其他信息 / Additional information
How it was tested (macOS, local):
python3 -B -m unittest discover -s .github/scripts -p 'test_*.py': 79 tests pass, including the newtest_apk_delta.py. The new workflow shell steps passbash -n, and thepublish-ci-channelstep was dry-run against a fakeghfor both the first-create and update paths. actionlint was not run locally.apk_delta.py), resolver, GitHub source (MockWebServer), downloader with delta fallback, manager state machine, notes parsing, settings wiring and Compose UI for the status card, channel warning and onboarding card.verifyModularizationpasses (all owned JVM tests, CRAP, domain dependencies, lint). After the last changes, the update, settings, onboarding and architecture tests (600) and:app:lintDebugwere rerun and pass. The newcore/updatecode is not added to the CRAP scope.Pixel_10_Pro_XLemulator (API 37) with a debug build stamped older than the latest release: startup prompt, download and SHA-256 check of the 16 MB APK, Nightly and CI checks, channel warning, settings search, About → App updates → back. The install step ends with the expected package-name rejection on a debug build.ci-buildor Nightly after merge.Screenshots (emulator, Clean dark) will be attached in a comment, so the screenshot box is left unchecked for now.
🤖 Generated with Claude Code
新增应用内更新,入口为 设置 → 关于 → 应用更新。
REQUEST_INSTALL_PACKAGES权限及不可导出的接收器。apk_delta.py及 CI 发布流程。CI 通道仅提供 arm64-v8a 包。