Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add installer status dialog #1473

Open
wants to merge 3 commits into
base: compose-dev
Choose a base branch
from

Conversation

oSumAtrIX
Copy link
Member

@oSumAtrIX oSumAtrIX commented Nov 8, 2023

This PR shows a native dialogue after the installation finishes. It can handle all status flags. Business logic may move.

Todo

  • Handle errors such as:
    • Installing regularly while a mount installation is currently active (In this case, uninstall the mount installation)
    • Mount errors such as wrong base APK or no base APK present (In this case, show an appropriate dialog)

Review

Warning

On installation, the install button is not greyed out, and no progress is visible, so it appears as if nothing happened.

@oSumAtrIX oSumAtrIX linked an issue Nov 8, 2023 that may be closed by this pull request
4 tasks
@oSumAtrIX oSumAtrIX self-assigned this Nov 8, 2023
@TheAabedKhan TheAabedKhan added the ReVanced Manager Compose Regarding the Compose rewrite of ReVanced Manager label Nov 8, 2023
Copy link
Contributor

@KobeW50 KobeW50 left a comment

Choose a reason for hiding this comment

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

Suggestion for the "invalid" error description

app/src/main/res/values/strings.xml Outdated Show resolved Hide resolved
@oSumAtrIX oSumAtrIX marked this pull request as ready for review November 10, 2023 00:49
Copy link
Contributor

@KobeW50 KobeW50 left a comment

Choose a reason for hiding this comment

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

String changes in error dialog

app/src/main/res/values/strings.xml Outdated Show resolved Hide resolved
app/src/main/res/values/strings.xml Outdated Show resolved Hide resolved
@KobeW50
Copy link
Contributor

KobeW50 commented Nov 14, 2023

Is this also for when you update the Manager?

@CnC-Robert
Copy link
Member

Is this also for when you update the Manager?

No it's only for installing patched apps

@Ushie
Copy link
Member

Ushie commented Nov 17, 2023

ReVanced Manager Updates will also use this, but this PR focuses on patched apps

@oSumAtrIX
Copy link
Member Author

@ Axelen123 Currently, the extra status message is not used, but I don't know which extra status messages exist so that I can implement them. For example, if an existing installation is present, but the patched app mismatches signatures, then the dialogue will say:

image

This flag is returned from installation, and there is no way to differentiate between an APK being invalid, for example, or a signature mismatch.

Furthermore, when uninstalling, the dialogue may also be shown. But once again, there is no way to differentiate between installations, uninstallations or the status message, so the dialogue may say that the installation has failed while the uninstallation failed.

@oSumAtrIX
Copy link
Member Author

msedge_XcwCJ412Tb.mp4

(The recording is cut off at the end, it shows the success dialogue when installation succeeded)

@Axelen123
Copy link
Member

@ Axelen123 Currently, the extra status message is not used, but I don't know which extra status messages exist so that I can implement them. For example, if an existing installation is present, but the patched app mismatches signatures, then the dialogue will say:

image

This flag is returned from installation, and there is no way to differentiate between an APK being invalid, for example, or a signature mismatch.

Not sure why Android says the app is invalid. Android should give you CONFLICT on signature mismatch. What is the content of the EXTRA_STATUS_MESSAGE here?

Furthermore, when uninstalling, the dialogue may also be shown. But once again, there is no way to differentiate between installations, uninstallations or the status message, so the dialogue may say that the installation has failed while the uninstallation failed.

Isn't it possible to make a separate dialog or enum for uninstalls?

@oSumAtrIX
Copy link
Member Author

Isn't it possible to make a separate dialog or enum for uninstalls?

Yes, but ideally we would have the existing Flags enum have variants of the install and uninstall strings.

@Ushie
Copy link
Member

Ushie commented Dec 10, 2023

Will root install be handled in this?

@oSumAtrIX
Copy link
Member Author

@Axelen123 I have updated the PR description with up to date information.

