Repository navigation
ADFA-7239: Apply a new APK's bundled add-ons at start-up - #2300
Draft
davidschachterADFA wants to merge 9 commits into
Draft
davidschachterADFA wants to merge 9 commits into
davidschachterADFA wants to merge 9 commits into
Conversation
When the build's bundle fingerprint differs from the record, or there is no record (a first install cut short), install the whole bundle before plugins load, remove recorded add-ons the new bundle lacks, keep other user add-ons, and rewrite the record last. - BundleSync: the sync. Each bundled plugin replaces every installed build of its ID (a user's or an older bundled one), through a new beforePluginMove hook on BundledAddonInstaller; a template replaces one of the same name; a removed bundled add-on comes back. An I/O error leaves the old record, so the sync runs again at the next start. - BundleSyncAtStart: runs it from CredentialProtectedApplicationLoader before loadPlugins(), only once setup has put a JDK and SDK on disk (areIdeToolsInstalled, from SetupState). A debug build whose assets zip is gone skips the sync rather than treat the bundle as empty. Bundled plugins that fail to load after a sync are recorded for the error bar. - MainActivity waits for the start-up check before reporting failures, and shows a progress bar only while a sync runs. - ARCHITECTURE.md describes the sync. Decisions (ADFA-7239 comment 41492): a missing debug zip is no change; a user's newer build of a bundled plugin stays bundled; the bar shows only while a sync runs. Not compiled or tested in this environment (no Android SDK); BundleSyncTest needs a run. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
`synced && manager != null`: synced is only true when manager is non-null, so the compiler flags the second test (CredentialProtectedApplicationLoader:393). Check the manager once around the sync, load and failure recording. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
- Keep an unchanged bundled plugin's state: a plugin whose bundled build is already the only one installed for its ID is copied over in place, and uninstallPlugin (which clears the enabled flag, crash count and caches) runs only for a real change of build. The hook now gets the target file name, and BundleSync builds the installer itself. - Fail the sync, keeping the old record, when an older build of a bundled ID cannot be deleted, so two builds never load together. - Close the start-up race: the state starts at NOT_STARTED, which the main screen waits through (up to 30 s) as well as CHECKING, so a screen that resumes before the plugin system starts still shows the bar and the report. A plugin system that fails to start ends the wait. - Sync at most once per process, even if a failed start-up is retried. - Record a failed sync for the error bar instead of only logging it. - Tests: an unchanged plugin is not uninstalled; a changed build goes through uninstall; an undeletable old build fails the sync and keeps the record; a sync cut short converges; a missing record removes no user add-on; a debug build without its zip does not sync; a release build reads the APK assets. - ARCHITECTURE.md updated. Not compiled or tested in this environment (no Android SDK). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
Brings in eb8f522: bundled-addons.tsv with each add-on's size and SHA-256, listed and fingerprinted without opening an add-on, and copies checked against their SHA-256. Conflicts, both additive: - strings.xml: ADFA-7238's reworded msg_bundled_plugins_failed, plus ADFA-7239's msg_updating_bundled_addons. - ARCHITECTURE.md: ADFA-7238's paragraph, then ADFA-7239's sync sentences. Also, in BundleSync: pass each entry's SHA-256 to the installer, so a sync checks copies against the index as the first install does. The check runs before beforePluginMove, so a corrupt copy never removes the installed build. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
A copy rejected for its content or manifest is not known by plugin ID, so it may be a recorded add-on the new bundle still contains. Removing recorded IDs the new set lacks would then uninstall the user's working build of it. When any copy is rejected, skip the removals; the rejection is reported, and the next bundle change removes what is left over. Test: a rejected copy keeps the old bundled add-ons. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
…ld build A sync passes each entry's SHA-256 to the installer (0a5e4f0); this pins it: a copy whose content does not match is reported, the installed build stays, and nothing of that ID is uninstalled. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
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.
ADFA-7239
Part of epic ADFA-3905. Stacked on #2289 (ADFA-7238), and based on its branch so this diff shows only this ticket. Draft until #2289 merges; then it will be rebased onto
stageby merging the new base.When a new APK is installed over an existing installation, its bundled add-ons replace the old bundle. This also repairs a first install that stopped before its bundle record was written.
What changes
BundleSync(new). When the build's bundle fingerprint differs from the record, or there is no record, it:Each bundled plugin replaces every other installed build of its ID, whether the user's or an older bundled one, through a new
beforePluginMovehook onBundledAddonInstaller. That fixes ADFA-7238: Bundle plugins and templates and install them at first installation #2289's limitation that an older build was left beside the new one. The hook runs after the content check, so a corrupt copy never removes the installed build. A build that cannot be deleted fails the sync. A plugin whose bundled build is already the one installed is copied over in place and keeps its state (enabled or not, crash count). A template replaces one of the same name. A bundled add-on the user removed comes back, but only when the bundle changes. When any copy is rejected, nothing is removed: the rejected copy has no known ID and may be a recorded add-on that is still bundled. An I/O error leaves the old record, so the sync runs again at the next start.BundleSyncAtStart(new) runs it fromCredentialProtectedApplicationLoader:loadPlugins(), so the synced set loads once;areIdeToolsInstalled(), besideisIdeSetupCompleteinSetupState);assets-<arch>.zipis gone, not at all. It skips the sync instead of treating the bundle as empty.After a sync, bundled plugins that failed to load are recorded for the existing error bar. A failed sync is recorded there too.
MainActivitywaits for the start-up check to begin and to end before reading failures. It waits up to 30 s for the check to begin, because the screen can resume first. It shows a progress bar ("Updating the plugins and templates that came with the app…") only while a sync runs.ARCHITECTURE.mddescribes the sync.Decisions (ADFA-7239 comment 41492):
Verification
:app:assembleV8Debugpass on68b04be, which merges ADFA-7238: Bundle plugins and templates and install them at first installation #2289'sfea9942(withstage) into78fc586; the APK is on Firebase App Distribution as C-d-1123-0603 (ADFA-7239's upload at 06:22Z; ADFA-7238: Bundle plugins and templates and install them at first installation #2289's build has the same name, so pick by ticket key).8a9569f): no critical findings.e4f2a0e:eb8f522, its code) and merged here: a content-based fingerprint from a build-time index of SHA-256s, which also lists the bundle without inflating any add-on.78fc586because CI runs no app unit tests::app:testV8DebugUnitTestpasses 1853 of 1853, includingBundleSyncTest's 20 cases, and:plugin-manager:testV8DebugUnitTestpasses 210 of 210.BundleSyncwas broken on its own (on90731e8, the same code), and the tests named for it failed at their assertions: an unchanged build uninstalled anyway; removals despite a rejected copy; no check that the old build is gone; the index hash not passed to the copy; absent bundled add-ons not removed; other builds never removed; the fingerprint ignored; no sync without a record; the record written before the copies; old failures kept.Limitations accepted
PluginManager.uninstallPlugin, which clears the plugin's saved state, as an install from the Add-ons Manager does.loadPlugins()started elsewhere. They run at start-up, before any screen can trigger a load.BundleSyncAtStartimports the on-disk setup check fromactivities, and repeats the installers' choice of bundle source.msg_bundled_plugins_failed.🤖 Generated with Claude Code
https://claude.ai/code/session_01Vh2DAZ6QqzwTmigaKYLNVw
Code Reviewer: Code Reviewer couldn't review this pull request
The pull request author does not have access to AI for the associated Atlassian organization.