Skip to content

Android 15: ContentResolver.query returns null from hooked app to external ContentProvider #253

Open
@pbzinwindows

Description

@pbzinwindows

Steps to reproduce/复现步骤

LSPosed framework installed and active.

Install the AllTrans Xposed module APK (akhil.alltrans).

Install a target application, for example, eu.toldi.infinityforlemmy.

Have adb available for logcat.

Configuration:

Open LSPosed Manager.

Go to "Modules" and ensure the "AllTrans" module is enabled globally (toggle switch is ON).

Tap on the "AllTrans" module entry to configure its scope.

Find and check the box next to the target application (eu.toldi.infinityforlemmy) to enable the module for this app's scope.

Reboot the device to ensure the module scope changes take effect.

(Optional but recommended): Open the AllTrans application itself and configure global settings (e.g., enable translation, set languages). This isn't strictly necessary to see the query fail, but confirms general setup.

(Verification): Confirm that the AllTrans ContentProvider (akhil.alltrans.sharedPrefProvider) is functional by running adb shell content query --uri content://akhil.alltrans.sharedPrefProvider/some.test.package. This command should successfully return at least one row with the global preferences JSON.

Trigger the Issue:

Start adb logcat (you can filter for the target app's process or the "AllTrans" tag, e.g., adb logcat | findstr eu.toldi.infinityforlemmy or adb logcat -s AllTrans).

Launch the target application (eu.toldi.infinityforlemmy).

Observe the Failure:

Monitor the logcat output corresponding to the eu.toldi.infinityforlemmy process.

Look for the specific log lines generated by the AllTrans module during the app's initialization.

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. !!!

The contentResolver.query call returns null without throwing any Java exception in the hooked app's process.

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 模块列表

alltrans

Root implementation/Root 方案

magisk28103

System Module List/系统模块列表

systemless hosts
zygiskNext

LSPosed version/LSPosed 版本

1.10.1 718

Android version/Android 版本

15

Version requirement/版本要求

Logs/日志

LSPosed_2025-04-19T02_01_08.600263.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions