From cd58ee55fd19615c1bb2fda78cd4c66df907979d Mon Sep 17 00:00:00 2001 From: "Luis Guzman (AppDevForAll)" Date: Fri, 14 Aug 2026 18:46:01 -0600 Subject: [PATCH] ADFA-5152 fix(clone): a receive reopened during a transfer lands on progress, not the fork MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reopening the app mid-receive — the notification tapped, or a plain relaunch — showed the Send/Receive fork instead of the live progress screen, losing sight of the receiver's percentage (the only progress there is). onCreateView re-bound the SEND side but had no equivalent for RECEIVE; its comment claimed "Receive already re-binds via SyncProgressRepository" while no such block existed, so a recreated fragment fell to the default atFork=true. Both entrances already deliver the user to the Clone tab (the notification points at nav_clone, LibraryActivity routes a live-receive reopen there) — the only gap was the fragment's initial view. Adds the symmetric block: on SyncProgressRepository.isActive(), select the receive side and mark the CLONE lock/guard held (re-derived, like showReceiveTerminal) so a later cancel releases through releaseCloneEnv. renderReceive already paints the progress from the live state. Only while the process is alive; a hard kill empties the in-memory session and is the durability problem (ADFA-5146 family), not this. --- .../iiab/controller/redesign/CloneFragment.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/controller/app/src/main/java/org/iiab/controller/redesign/CloneFragment.java b/controller/app/src/main/java/org/iiab/controller/redesign/CloneFragment.java index 0d5899e3e..6e2c7fc83 100644 --- a/controller/app/src/main/java/org/iiab/controller/redesign/CloneFragment.java +++ b/controller/app/src/main/java/org/iiab/controller/redesign/CloneFragment.java @@ -289,7 +289,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c // ADFA-4960: re-bind to a live SEND session. Its rsync daemon is still up in this process (kept // alive by CloneShareService), so a recreated Fragment must land on the share screen — not the // fork. Restore the state the share screen redraws from; daemonStarted=true makes ensureDaemon's - // guard skip a re-start. (Receive already re-binds via SyncProgressRepository.) + // guard skip a re-start. if (CloneSendSession.isActive()) { atFork = false; side = Side.SEND; sendApp = false; stage = Stage.START; mode = CloneSendSession.isHotspot() ? Mode.HOTSPOT : Mode.WIFI; @@ -299,6 +299,18 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c librarySplit = CloneSendSession.split(); daemonStarted = true; cloneLockHeld = true; // the CLONE lock is still held by this process's send session + } else if (SyncProgressRepository.get().isActive()) { + // ADFA-5152: the symmetric RECEIVE re-bind, which the SEND comment above used to claim + // already existed. A recreated Fragment during a live receive (the notification tapped, or + // the app reopened) must land on the progress screen, not the fork — the receiver's + // percentage is the only progress there is. renderReceive() paints it from the live state; + // this just selects the receive side. The CLONE lock and install guard are still held by + // this process's receive, so mark them held (re-derived, like showReceiveTerminal) — a + // later cancel goes through releaseCloneEnv(), which is gated on these. + atFork = false; side = Side.RECEIVE; + cloneLockHeld = true; + Context rebindCtx = getContext(); + cloneGuardHeld = rebindCtx != null && org.iiab.controller.InstallGuard.inProgress(rebindCtx); } render(); return v;