mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-27 07:58:01 +01:00
| Filename | Latest commit message | Latest commit date |
|---|---|---|
On Android 16 (API 36) the update download, a plain HTTPS read on the
updater's own thread, was cut off about 5 s after the person left Hex
Preview, and the Home card then said "The download stopped..." with Try
again. API 31 was unaffected.
What changed (src/preview only; the Play builds and src/main are unchanged):
- Android 14+ (API 34): the tap on Update (or Download after the mobile-data
note, or Try again) schedules a user-initiated data transfer job
(UpdateJob: setUserInitiated, NETWORK_TYPE_ANY, the APK's size as its
estimated bytes, the release in its extras). The job posts its
notification first thing, then runs the same download and checks as
before on the updater's worker (Channel.download's host allow-list, size
and SHA-256, then Channel.verify's package, build and signing-key checks,
untouched), updating the Home card and the notification's progress.
onStopJob ends the download at its next read, which deletes the partial
file and shows the same "download stopped" card; it is not rescheduled.
With no network at all, or if Android refuses the job, the download runs
in-process as before.
- When the job's download is checked: if Hex Preview's window shows, it
installs exactly as before. If not, nothing installs from the background:
the verified file stays, a notification says "Hex Preview <version> is
downloaded" / "Open Hex Preview to install it.", and the Home card shows
Install (kept across a restart of the process while the file is still
there). Install checks the file's size, SHA-256 and signing key again
before the installer session; if Android cleared it from the cache, it
downloads again (asking first on mobile data). Nothing installs without
the person's tap.
- Below Android 14 the in-process download is unchanged (the same code,
moved into Updates.fetch, which both paths share).
New permission (preview manifest only): android.permission.RUN_USER_INITIATED_JOBS,
plus the UpdateJob service guarded by BIND_JOB_SERVICE (not exported). No
POST_NOTIFICATIONS is declared or asked for, so there is no new prompt.
What the person sees: the Home card's progress as before, and Android's
running-apps list (Task Manager) shows Hex Preview while the job runs. The
notification ("Downloading Hex Preview <version>" with progress, in a
low-importance "Updates" channel; tapping opens Hex Preview) appears in the
notification shade only where Hex Preview may post notifications, which by
default it can't on Android 13+.
Verified on the Mac Studio: :app:testDebugUnitTest passes;
:app:assemblePreview -PhexPreviewBuild=2300 builds (lintVital included);
aapt2 dump badging shows ly.anoma.hex.preview, versionCode 2300, label
"Hex Preview"; aapt2 dump permissions lists RUN_USER_INITIATED_JOBS; the
manifest has the UpdateJob service with BIND_JOB_SERVICE; apksigner verify
passes with certificate SHA-256 133568f6...35d98e. Not yet run on a phone
or emulator.
|
||
| .. | ||
| src | ||
| build.gradle.kts | ||
| proguard-rules.pro | ||