PermissionManagerX
PermissionManagerX copied to clipboard
FR: Add Intent to start daemon over ADB
Very useful application, thanks.
I was wondering if an Intent can be added to have Permission Manager X start its daemon using ADB to avoid needing to bring up PMX's user interface.
(Background: on my unrooted Android device, I use Tasker and Termux to start Shizuku and ADB on port 5555 etc. automatically at boot. To be able to use the Permission Watcher features after every phone restart without needing to think about starting it manually, it'd be great if I could use am in a script instead of having to tap PMX's notification.)
Thanks.
If ADB is enabled on boot before PMX receives the BOOT_COMPLETED broadcast, it doesn't need user interaction to connect to ADB. But once ADB connection fails, PMX no more tries again unless user explicitly asks to.
But you point is valid since the order in which BOOT_COMPLETED is delivered to the apps cannot be manually controlled. So PMX can start before ADB is enabled. So you want PMX to receive an Intent to trigger ADB connection and restart Watcher. Right?
On boot how do you start ADB in wireless mode without connecting to a PC or without enabling from Developer Options?
So you want PMX to receive an Intent to trigger ADB connection and restart Watcher. Right?
Exactly.
My phone isn't rooted so I have Tasker/Termux connect to ADB using the
built in wireless debugging, and then use that session to run adb tcpip
which is, I think, the only way to get "traditional" ADB Wi-Fi running on
non-rooted phones. The problem is this is slow to do, so everything is long
started by this point. If there were an Intent I could broadcast with am
after running adb tcpip to have PMX's daemon running, it would allow me
to have that part automated, thanks.
On Fri, 14 Jan 2022, 16:02 Irfan Latif, @.***> wrote:
If ADB is enabled on boot before PMX receives the BOOT_COMPLETED broadcast, it doesn't need user interaction to connect to ADB. But once ADB connection fails, PMX no more tries again unless user explicitly asks to.
But you point is valid since the order in which BOOT_COMPLETED is delivered to the apps cannot be manually controlled. So PMX can start before ADB is enabled. So you want PMX to receive an Intent to trigger ADB connection and restart Watcher. Right?
— Reply to this email directly, view it on GitHub https://github.com/mirfatif/PermissionManagerX/issues/21#issuecomment-1013250965, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACLOEDWHWF3MIGN2WCPPL3UWBCIZANCNFSM5KXRAXIQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you authored the thread.Message ID: @.***>
My phone isn't rooted so I have Tasker/Termux connect to ADB using the built in wireless debugging
By "built in wireless debugging" do you mean the Wireless debugging feature available on Android 11+? But adding pairing code and port already requires user interaction.
Yes.
Once paired (and with the "Disable adb authorisation timeout" developer option turned on just to make sure the pairing isn't forgotten after some time), you can pretty much have wireless debugging turned on without user interaction (mostly).
Tasker with the Tasker Settings addon (an addon intentionally written to
target a lower SDK version so it can do this) can set the Global setting
adb_wifi_enabled to 1. Android will popup the dialog asking if you
authorise the action on the current Wi-Fi network; the Tasker AutoInput
plugin taps yes for me. When wireless debugging starts, it outputs the
random port it's using to the logcat. Tasker can read the log and extract
the port number, which gets passed to a shell script in Termux, which uses
the port number with an adb binary there.
On Fri, 14 Jan 2022, 16:34 Irfan Latif, @.***> wrote:
My phone isn't rooted so I have Tasker/Termux connect to ADB using the built in wireless debugging
By "built in wireless debugging" do you mean the Wireless debugging feature available on Android 11+ https://mirfatif.github.io/PermissionManagerX/help/help.html#adb_help_11? But adding pairing code and port already requires user interaction.
— Reply to this email directly, view it on GitHub https://github.com/mirfatif/PermissionManagerX/issues/21#issuecomment-1013277315, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACLOEHWRA6FIDTXMFEL4OLUWBGCNANCNFSM5KXRAXIQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you authored the thread.Message ID: @.***>
Got it. I don't think many people will find this useful but adding to ToDo list.
Added in v1.13-beta1:
am startservice -n com.mirfatif.permissionmanagerx/.fwk.AdbConnectSvcM --ei "com.mirfatif.pmx.extra.ADB_PORT" 5555
Thank you very much for fulfilling this request. I got around to trying the command in ADB and did, somehow, manage to get the service to start - I got errors on my first few goes, something like "the app is in the background" and am refused to start the service. I think I had to turn on "appear on top" for Termux to allow it to reliably start programs. I don't know if this would help here with am refusing to start PM's service, but if so, could the same permission be added to PM, please?
Did you try with am start-foreground-service?
I can't seem to get the same error to occur again; if it does, I'll keep your tip in mind. Thank you very much.