LSPatch icon indicating copy to clipboard operation
LSPatch copied to clipboard

[Feature Request] Modify app permissions

Open Mino260806 opened this issue 5 months ago • 9 comments

Is your feature request related to a problem?/你的请求是否与某个问题相关?

Sometimes I need INTERNET permission, but some apps do not declare it, so I'm unable to use the internet in my module.

Describe the solution you'd like/描述你想要的解决方案

Add an option to add permissions to AndroidManifest.xml when patching an app

Additional context/其他信息

No response

Mino260806 avatar Aug 07 '25 19:08 Mino260806

I wanted to have this feature for a long time.

It seems complicated to implement, which could take a long time.

JingMatrix avatar Aug 19 '25 11:08 JingMatrix

It seems LSPatch uses ManifestEditor

There's already a method in this library called addUsesPermission, which does exactly what we are looking for. Why don't we use it ?

Screenshot_2025-08-19-13-09-18-469_com.github.android.jpg

Mino260806 avatar Aug 19 '25 12:08 Mino260806

The complexity stems from a nice design of configuration front-end.

JingMatrix avatar Aug 19 '25 12:08 JingMatrix

What about declaring the required permissions in the module's AndroidManifest.xml as an array (like xposedscope) ? To ensure parity between LSPatch and LSPosed, we'll also need to add a system hook in original LSPosed for root users, that dynamically adds the permission for the hooked app when it launches (without patching of course). Do you think this idea is feasible ? It I'll open many new possibilites for modules.

Mino260806 avatar Aug 19 '25 12:08 Mino260806

That is unlikely to be feasible, see https://xdaforums.com/t/adding-permissions-to-hooked-app.3351933/post-66234963.

Moreover, this scheme is not portable: think about patching without embedding modules in advance.

JingMatrix avatar Aug 19 '25 13:08 JingMatrix

That is unlikely to be feasible, see https://xdaforums.com/t/adding-permissions-to-hooked-app.3351933/post-66234963.

It is possible to do it the way rovo89 suggested. See https://xdaforums.com/t/xposed-for-devs-how-to-dynamically-declare-permissions-for-a-target-app-without-altering-its-manifest-and-changing-its-signature.4440379/

Moreover, this scheme is not portable: think about patching without embedding modules in advance.

When enabling a module that contains this scheme in an apk patched in advance, we can show a dialog to the user stating that the app needs to be patched again (only once), in order to include the required permissions.

Mino260806 avatar Aug 19 '25 13:08 Mino260806

The way rovo89 suggested requires root permission, which is not feasible for LSPatch.

JingMatrix avatar Aug 19 '25 13:08 JingMatrix

The way rovo89 suggested requires root permission, which is not feasible for LSPatch.

I think I haven't explained my idea properly. My suggestion is as follows:

Introduce a new manifest attribute in an LSPosed / LSPatch module, like xposedpermissions, which are target permissions that the module wants the target app to have. Which can be implemented as follows:

  • LSPosed (root) : introduce a system hook (the way rovo89 suggested) that dynamically adds permissions to hooked apps when launched
  • LSPatch (no root, integrated) : add the permission into the manifest file when integrating a module
  • LSPatch (no root, local without embedding) : when user enables a module for an app patched without embedding, he is prompted with a dialog to repatch the app only once in order to add the missing permissions, if they are absent in the target app

Mino260806 avatar Aug 19 '25 13:08 Mino260806

Is it the module (XPosed) or the patched application that requires permission?

HSSkyBoy avatar Sep 11 '25 14:09 HSSkyBoy