Skip to content

onConfigurationChanged never calls super, so every rotation crashes the app - #191

Merged
xroche merged 3 commits into
masterfrom
fix-configchanged-super
Sep 9, 2026
Merged

xroche merged 3 commits into
masterfrom
fix-configchanged-super

Conversation

@xroche

@xroche xroche commented Sep 9, 2026

Copy link
Copy Markdown
Owner

HTTrackActivity.onConfigurationChanged only logged. Android runs it, checks that Activity's own implementation ran, and throws SuperNotCalledException when it did not. Play reports 4 users and 6 crashes at this frame.

No activity declares android:configChanges, so most configuration changes relaunch the activity instead of reaching this method. Which ones do reach it is not something the manifest tells us, and production shows some do. The override has to chain either way, and the // TODO: handle orientation change ? comment goes with the fix.

Every other lifecycle override in the tree already chains. A new source-text guard reads each Java source under src/main/java and fails on any void lifecycle override that never calls its super.

Closes #186

xroche and others added 3 commits September 9, 2026 10:49
Android runs onConfigurationChanged, then checks that Activity's own
implementation ran, and throws SuperNotCalledException when it did not.
HTTrackActivity only logged, so every rotation, dark-mode switch,
font-size change or split-screen entry killed the app. Play has 4 users
and 6 reports.

No activity in the manifest declares android:configChanges, so the
activity is recreated for the changes it can be recreated for and the
override handles nothing. The TODO asking whether to handle orientation
change goes with it.

The other lifecycle overrides in the tree all chain. A new source-text
guard reads every Java source under src/main/java and fails on any void
lifecycle override that never calls its super. A second case feeds the
scan one chaining and one silent override, so a scan that stopped
matching cannot pass.

Signed-off-by: Xavier Roche <xroche@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
The scan wanted `void` right after `public` or `protected`. So
`public synchronized void onDestroy()` and `@Override public void
onResume()` were not reported missing, they were not seen at all. The
tree has none today, so the guard stayed green and would have stayed
green for the next author who wrote one.

The declaration pattern now takes same-line annotations and any modifier
order. A second pass then looks for every lifecycle name used other than
as a call on a receiver. It fails when one falls outside a matched
declaration, so a style neither pattern reads is a failure rather than a
silent gap. Private helpers of the same name are read and skipped, so
widening the match does not flag them.

The test now states two limits. A chain on another overload, such as
super.onCreate(null), sets the flag the framework checks while dropping
the argument. And the scan reads .java under src/main/java only.

Signed-off-by: Xavier Roche <xroche@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Nine of the twenty-two names had no declaration in the tree and no
fixture. Nothing ever fed them to the scan, so the suite reported
coverage it did not have.

A new case runs each name through the scan twice, once chaining and once
silent, which is four assertions in a loop. The list itself stays. Its
value is the next override someone adds without a super call, and
cutting it to what the tree declares today throws that away.

The comments are reworded too. The class doc splits its two limits into
a sentence each, and the field docs get a subject and a verb. The note on
the MENTION pattern no longer reads as if a declaration were excluded
from it. A declaration matches and is filtered out later.

Signed-off-by: Xavier Roche <xroche@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@xroche
xroche enabled auto-merge (squash) September 9, 2026 09:24
@xroche
xroche merged commit 76ca704 into master Sep 9, 2026
7 checks passed
@xroche
xroche deleted the fix-configchanged-super branch September 9, 2026 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

onConfigurationChanged never calls super, so every rotation crashes the app

1 participant