Android 15: ContentResolver.query returns null from hooked app to external ContentProvider #358
Replies: 8 comments
-
|
use my most updated version of the apk or the latest one present here I think it still works |
Beta Was this translation helpful? Give feedback.
-
|
It is a module problem, mostly due to null |
Beta Was this translation helpful? Give feedback.
-
I've added more detailed logging to my module (AllTrans) right before the ContentResolver.query call is made from within the hooked application (eu.toldi.infinityforlemmy). The new logs confirm that the module's static Context object (alltrans.context) is NOT null when the query is attempted. You can see this here: 2025-04-19 19:22:53.526 ... I/AllTrans: readPrefAndHook: Pre-Query Check for eu.toldi.infinityforlemmy: Despite the context being valid, the query() call still returns null without any Java exception being thrown in the hooked app. However, the crucial finding is this: when I temporarily set SELinux to Permissive mode (setenforce 0), the ContentResolver.query() call from the hooked app WORKED correctly and returned a valid Cursor. Returning to Enforcing mode (setenforce 1) causes the query to return null again. This strongly points to an SELinux policy blocking the specific IPC (Binder) communication between the hooked app process and the module's ContentProvider process in Enforcing mode on Android 15. (While I couldn't pinpoint a specific avc: denied log for this exact interaction, the Permissive/Enforcing difference is clear evidence). Could you perhaps look into potential interactions between LSPosed's IPC/Binder handling and SELinux policies on Android 15 that might be causing this specific type of ContentProvider query from a hooked app to be blocked? |
Beta Was this translation helpful? Give feedback.
-
|
My latest logs confirm the Context object is definitely NOT null right before the query attempt. The critical new finding is: the query() works perfectly when SELinux is set to Permissive mode (setenforce 0). It only returns null when SELinux is Enforcing. While in Permissive mode, I captured these specific avc: denied logs happening exactly when the hooked app tries the query: avc: denied { find } for pid=[PID_HOOKED_APP] ... scontext=u:r:untrusted_app:s0... tcontext=u:r:system_server:s0 tclass=service_manager ... app=[HOOKED_APP_PKG_NAME] This strongly indicates the issue is SELinux blocking the required IPC (binder call / service_manager find) from the hooked app context in Enforcing mode. Could you please reconsider the issue in light of this SELinux evidence? It seems related to LSPosed's interaction with SELinux/IPC rules on Android 15. Thanks! |
Beta Was this translation helpful? Give feedback.
-
|
Please provide the full Also if possible, please compare the results for different target apps. It seems that this query failure only happens for apps with null global context. |
Beta Was this translation helpful? Give feedback.
-
|
2025-04-20 15:51:17.462 7189-7189 FinalizerDaemon usap64 W type=1400 audit(0.0:15128): avc: denied { getopt } for path="/dev/socket/usap_pool_primary" scontext=u:r:untrusted_app:s0:c73,c258,c512,c768 tcontext=u:r:zygote:s0 tclass=unix_stream_socket permissive=0 app=eu.toldi.infinityforlemmy 2025-04-20 15:35:47.166 8573-8573 FinalizerDaemon usap64 W type=1400 audit(0.0:15151): avc: denied { getopt } for path="/dev/socket/usap_pool_primary" scontext=u:r:untrusted_app:s0:c81,c258,c512,c768 tcontext=u:r:zygote:s0 tclass=unix_stream_socket permissive=0 app=com.simon.harmonichackernews I compared two different apps, and it's worth saying that they both work with lspatch |
Beta Was this translation helpful? Give feedback.
-
|
I think this is more a problem for module developer instead of LSPosed. Now I transfer this issue into Discussions, as it could be possible to find a solution for your module desiging via the community. |
Beta Was this translation helpful? Give feedback.
-
|
The problem is this: https://developer.android.com/about/versions/11/privacy/package-visibility This blocks other apps from seeing the app that is in scope. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Steps to reproduce/复现步骤
LSPosed framework installed and active.
Configuration:
Trigger the Issue:
Observe the Failure:
Expected behaviour/预期行为
The logcat for the target app should show lines indicating successful initialization, similar to:
I/AllTrans: readPrefAndHook: Executing contentResolver.query...
I/AllTrans: readPrefAndHook: contentResolver.query finished.
I/AllTrans: readPrefAndHook: Query successful, cursor received. Row count: X. Attempting to read data...
I/AllTrans: readPrefAndHook: Preferences parsed. Enabled=true, LocalEnabled=true, ...
I/AllTrans: readPrefAndHook: AllTrans is ENABLED for Package eu.toldi.infinityforlemmy...
I/AllTrans: registerTranslationHooks: Attempting to register hooks...
I/AllTrans: registerWebViewHooks: Registering WebView hooks...
Translation features within the target app should start working.
Actual behaviour/实际行为
The logcat for the target app shows the following critical failure line:
I/AllTrans: !!! readPrefAndHook: Cursor is NULL after query for URI: content://akhil.alltrans.sharedPrefProvider/eu.toldi.infinityforlemmy. Cannot read preferences. Check Provider status, Permissions (SELinux), Visibility. !!!
Consequently, the AllTrans module fails to initialize completely within the target app, and no translation occurs.
This failure happens despite the ContentProvider working correctly when queried directly via adb shell content query. The issue is specific to the IPC call originating from the LSPosed-hooked application process.
Xposed Module List/Xposed 模块列表
Root implementation/Root 方案
magisk28103
System Module List/系统模块列表
LSPosed version/LSPosed 版本
1.10.1 718
Android version/Android 版本
15
Version requirement/版本要求
Logs/日志
LSPosed_2025-04-19T02_01_08.600263.zip
Beta Was this translation helpful? Give feedback.
All reactions