Skip to content

Fix no-op DatabasesActivity crash on Theme.NoDisplay#122

Merged
KCeh merged 2 commits into
release/6.0.0from
copilot/implement-solution-for-issue-113
Feb 5, 2026
Merged

Fix no-op DatabasesActivity crash on Theme.NoDisplay#122
KCeh merged 2 commits into
release/6.0.0from
copilot/implement-solution-for-issue-113

Conversation

Copilot AI commented Feb 4, 2026

Copy link
Copy Markdown
Contributor

Summary

The no-op DatabasesActivity crashes with IllegalStateException: Activity did not call finish() prior to onResume() completing on Android 6.0+. Activities using Theme.NoDisplay must call finish() before lifecycle reaches onResume().

Related issue: #113

Changes

Type

  • Feature: This pull request introduces a new feature.
  • Bug fix: This pull request fixes a bug.
  • Refactor: This pull request refactors existing code.
  • Documentation: This pull request updates documentation.
  • Other: This pull request makes other changes.

Additional information

  • This pull request introduces a breaking change.

Description

Override onCreate() in no-op DatabasesActivity to call finish() immediately after super.onCreate():

internal class DatabasesActivity : Activity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        finish()
    }
}

The no-op manifest declares this activity with android:theme="@android:style/Theme.NoDisplay". Without an explicit finish() call, the Android framework throws IllegalStateException when the activity lifecycle continues past onCreate().

Checklist

  • I have performed a self-review of my own code.
  • I have tested my changes, including edge cases.
  • I have added necessary tests for the changes introduced (if applicable).
  • I have updated the documentation to reflect my changes (if applicable).

Additional notes

No-op module has no test infrastructure. The fix follows standard Android pattern for Theme.NoDisplay activities.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.google.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java -XX:+HeapDumpOnOutOfMemoryError --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.base/java.nio.charset=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…nCreate()

Co-authored-by: KCeh <20267231+KCeh@users.noreply.github.com>
@sonarqubecloud

sonarqubecloud Bot commented Feb 4, 2026

Copy link
Copy Markdown

Copilot AI changed the title [WIP] Implement solution for issue 113 regarding database inspector Fix no-op DatabasesActivity crash on Theme.NoDisplay Feb 4, 2026
Copilot AI requested a review from KCeh February 4, 2026 19:08
@KCeh

KCeh commented Feb 4, 2026

Copy link
Copy Markdown
Collaborator

I don't think this is a proper fix, but I will investigate (try to reproduce)

@KCeh

KCeh commented Feb 4, 2026

Copy link
Copy Markdown
Collaborator

After a bit of research, it seems this might be fix 🤔

The Theme.NoDisplay is a special system theme intended only for "trampoline" activities that run a piece of logic (like routing an Intent) and then immediately vanish.

  • The Rule: If you use Theme.NoDisplay, the Android framework requires you to call finish() inside onCreate().
  • The Crash: Since your class is empty, it reaches onResume() without finishing. The system detects an invisible Activity that refuses to close and throws IllegalStateException

Docs

There is also alternative:
use different theme android:theme="@android:style/Theme.Translucent.NoTitleBar"
I will test both options and see what is the best approach

@KCeh

KCeh commented Feb 5, 2026

Copy link
Copy Markdown
Collaborator

I was able to reproduce bug (but not in the normal way of using sample app, only when forcing invocation of DatabasesActivity from no-op module):

FATAL EXCEPTION: main (Fix with AI)
 Process: com.infinum.dbinspector.sample, PID: 23013
  java.lang.RuntimeException: Unable to resume activity {com.infinum.dbinspector.sample/com.infinum.dbinspector.ui.databases.DatabasesActivity}: java.lang.IllegalStateException: Activity {com.infinum.dbinspector.sample/com.infinum.dbinspector.ui.databases.DatabasesActivity} did not call finish() prior to onResume() completing
                                                                                                    	at android.app.ActivityThread.performResumeActivity(ActivityThread.java:5309)
                                                                                                    	at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:5342)
                                                                                                    	at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:57)
                                                                                                    	at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:60)
                                                                                                    	at android.app.servertransaction.TransactionExecutor.executeLifecycleItem(TransactionExecutor.java:225)
                                                                                                    	at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:107)
                                                                                                    	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:81)
                                                                                                    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2636)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:107)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:232)
                                                                                                    	at android.os.Looper.loop(Looper.java:317)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:8705)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886)
                                                                                                    Caused by: java.lang.IllegalStateException: Activity {com.infinum.dbinspector.sample/com.infinum.dbinspector.ui.databases.DatabasesActivity} did not call finish() prior to onResume() completing
                                                                                                    	at android.app.Activity.performResume(Activity.java:9176)
                                                                                                    	at android.app.ActivityThread.performResumeActivity(ActivityThread.java:5299)
                                                                                                    	at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:5342) 
                                                                                                    	at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:57) 
                                                                                                    	at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:60) 
                                                                                                    	at android.app.servertransaction.TransactionExecutor.executeLifecycleItem(TransactionExecutor.java:225) 
                                                                                                    	at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:107) 
                                                                                                    	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:81) 
                                                                                                    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2636) 
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:107) 
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:232) 
                                                                                                    	at android.os.Looper.loop(Looper.java:317) 
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:8705) 
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method) 
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580) 
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886) 

Fix in this PR resolves issue.
IMO this is not a real issue rather some strange bug, as DatabasesActivity from no-op module should never be invoked. But since fix is easy I will included in upcoming release.

@KCeh KCeh changed the base branch from master to release/6.0.0 February 5, 2026 18:48
@KCeh KCeh marked this pull request as ready for review February 5, 2026 18:48
@KCeh KCeh merged commit 90a3b34 into release/6.0.0 Feb 5, 2026
6 of 7 checks passed
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.

2 participants