Use role API when setting the default launcher#17
Merged
Conversation
Set-DefaultLauncher only called `cmd package set-home-activity`, which is the legacy Android API. On Android 10+ the canonical mechanism is the role API (`cmd role add-role-holder android.app.role.HOME <pkg>`) and on Android 11+ the legacy command often no-ops silently — leaving the launcher installed but not active. The codebase already has Set-HomeRoleHolder used by the Disable-AllStockLaunchers path. Try that first in Set-DefaultLauncher and fall through to the legacy command (with the existing common-name fallback) if the role API rejects the package. Reproduced on a Shield running Android 11 where the wizard reported "Could not set default programmatically" even after Projectivy was installed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
`Set-DefaultLauncher` only called `cmd package set-home-activity`, which is the legacy Android API. On Android 10+ the canonical mechanism is the role API (`cmd role add-role-holder android.app.role.HOME `); on Android 11+ the legacy command frequently no-ops silently. Reproduced on a real Shield running Android 11 — wizard reported "Could not set default programmatically" even after Projectivy was installed and the user clicked through the wizard.
The codebase already has `Set-HomeRoleHolder` (used by `Disable-AllStockLaunchers`). Try it first in `Set-DefaultLauncher`; fall through to the legacy command + activity-name fallbacks only if the role API rejects the package.
Verification