When I just run adb shell, I get shell running from uid=2000(shell) gid=2000(shell), without ptrace access to my application.
How to open a shell with the same UID as launched application?
Use run-as <your package name> to switch to your app's UID or run-as <your package name> <command> to run a single command with your app's UID.
From this answer:
Contain the list of applications installed and their corresponding UID's.
Another answer in the same question suggests:
adb shell dumpsys package com.example.myapp | grep userId=
You can then open your shell as normal and run:
$ su <UID>
You should then have the same access and privileges as the app that uses that UID.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With