ADB Hack - Granting extra capabilities via the ADB tool

MacroDroidDev

Administrator
Staff member
Starting with MacroDroid V3.16.11 (with some effort) you can now invoke the following features on a non-rooted device:

Battery Saver Action
Location Mode Action
NFC Enable/Disable Action
Set Language Action
Logcat Trigger
+ others as shown within the app.

In order to do this you will need a Windows/Linux based PC or a Mac plus Google's ADB tool which can be downloaded from the links below:

Windows - https://dl.google.com/android/repositor ... indows.zip
Linux - https://dl.google.com/android/repositor ... -linux.zip
Mac - https://dl.google.com/android/repositor ... darwin.zip

For instructions on configuring your device to connect via adb please see the following information:

https://developer.android.com/studio/co ... e/adb.html

Once you have a working adb connection, you need to run the following command from the command line/terminal on your computer:

adb shell pm grant com.arlosoft.macrodroid android.permission.WRITE_SECURE_SETTINGS

followed by:

adb shell pm grant com.arlosoft.macrodroid android.permission.CHANGE_CONFIGURATION

If you are using the demo mode action you will also need the following permission:

adb shell pm grant com.arlosoft.macrodroid android.permission.DUMP

If you are using the volume button long press trigger you will need the following permission:

adb shell pm grant com.arlosoft.macrodroid android.permission.SET_VOLUME_KEY_LONG_PRESS_LISTENER

If you are using the Logcat trigger you will need the following permission:

adb shell pm grant com.arlosoft.macrodroid android.permission.READ_LOGS

These commands will give MacroDroid permission to write to some restricted device settings that can normally only be done by system apps (or using root hacks).
It's a little bit of work but hopefully a nice solution for users who are unable to or don't want to root their device.

The features above are currently the only features that can be utilised by this adb permission hack, but I hope in the future I can expand the capability to allow additional features.

Permission error when granting

On some devices there can be an error granting ABD permission that looks like this:

Neither user 2000 nor current process has android.permission.GRANT_RUNTIME_PERMISSIONS

In this case please check your phone's developer options and look for a setting called "Disable permission monitoring" or "USB debugging (Security settings)" or anything similar and enable/disable it as appropriate.

Additional information for Helper File

Starting with MacroDroid v5.8 a new helper file is available to perform some limited functionality that cannot be done directly in the app. In order to grant ADB access to this helper file please use the following command:

adb shell pm grant com.arlosoft.macrodroid.helper android.permission.WRITE_SECURE_SETTINGS
 
Last edited:

njunju33

New member
Hack also doesn't work with my Redmi 6A.
you have to go to developer enable all three voices also debug security debug usb, then on adb do adb devices and see if it is connected, if it gives you the numbers then it is connected, then take and you copy and paste all the strings above one by one, when you're done it should work I solved it this way, but you have to put them all
 

roughnecks

Active member
you have to go to developer enable all three voices also debug security debug usb, then on adb do adb devices and see if it is connected, if it gives you the numbers then it is connected, then take and you copy and paste all the strings above one by one, when you're done it should work I solved it this way, but you have to put them all
Thanks, I know how to do it but (for example) I cannot activate mobile data with Macrodroid, it just doesn't work for me.
 

Dm114

Well-known member
Hi Jacob L, would you share your '.bat' file to be sure not to forget to grant any permission?

I guess I granted them all but as I recently changed my mobile, I'd like to ensure I didn't forget any of them...

Thanks in advance.
 

roughnecks

Active member
Hi Jacob L, would you share your '.bat' file to be sure not to forget to grant any permission?

I guess I granted them all but as I recently changed my mobile, I'd like to ensure I didn't forget any of them...

Thanks in advance.
There's a link down in video description.
 

HarryK

New member
Hello
I have set up ADB and I can run all the commands apart from:
adb shell pm grant com.arlosoft.macrodroid android.permission.WRITE_SECURE_SETTINGS

I get the message: Error: no permission specified

What I am trying to do is to get permission for NFC control.
Device is Xiaomi mi 10T PRO, with miui 12.1.2 and android 11.
Many Thanks

Actually the Jacob BAT script worked. ( I modified the MD helper install, as it was already there)
got NFC control..
 
Last edited:

Golden_Melky

New member
hi
I can't give permissions to the app, it gives me this error:

C:\Users\Francesco>adb shell pm grant com.arlosoft.macrodroid android.permission.WRITE_SECURE_SETTINGS
Security exception: grantRuntimePermission: Neither user 2000 nor current process has android.permission.GRANT_RUNTIME_PERMISSIONS.

