Skip to content

Report install result via EXTRA_RETURN_RESULT (like the stock installer) #2003

Description

@bikram-agarwal

Please check before submitting an issue

  • I am using the latest version of App Manager
  • I have searched the issues and haven't found anything relevant
  • I have read the docs
  • I know that generating a report, in whole part or in part, using AI/LLM is prohibited

Describe the new feature

Right now, when another app (e.g. an app updater) hands App Manager an APK to install via ACTION_INSTALL_PACKAGE and asks for a result back (Intent.EXTRA_RETURN_RESULT = true), App Manager doesn't report anything — the caller just gets Android's default RESULT_CANCELED, identical to what it would get if the user had actually cancelled the install. There's no way for the calling app to tell "it succeeded" apart from "it was cancelled" or "App Manager doesn't support this at all."

This is a real gap in practice: I confirmed by testing directly that App Manager's PackageInstallerActivity completes installs successfully but never calls setResult() before finishing, so the caller has no reliable signal.

Both Android's own stock PackageInstaller and InstallerX-Revived already implement this correctly — see InstallerX-Revived #672, which was implemented in PR #709. The convention there:

If the launching intent has Intent.EXTRA_RETURN_RESULT = true, check the install outcome before finishing.
On success: setResult(RESULT_OK, Intent().putExtra("android.intent.extra.INSTALL_RESULT", <success code>))
On failure: setResult(RESULT_FIRST_USER, Intent().putExtra("android.intent.extra.INSTALL_RESULT", <legacy PackageManager error code>))
Otherwise (cancelled/unknown): leave the default RESULT_CANCELED.

Would it be possible to add the same handling to PackageInstallerActivity? This would let calling apps (app updaters, installer front-ends, etc.) get a direct, reliable answer instead of having to guess based on broadcasts, focus changes, or timeouts.

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions