Skip to content

Add installable shell APKs for shortcuts - #572

Open
weifengiii wants to merge 1 commit into
Waboodoo:developfrom
weifengiii:feature/installable-shell-apks
Open

Add installable shell APKs for shortcuts#572
weifengiii wants to merge 1 commit into
Waboodoo:developfrom
weifengiii:feature/installable-shell-apks

Conversation

@weifengiii

Copy link
Copy Markdown

Adds support for installing shortcuts as standalone launcher apps.

Motivation:
Some system automation tools and OEM routine features can launch installed apps, but cannot always select launcher shortcuts or app-specific pinned shortcuts as actions. This makes HTTP Shortcuts harder to use in automation workflows where the user wants a shortcut to be triggered by a system routine. By allowing a shortcut to be installed as a lightweight standalone launcher app, these tools can select and launch it like any other app.

Summary:

  • Adds a small shell APK template module
  • Repackages the template APK at runtime with shortcut-specific package name, label, icon, and deep link
  • Signs generated shell APKs locally
  • Handles unknown app install permission flow
  • Uses PackageInstaller for installation and diagnostics
  • Cleans temporary generated APK files after installer session commit
  • Syncs shell APK strings from the main app resources for translation support

Implementation notes:

  • No generated APKs are committed. The shell APK template is built from source and bundled as an app asset during the Gradle build.
  • When the user chooses “Install as App”, HTTP Shortcuts copies the template APK into cache and rewrites it at runtime.
  • The generated APK keeps the template code, but replaces placeholder values in the compiled AndroidManifest.xml string pool:
    • package name
    • launcher label
    • target http-shortcuts://... deep link
  • The launcher icon PNG resources in the template APK are replaced with a rasterized version of the shortcut icon.
  • The generated APK is signed with an app-local Android Keystore key and installed through PackageInstaller.
  • When the shell app is launched, it reads the injected deep link from its manifest metadata and forwards it to HTTP Shortcuts.
  • If HTTP Shortcuts can no longer handle that deep link, the shell app shows a localized toast asking the user to uninstall it.

How to test:

  1. Build and install the debug APK:
    ./gradlew :app:assembleDebug
  2. Open HTTP Shortcuts and long-press an existing shortcut.
  3. Select “Install as App”.
  4. Grant unknown app installation permission if prompted.
  5. Confirm that Android shows an installer for a new app with the shortcut's name and icon.
  6. Install it and launch the generated app from the launcher.
  7. Confirm that it forwards to the original shortcut.
  8. Delete the original shortcut, launch the generated app again, and confirm that it shows a localized “Shortcut not found” toast.

Tested:

  • :app:assembleDebug
  • :app:assembleRelease
  • :app:testDebugUnitTest --tests ch.rmy.android.http_shortcuts.shell_apk.ShellApkPackageNameFactoryTest
  • apksigner verify

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