Can't access call log using the shell
egeres opened this issue · 1 comments
egeres commented
System:
- Android version: 12
- One UI version: 4.1
- Brand: Samsung
My problem is that running this code:
from ppadb.client import Client as AdbClient
client = AdbClient(host="127.0.0.1", port=5037)
device = client.devices()[0]
o = device.shell("content query --uri content://call_log/calls")
print(o)
Retrieves this error:
Error while accessing provider:call_log
java.lang.SecurityException: Permission Denial: opening provider com.android.providers.contacts.CallLogProvider from (null) (pid=18174, uid=2000) requires android.permission.READ_CALL_LOG or android.permission.WRITE_CALL_LOG
at android.os.Parcel.readException(Unknown Source:63)
at android.os.Parcel.readException(Unknown Source:10)
at android.app.IActivityManager$Stub$Proxy.getContentProviderExternal(Unknown Source:31)
at com.android.commands.content.Content$Command.execute(Content.java:441)
at com.android.commands.content.Content.main(Content.java:664)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(Unknown Source:25)
Which is weird, because I can access this information pretty easily running the ADB shell manually, can I escalate AdbClient
's permissions?
egeres commented
Okay, so for now I can bypass the need of ppadb by directly calling ADB as a subprocess:
...
command = f"adb -s {id_device} shell content query --uri content://call_log/calls"
o = subprocess.check_output(command, shell=True).decode("utf-8")
This seems to work for android 12 but not 5, presumably because you need root permission to access such information