@oSumAtrIX oSumAtrIX changed the title feat: Show native dialog for installations feat: Add installer status dialog Jan 23, 2024
Comment on lines 179 to 191
UninstallService.APP_UNINSTALL_ACTION -> {
val pmStatus = intent.getIntExtra(
UninstallService.EXTRA_UNINSTALL_STATUS,
PackageInstaller.STATUS_FAILURE
)

// TODO: This is unused and may be completely removed everywhere.
// intent.getStringExtra(UninstallService.EXTRA_UNINSTALL_STATUS_MESSAGE)

if (pmStatus != PackageInstaller.STATUS_SUCCESS) {
installerStatusDialogModel.packageInstallerStatus = pmStatus
}
}
Copy link
Member

Choose a reason for hiding this comment

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

No logic for reattempting an installation that required uninstalling the installed app is present here. Is this intended?

Copy link
Member Author

@oSumAtrIX oSumAtrIX Jan 23, 2024

Choose a reason for hiding this comment

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

I am not sure if I understood correctly. If uninstallation fails, the appropriate dialog will be shown. If uninstallation succeeds, but the installation afterwards fails, the appropriate dialog will also be shown.

app.toast(app.getString(R.string.install_app_fail, extra))
}

installerStatusDialogModel.packageInstallerStatus = pmStatus
Copy link
Member

Choose a reason for hiding this comment

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

@PalmDevs should the dialog be shown for successful installs?

Copy link
Member Author

@oSumAtrIX oSumAtrIX Jan 23, 2024

Choose a reason for hiding this comment

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

If not, after installation the only thing that changes is the button from "Install" to "Open"

Copy link
Member

Choose a reason for hiding this comment

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

If the package installer dialog is hidden after the user clicks Install (some apps do that), yes. Otherwise, maybe not considering the package manager dialog already shows the same thing.

Copy link
Member Author

Choose a reason for hiding this comment

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

The popup is hidden once the user clicks install.

Copy link
Member

Choose a reason for hiding this comment

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

Should this be marked as resolved?

@PalmDevs
Copy link
Member

Please send a recording of the latest changes or link me to them, thanks 👍

@oSumAtrIX
Copy link
Member Author

oSumAtrIX commented Jan 23, 2024

@PalmDevs

explorer_IlN3nldlMq.mp4

Copy link
Member

@PalmDevs PalmDevs left a comment

Choose a reason for hiding this comment

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

A few string changes, need opinions.

app/src/main/res/values/strings.xml Outdated Show resolved Hide resolved
app/src/main/res/values/strings.xml Outdated Show resolved Hide resolved
app/src/main/res/values/strings.xml Show resolved Hide resolved
app/src/main/res/values/strings.xml Show resolved Hide resolved
Copy link
Member

@PalmDevs PalmDevs left a comment

Choose a reason for hiding this comment

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

Strings and UI, LGTM.

@oSumAtrIX
Copy link
Member Author

I'll need some help regarding the pending TODOs in the PR body. I am unsure where to get context about root installations when doing regular installation. The idea is, that other dialogs are added in case root installations exist or a root installation can't be done.

Copy link
Member

@Axelen123 Axelen123 left a comment

Choose a reason for hiding this comment

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

I have nothing else to suggest that isn't already being discussed.

@Axelen123
Copy link
Member

@oSumAtrIX

When uninstallation is necessary, first the uninstallation prompt is shown, then the installation prompt

Not sure this is within the scope of the PR. One of the cases requires checking the signature of the installed app, which would require functionality that isn't currently present in revanced library.

Mount errors such as wrong base APK or no base APK present (In this case, show an appropriate dialog)

Isn't this already handled?

@oSumAtrIX
Copy link
Member Author

Not sure this is within the scope of the PR. One of the cases requires checking the signature of the installed app, which would require functionality that isn't currently present in revanced library.

The dialog model has two functions for installing and uninstalling apps.
The installer returns a result at which the dialog shows the corresponding dialogue. If the signature mismatches, it will suggest to uninstall the app using the models uninstall function and attempting the installation again, which, the dialog will handle the result of:

explorer_IlN3nldlMq.mp4

What I meant with that message is the issue shown in the recording which shows that the installer runs before the uninstaller. The cause is not known and its unclear if it is an issue outside my env.

Isn't this already handled?

The dialog currently ONLY handles Android installer status. It has no context about root installations and root installers also don't return any status code like the Android installer. As it is right now, the dialog is only handling Android installations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ReVanced Manager Compose Regarding the Compose rewrite of ReVanced Manager
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: handle install failure
7 participants