Skip to content

Fix crash when Hide App Icon is enabled alongside dynamic shortcuts#46

Merged
Goooler merged 3 commits intotrunkfrom
copilot/fix-hide-app-icon-conflict
Apr 10, 2026
Merged

Fix crash when Hide App Icon is enabled alongside dynamic shortcuts#46
Goooler merged 3 commits intotrunkfrom
copilot/fix-hide-app-icon-conflict

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 10, 2026

  • Fix IllegalStateException crash in MainApplication.setupShortcuts() when "Hide App Icon" is enabled
    • Guard against all non-enabled states (DISABLED, DISABLED_USER, DISABLED_UNTIL_USED) — not just DISABLED
    • Remove existing dynamic shortcuts when alias is not enabled/default
  • Remove dynamic shortcuts in AppSettingsActivity.onHideIconChange() when hiding the icon, so shortcuts disappear immediately

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix issue with hiding app icon functionality Fix crash when Hide App Icon is enabled alongside dynamic shortcuts Mar 10, 2026
@Goooler Goooler linked an issue Mar 10, 2026 that may be closed by this pull request
@Goooler Goooler marked this pull request as ready for review March 10, 2026 10:55
@Goooler Goooler changed the base branch from main to trunk April 10, 2026 03:53
Co-authored-by: Goooler <10363352+Goooler@users.noreply.github.com>
@Goooler Goooler force-pushed the copilot/fix-hide-app-icon-conflict branch from 7be6606 to 23794d0 Compare April 10, 2026 03:54
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes an app-launch crash when dynamic shortcuts are registered while the launcher activity-alias is disabled (via the “Hide App Icon” setting), by guarding shortcut registration and proactively clearing shortcuts when hiding the icon.

Changes:

  • Add a component-enabled-state guard in MainApplication.setupShortcuts() to avoid calling ShortcutManagerCompat.setDynamicShortcuts() when the launcher alias is disabled, and clear stale shortcuts instead.
  • Clear all dynamic shortcuts immediately when “Hide App Icon” is enabled in AppSettingsActivity.onHideIconChange().

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
app/src/main/java/com/github/kr328/clash/MainApplication.kt Avoids shortcut registration when the launcher alias is disabled to prevent Launcher activity not found crashes.
app/src/main/java/com/github/kr328/clash/AppSettingsActivity.kt Removes dynamic shortcuts right after hiding the icon so launcher shortcuts disappear without restart.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Goooler
Copy link
Copy Markdown
Owner

Goooler commented Apr 10, 2026

@copilot apply changes based on the comments in this thread

Copy link
Copy Markdown
Author

Copilot AI commented Apr 10, 2026

@copilot apply changes based on the comments in this thread

Updated in 6869549. The guard now skips shortcut registration (and clears any stale shortcuts) for all non-active states — DISABLED, DISABLED_USER, DISABLED_UNTIL_USED — by checking that the alias is neither ENABLED nor DEFAULT.

Copilot AI requested a review from Goooler April 10, 2026 04:03
@Goooler Goooler enabled auto-merge (squash) April 10, 2026 04:08
@Goooler Goooler disabled auto-merge April 10, 2026 04:08
@Goooler Goooler merged commit 5d3ec14 into trunk Apr 10, 2026
@Goooler Goooler deleted the copilot/fix-hide-app-icon-conflict branch April 10, 2026 04:09
@Goooler
Copy link
Copy Markdown
Owner

Goooler commented Apr 10, 2026

Addressed to MetaCubeX#701.

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.

IllegalStateException: Launcher activity not found

3 participants