java.lang.SecurityException: grantRuntimePermission: Neither user 2000 nor current process has android.permission.GRANT_RUNTIME_PERMISSIONS.
at android.app.ContextImpl.enforce(ContextImpl.java:1953)
at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:1981)
at com.android.server.pm.permission.PermissionManagerService.grantRuntimePermission(PermissionManagerService.java:2213)
at com.android.server.pm.permission.PermissionManagerService.access$1000(PermissionManagerService.java:131)
at com.android.server.pm.permission.PermissionManagerService$PermissionManagerServiceInternalImpl.grantRuntimePermission(PermissionManagerService.java:3317)
at com.android.server.pm.PackageManagerService.grantRuntimePermission(PackageManagerService.java:6719)
at com.android.server.pm.PackageManagerShellCommand.runGrantRevokePermission(PackageManagerShellCommand.java:2015)
at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:234)
at android.os.ShellCommand.exec(ShellCommand.java:104)
at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:24330)
at android.os.Binder.shellCommand(Binder.java:881)
at android.os.Binder.onTransact(Binder.java:765)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:5118)
at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4876)
at com.android.server.pm.OppoPackageManagerService.onTransact(OppoPackageManagerService.java:91)
at android.os.Binder.execTransactInternal(Binder.java:1021)
at android.os.Binder.execTransact(Binder.java:994)

adb is installed correctly, I've already used it on other occasions, but every time I try to give it permissions I can't.
my phone is Oppo A9 2020
if anyone will help me, I'll give them a cookie :D🍪
 

Jacob L

Moderator
Sometimes in developer options there's another option for allowing more via ADB. In some cases, this option is in security settings. I don't remember the name of the setting either.

Did you try the .bat file?
 

chaoscreater

Active member
hi
I can't give permissions to the app, it gives me this error:



adb is installed correctly, I've already used it on other occasions, but every time I try to give it permissions I can't.
my phone is Oppo A9 2020
if anyone will help me, I'll give them a cookie :D🍪
You need to disable Permission Monitoring in Developer Options.
 
  • Like
Reactions: nuB

nuB

New member
Starting with MacroDroid V3.16.11 (with some effort) you can now invoke the following features on a non-rooted device:

Battery Saver Action
Location Mode Action
NFC Enable/Disable Action
Set Language Action
Logcat Trigger
+ others as shown within the app.

In order to do this you will need a Windows/Linux based PC or a Mac plus Google's ADB tool which can be downloaded from the links below:

Windows - https://dl.google.com/android/repositor ... indows.zip
Linux - https://dl.google.com/android/repositor ... -linux.zip
Mac - https://dl.google.com/android/repositor ... darwin.zip

For instructions on configuring your device to connect via adb please see the following information:

https://developer.android.com/studio/co ... e/adb.html

Once you have a working adb connection, you need to run the following command from the command line/terminal on your computer:

adb shell pm grant com.arlosoft.macrodroid android.permission.WRITE_SECURE_SETTINGS

followed by:

adb shell pm grant com.arlosoft.macrodroid android.permission.CHANGE_CONFIGURATION

If you are using the demo mode action you will also need the following permission:

adb shell pm grant com.arlosoft.macrodroid android.permission.DUMP

If you are using the volume button long press trigger you will need the following permission:

adb shell pm grant com.arlosoft.macrodroid android.permission.SET_VOLUME_KEY_LONG_PRESS_LISTENER

If you are using the Logcat trigger you will need the following permission:

adb shell pm grant com.arlosoft.macrodroid android.permission.READ_LOGS

These commands will give MacroDroid permission to write to some restricted device settings that can normally only be done by system apps (or using root hacks).
It's a little bit of work but hopefully a nice solution for users who are unable to or don't want to root their device.

The features above are currently the only features that can be utilised by this adb permission hack, but I hope in the future I can expand the capability to allow additional features.

Additional information for Helper File

Starting with MacroDroid v5.8 a new helper file is available to perform some limited functionality that cannot be done directly in the app. In order to grant ADB access to this helper file please use the following command:

adb shell pm grant com.arlosoft.macrodroid.helper android.permission.WRITE_SECURE_SETTINGS
Thank you much! I been trying to think of the adb pm (permission manager) abbreviated syntax and my droid unfortunately has lost all capacity to show clipboard as well as network latency on the RF signal as I can't log into github because I never got the email verified. I thank you sir. I have been sitting here trying to remember -ubntu- As a matter of fact -@GOLDEN MEEKLY- you can try to invoke Ubuntu, _// $ * adb pm chroot, try to change the location of root permiss. And then also ::// $ * - - chown - - change owner ship. Then you can simply start with a new platform with c. L. s then mkdir and enable the parameters for filsystems < full > 0 - 9999 pgs.
That is old stuff though, u better brush up on the syntax. Ubuntu + debian and you will gain access.
 
Top