Skip to content

Commit d9f1d39

Browse files
ADFA-4986: keep the boot gate on re-entry during a live install
Tapping the install notification (or relaunching) mid-install re-entered LibraryActivity without EXTRA_INSTALLING, so onCreate took the normal-boot path: its autostart (~3.5s) and safety-dismiss (GATE_SAFETY_MS) timers fired, starting the server mid-provisioning and opening the gate over a system that was still downloading/extracting -> a broken library. - Derive `installing` also from the live install state: EXTRA_INSTALLING || InstallProgressRepository.get().current().isRunning() (DOWNLOADING/EXTRACTING/PROVISIONING), so a live install keeps the progress gate and skips the normal-boot timers. - Defense-in-depth: guard the autostart and safety-dismiss timers with !installing so a race (repo reports running just after onCreate) still can't start the server or lift the gate. Dismissal stays driven by the install SUCCESS terminal path; covers download and extraction.
1 parent d0f531b commit d9f1d39

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

‎controller/app/src/main/java/org/iiab/controller/redesign/LibraryActivity.java‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,12 @@ protected void onCreate(Bundle savedInstanceState) {
132132
// ADFA-4915: extract detail is one middle-ellipsized line so long file names never overlap.
133133
installDetail.setMaxLines(1);
134134
installDetail.setEllipsize(android.text.TextUtils.TruncateAt.MIDDLE);
135-
installing = getIntent().getBooleanExtra(EXTRA_INSTALLING, false);
135+
// ADFA-4986: also treat a live install as "installing" even when re-entered WITHOUT the extra
136+
// (tapping the install notification, or a relaunch). isRunning() covers DOWNLOADING/EXTRACTING/
137+
// PROVISIONING. Otherwise the gate takes the normal-boot path and its autostart/safety timers
138+
// start the server and OPEN over a system that is still provisioning -> a broken library.
139+
installing = getIntent().getBooleanExtra(EXTRA_INSTALLING, false)
140+
|| InstallProgressRepository.get().current().isRunning();
136141
// The Lottie has a text layer (OPEN/CLOSED sign). Use the system typeface (Noto-based,
137142
// global script fallback) so localized words render in any language; a TextDelegate maps
138143
// the OPEN/CLOSED source text to the localized @string values.
@@ -288,16 +293,18 @@ public android.graphics.Typeface fetchFont(String fontFamily) {
288293
// If the stack isn't up after one poll cycle, start it.
289294
if (systemInstalled) {
290295
main.postDelayed(() -> {
291-
if (!isFinishing()
296+
// ADFA-4986: never autostart the server if an install went live after onCreate.
297+
if (!isFinishing() && !installing
292298
&& !ServerStateRepository.get().current().alive
293299
&& targetServerState == null) {
294300
serverController.handleServerLaunchClick(findViewById(android.R.id.content));
295301
}
296302
}, AUTOSTART_DELAY_MS);
297303
}
298-
// Safety: never trap the user behind the gate.
304+
// Safety: never trap the user behind the gate — but ADFA-4986: don't lift it mid-install
305+
// (a live download/extraction drives its own dismissal on SUCCESS via the terminal path).
299306
main.postDelayed(() -> {
300-
if (!gateDismissed) {
307+
if (!gateDismissed && !installing) {
301308
onServerReady();
302309
}
303310
}, systemInstalled ? GATE_SAFETY_MS : NO_SYSTEM_GATE_MS);

0 commit comments

Comments
 (0)