Repository navigation
Commit d24a6bb
ADFA-4128 (4/11): address Akash's review
Fixes for every finding on the runtime module, plus two changes that came out of
reviewing them.
Crash banner. The copy said "New code crashed", which named the one event this
banner cannot observe: the CRASHED state is set only from failReload, so it is
always the reload machinery that failed, never the user's own code. It also
carried a stack summary it had no room for. It now reads
Live reload crashed. App is on the last working version.
For more info, see Build Output in Code on the Go.
and points at the pane where the full text already goes unchanged. At the
narrowest width measured on an A56 at 2x font scale that is five rendered lines,
four from 28 characters up; MAX_BANNER_LINES stays at 6, one line of slack,
because the line a tighter cap drops is the tail of the pointer - which leaves
the reader told to look somewhere without the name of the place.
Crash report. It walks up to three causes and prints each one's frames, not just
its toString. An Android lifecycle crash always arrives wrapped, so the top
frames are ActivityThread's every time and the line naming the developer's bug
sits in the cause; reporting the message alone named the exception without ever
placing it.
markGood retry. lastMarkedGoodGeneration was set before the write was attempted,
so a failed markGood was never retried and its latch blocked every later one for
the process lifetime, and the KDoc's justification was inverted. Clearing the
latch on a bare false is not safe either - markGood answers several situations
with one false, and persist runs before apply, so meta.json is briefly ahead of
the live generation on every deploy. markGoodCanSucceed separates a failed write
from a store that moved on, and only the failed write clears.
Payload overtake. onPayload is oneway, so a slower older deploy can be overtaken
while it reads its payload and then publish itself over the newer one, leaving
disk a generation behind the running process until the next cold boot adopts it.
PayloadStore.apply already refuses a generation that is not strictly newer, so
this could never reach the screen - only disk. PayloadPersistence now keeps the
highest generation this process has published and refuses anything older,
throwing StalePayloadException so the deploy path can tell a lost race from a
broken store and stay silent about it. The bar rises only after the publishing
rename, so a persist that threw part-way does not block its own retry.
That guard also separates the two cases a generation number alone conflates. A
restarted host counter - the project's state dir wiped while the app stays
installed - always arrives in a process that has published nothing, so the mark
is zero and the low generation is adopted as before. Both counter-restart tests
now build a fresh store object over the same directory, which is the only shape
that case has on a device.
Payload memory. The resource apk and the assets zip were read whole into memory
and written straight back out to files that are reopened as files afterwards, so
a cold deploy held two payload-sized arrays live for no benefit on the devices
least able to spare them. persist now takes both as streams and copies them
through a 16 KB buffer into the same temp-then-fsync-then-rename write. Only the
dex stays a byte array, because InMemoryDexClassLoader needs one. The 64 MB cap
is unchanged and now guards the streaming path; the parameter types are what
keep it that way.
Also from Akash: the manifest-merger comment, the KDoc corrections, and the test
helper that divided length by width - it modelled a renderer that breaks
mid-word, so it read the banner's six real lines as five and could not have
caught the overflow it existed for. It wraps on words now, and was watched
failing at the old cap before the cap moved.
Both new gates were watched red first: the payload cap with its check stubbed
out, the overtake refusal with its condition forced false. Only the intended
test failed each time. 248 tests green.
Banner inset. Photographing the new banner at 2x font scale showed it drawing
over the status bar: getRootWindowInsets() comes back null on the first render
after a config-change recreate, and the overlay took that as a 0 inset. A null
read now means "not measured yet" - the margin is left alone and re-read after
the next layout, once, by a listener that removes itself. The decision is a pure
static so it can be unit-tested; the deferred re-read firing is checked on a
device (A56: banner flush below the 101 px bar at 1.0 and 2.0).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xsc7AMGBVyEMfrwpZX87iC1 parent f3a618b commit d24a6bb
22 files changed
Lines changed: 1172 additions & 172 deletions
File tree
- quickbuild/runtime
- src
- main/java/com/itsaky/androidide/quickbuild/runtime
- test/java/com/itsaky/androidide/quickbuild/runtime
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | | - | |
42 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
Lines changed: 95 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
Lines changed: 32 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
| 25 | + | |
32 | 26 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 27 | + | |
42 | 28 | | |
43 | 29 | | |
44 | 30 | | |
45 | 31 | | |
46 | 32 | | |
47 | 33 | | |
48 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
49 | 42 | | |
50 | 43 | | |
51 | 44 | | |
| |||
66 | 59 | | |
67 | 60 | | |
68 | 61 | | |
69 | | - | |
| 62 | + | |
70 | 63 | | |
71 | 64 | | |
72 | 65 | | |
| |||
85 | 78 | | |
86 | 79 | | |
87 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
88 | 101 | | |
Lines changed: 17 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
10 | 17 | | |
11 | 18 | | |
12 | 19 | | |
| |||
30 | 37 | | |
31 | 38 | | |
32 | 39 | | |
33 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
34 | 43 | | |
35 | | - | |
36 | | - | |
37 | 44 | | |
38 | 45 | | |
39 | | - | |
40 | | - | |
| 46 | + | |
| 47 | + | |
41 | 48 | | |
42 | 49 | | |
43 | 50 | | |
| |||
125 | 132 | | |
126 | 133 | | |
127 | 134 | | |
128 | | - | |
129 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
130 | 140 | | |
131 | 141 | | |
132 | 142 | | |
| |||
0 commit comments