ADB Hack - Granting extra capabilities via the ADB tool

Endercraft

Moderator (& bug finder :D)
in a place where WRITE_SECURE_SETTINGS it is necessary to write or it is necessary to write?
What is that supposed to mean ?

I translated it using DeepL and apparently it means :
in the place where *WRITE_SECURE_SETTINGS* must be written or should be written?
 

Endercraft

Moderator (& bug finder :D)
Go to MacroDroid's settings (in the settings app not MacroDroid), there may be other permissions. There you can allow all. Also check MacroDroid's troubleshooting section.
 

Jack Bauer

New member
Go to MacroDroid's settings (in the settings app not MacroDroid), there may be other permissions. There you can allow all. Also check MacroDroid's troubleshooting section.
my oppo find2 pro phone have give all permissions to MD and helper。。but still not can change them
only when I set "Disable permission monitoring" in developer options.
they all can be done。
maybe it just can not work in colorOS
 

sami_b

New member
HI all
i have a Xiaomi 12T Android 12
I can connect to phone but get this error message :

Code:
C:\platform-tools>adb devices
List of devices attached
KNLJI7MZONIJPZW4        device


C:\platform-tools>adb shell pm grant com.tombayley.miui android.permission.WRITE_SECURE_SETTINGS

Exception occurred while executing 'grant':
java.lang.SecurityException: grantRuntimePermission: Neither user 2000 nor current process has android.permission.GRANT_RUNTIME_PERMISSIONS.
        at android.app.ContextImpl.enforce(ContextImpl.java:2189)
        at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:2217)
        at com.android.server.pm.permission.PermissionManagerService.grantRuntimePermissionInternal(PermissionManagerService.java:1490)
        at com.android.server.pm.permission.PermissionManagerService.grantRuntimePermission(PermissionManagerService.java:1472)
        at android.permission.PermissionManager.grantRuntimePermission(PermissionManager.java:378)
        at com.android.server.pm.PackageManagerShellCommand.runGrantRevokePermission(PackageManagerShellCommand.java:2384)
        at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:260)
        at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
        at android.os.ShellCommand.exec(ShellCommand.java:38)
        at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:25118)
        at android.os.Binder.shellCommand(Binder.java:956)
        at android.os.Binder.onTransact(Binder.java:840)
        at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4818)
        at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:8688)
        at android.os.Binder.execTransactInternal(Binder.java:1190)
        at android.os.Binder.execTransact(Binder.java:1149)
 

Endercraft

Moderator (& bug finder :D)
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" and disable it.
It can also be caused by not enabling USB debugging (secure settings)
 

RicMck

New member
Samsung S21 Helper ADB hack does not work? I have done the ADB programing twice per the instructions and MacroDroid does not connect to the helper app? I'm trying to get the S21 to toggle the WiFi. Any suggestions- recommendations?
 

Endercraft

Moderator (& bug finder :D)
Samsung S21 Helper ADB hack does not work? I have done the ADB programing twice per the instructions and MacroDroid does not connect to the helper app? I'm trying to get the S21 to toggle the WiFi. Any suggestions- recommendations?
2 VERY important things to check :
- MacroDroid and it's helper are excluded from every battery optimization. Follow the guide at dontkillmyapp.com.
- MacroDroid and it's helper are both granted location permission.
 

MrFennec

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.

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

On Redmi note 11 works very well, thank you :)
 

sidelve

New member
Hello, should the enable/disable mobile data action (via adb, no root) work in Android 13?

I can see the "on/off" slider is actually switching when I attempt to do on/off action from MacroDroid, but it has no real impact on the settings.


Example #1
- Mobile data ON,
- attempt to disable it via Macrodroid,
- outcome: slider = off, actual mobile data = on (visible LTE icon)
1676500606019.png


Example #2 (The other way):
- Mobile data OFF,
- attempt to enable it via Macrodroid,
- outcome: slider = on, actual mobile data = off (no LTE icon)
1676500758088.png

This is Pixel 6a on GrapheneOS (Android 13).
Enabled SECURE_SETTINGS and CHANGE_CONFIGURATION via adb without any issues (the fact that the outcome of MacroDroid attempt is actually switching the slider probably confirms that the initial adb setup is correct, right?).
 

Endercraft

Moderator (& bug finder :D)
Hello, should the enable/disable mobile data action (via adb, no root) work in Android 13?

I can see the "on/off" slider is actually switching when I attempt to do on/off action from MacroDroid, but it has no real impact on the settings.


Example #1
- Mobile data ON,
- attempt to disable it via Macrodroid,
- outcome: slider = off, actual mobile data = on (visible LTE icon)
View attachment 4560


Example #2 (The other way):
- Mobile data OFF,
- attempt to enable it via Macrodroid,
- outcome: slider = on, actual mobile data = off (no LTE icon)
View attachment 4561

This is Pixel 6a on GrapheneOS (Android 13).
Enabled SECURE_SETTINGS and CHANGE_CONFIGURATION via adb without any issues (the fact that the outcome of MacroDroid attempt is actually switching the slider probably confirms that the initial adb setup is correct, right?).
Well, as described in the action it may not work on all devices. There's nothing else to do else than root I'm afraid.
 

Dimlos

Well-known member
Hello, should the enable/disable mobile data action (via adb, no root) work in Android 13?
I tried with Google Pixel 7 Pro but it did not work. If you really want to switch on/off mobile data with MacroDroid, you can use ADB Shell [Tasker Plugin] and use adb command.
 
Top