Skip to content

Use role API when setting the default launcher#17

Merged
bryanroscoe merged 1 commit into
mainfrom
fix/launcher-set-default-role-api
May 8, 2026
Merged

Use role API when setting the default launcher#17
bryanroscoe merged 1 commit into
mainfrom
fix/launcher-set-default-role-api

Conversation

@bryanroscoe
Copy link
Copy Markdown
Owner

`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

  • `make lint` — Syntax OK
  • `make test` — 121 passed / 4 skipped / 0 failed
  • On-device verification pending — open this PR for the user to retry the wizard.

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.
@bryanroscoe bryanroscoe merged commit c9c7b3d into main May 8, 2026
4 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.

1 participant