Can't grant MacroDroid Helper v1.8 WRITE_SECURE_SETTINGS permissions

aitn

Member
Hello,
I got the following phone:
Moto G Pure | 2021 | 2-Day battery | Unlocked | Made for US by Motorola | 3/32GB | 13MP Camera | Deep Indigo
https://www.amazon.com/gp/product/B09BTB5MKT/
It has an Android 11 installed.
I'm trying to grant MacroDroid Helper v1.8 the WRITE_SECURE_SETTINGS permissions.
I'm able to connect to the phone through adb from my pc, and I run the following command (some info was censored):

#################################################################################################################

C:\adb>adb -s 192.168.X.X:AAAAA shell pm grant com.arlosoft.macrodroid.helper android.permission.WRITE_SECURE_SETTINGS

C:\adb
#################################################################################################################

As you can see, I don't get any errors, but when I try to check what permissions are granted for it, this is what I get:


As you can see it says under the granted permissions section the following:
android.permission.WRITE_SECURE_SETTINGS: granted=false, flags=[ USER_SET]
I tried to restart the phone, reconnect to adb and what not but to no avail. Strangely enough other permissions did stick as you can. So not sure why it's blocking it or preventing from setting it to true? I didn't see any errors in logcat either when I ran the command. I'm doing this so I can enable the wireless debugging setting with Macrodroid with the help of the Macrodroid Helper (v1.8 is the latest version of the helper).

Any idea how can I resolve this?

Thank you.
 

Endercraft

Moderator (& bug finder :D)
Wow, I don't think I've seen this before.. Have you granted every USB debugging permission in developer options ?
192.168.X.X:AAAAA
This is your local IP address. It is only used inside your network to identify your device (it is safe to say). Your public IP address (that every website can see) is your router's one (or provider if you are on mobile data but I'm not sure).
 

aitn

Member
Wow, I don't think I've seen this before.. Have you granted every USB debugging permission in developer options ?

This is your local IP address. It is only used inside your network to identify your device (it is safe to say). Your public IP address (that every website can see) is your router's one (or provider if you are on mobile data but I'm not sure).
What are the USB debugging permissions? I’m connecting to the phone through adb wireless debugging to run the command. This is an issue with the pm grant command or the Macrodroid Helper app, not with the adb command.
 

Endercraft

Moderator (& bug finder :D)
It still counts for adb even if in wireless or tcpip.
The toggles should be located under wireless debugging (secure settings also needs to be enabled).
 

aitn

Member
It still counts for adb even if in wireless or tcpip.
The toggles should be located under wireless debugging (secure settings also needs to be enabled).
Here is what I have:

2F85F67C-012D-4581-9935-910EEADE53FB.jpeg

B95FCFAA-EC07-4986-A285-DC11825C282A.jpeg

Where is secure settings? When I search for the word “secure” it doesn’t find anything. What’s the full name of the setting? How is it showing in yours, got a screenshot? Keep in mind I’m on Android 11, maybe you got a newer Android version with this setting and I don’t?
 

Jacob L

Moderator (Lawsonator)
Does it make a difference if you disable verify apps and verify bytecode from the screenshot.

It's adb shell not just shell
 

aitn

Member
Does it make a difference if you disable verify apps and verify bytecode from the screenshot.

It's adb shell not just shell
I turned off both settings. I ran it as adb shell:

C:\adb\platform-tools_r34.0.3-windows\platform-tools>adb connect 192.168.X.X:AAAAA
* daemon not running; starting now at tcp:5037
* daemon started successfully
connected to 192.168.X.X:AAAAA

C:\adb\platform-tools_r34.0.3-windows\platform-tools>adb shell echo test
test

C:\adb\platform-tools_r34.0.3-windows\platform-tools>adb shell pm grant com.arlosoft.macrodroid.helper android.permission.WRITE_SECURE_SETTINGS

C:\adb\platform-tools_r34.0.3-windows\platform-tools>adb shell dumpsys package com.arlosoft.macrodroid.helper > test.txt

I attached the file that was generated.
As you can see, it still shows as non granted:

android.permission.WRITE_SECURE_SETTINGS: granted=false, flags=[ USER_SET]
 

Attachments

  • test.txt
    14.2 KB · Views: 3

aitn

Member
@Jacob L @MacroDroidDev I just tried to re-install the helper. Same issue. Is there an older apk version of the helper I could try such as v1.7 or below?
@Jacob L @MacroDroidDev Any updates/chance you could provide me please the older MD helper apks from the archive (I couldn't find it when I googled for it)? I have a feeling the older ones might work better for my Motorola Android 11 including granting it the permissions it needs for WRITE SECURE SETTINGS?

I already have/tried: v1.0 and v1.7. Looking for v1.1-v1.6.

Thank you!
 
Last edited:

Endercraft

Moderator (& bug finder :D)
Maybe it's your device that does not want this permission to be granted for some reason ? Does granting the same permission to MacroDroid work ?
@JosueG28 Isn't there is an issue where some settings and permissions are not allowed to be enabled like accessibility ? That could be the case here.
 

aitn

Member
Maybe it's your device that does not want this permission to be granted for some reason ? Does granting the same permission to MacroDroid work ?
@JosueG28 Isn't there is an issue where some settings and permissions are not allowed to be enabled like accessibility ? That could be the case here.
I suppose it is my device since other people didn’t have this issue.
I don’t want to mess with MacroDroid permissions (it does seem to have the write secure permissions - somehow I was able to grant it those permissions early on), but I tried to revoke the media access location from MD Helper and when I use the dumpsys command it still shows as grant = true under runtime permissions, so I’m not quite sure what’s going on, these settings don’t really reflect even if I try to change it in the app permissions in the UI. But something seems to be fucked up with permissions manager or something... I had the same issue with MD Helper v1.7 so maybe it’s a wide system issue for me.

How does the adb hack works exactly? Like if write secure settings is not easily allowed for apps by design, then how it’s supposedly so easy to just go to adb and grant any app with those permissions? Isn’t there more to it to make it a real “hack”? Because right now it seems like the system somehow blocks me from doing it, and there are no logs to indicate why.
 

Endercraft

Moderator (& bug finder :D)
It does seem like you are missing the USB Debugging security settings permission for some reason. I'm not sure how you would have successfully granted the secure settings permission to MacroDroid then...
 

aitn

Member
It does seem like you are missing the USB Debugging security settings permission for some reason. I'm not sure how you would have successfully granted the secure settings permission to MacroDroid then...
Not sure either, early on I used usb adb cable then I switched to wireless adb. I don’t think it matters really but maybe between then and now something got corrupt and now it won’t properly grant/revoke permissions anymore. I’m just doing this to find an elegant way to enable wireless debugging, but even the tile for that one is buggy, it seems like I have no choice but go to settings and do it the ugly way using ui interaction to flip the setting on boot, plus I need to do it anyway to stop some motorola software update services (because there is no easy way to do it either), so I guess it can’t always be pretty, sometimes it just have to be quick and dirty lol
 
Last edited:

Dimlos

Well-known member
I am interested in this issue and will try to get a device to verify.
The device will probably be available in about a week.
I should be able to see if WRITE_SECURE_SETTINGS works on the new one.
 

Dimlos

Well-known member
I purchased it and gave it permission as it is, but it can be executed normally and I was able to check it in the terminal.
I checked to see if there is a setting on Moto G Pure that limits ADB, but it doesn't seem to be specific.
I don't know why it is not possible to grant it on @aitn devices, but at least I could confirm that it is not a Motorola limitation or a MacroDroid limitation.
 

Attachments

  • terminal.jpg
    terminal.jpg
    84.1 KB · Views: 6

aitn

Member
I purchased it and gave it permission as it is, but it can be executed normally and I was able to check it in the terminal.
I checked to see if there is a setting on Moto G Pure that limits ADB, but it doesn't seem to be specific.
I don't know why it is not possible to grant it on @aitn devices, but at least I could confirm that it is not a Motorola limitation or a MacroDroid limitation.
Interesting, thanks for checking. So it must be some environment/os software issue for me? What would you recommend to restore? Is factory reset the only option here?

Would you be kind and share please your android version/date and software update version/date? I want to compare yours to mine to see if one of Motorola’s forced “security updates” did this.

Btw, now that you have the same phone, here is a macro I created for it that will stop the Motorola Software Update services at boot:

 
Last edited:

aitn

Member
If you are using an USB cable, consider trying another one.
Well I was using adb wireless debugging so I guess it’s not a cable issue. I was already able to overcome the problem by toggling the wireless debugging using ui interaction, so that’s really the only reason why I wanted these permissions.

But it might come in handy in other potential things that I will need in the future so I’ll need to figure out what caused this to break and/or how to fix this. Maybe I’ll have to backup all data, factory reset and then restore the data one by one until I find out what’s causing it.
 
Last edited:

Dimlos

Well-known member
@aitn
You may have already tried this, but I believe that uninstalling Helper will reset the permissions.
If you let me know your Build number, I will update to the same version and verify.

Device name / moto g pure
Model / XT2163-4
Android version / 11
Build number / RRH31.Q3-46-123
 

aitn

Member
@aitn
You may have already tried this, but I believe that uninstalling Helper will reset the permissions.
If you let me know your Build number, I will update to the same version and verify.

Device name / moto g pure
Model / XT2163-4
Android version / 11
Build number / RRH31.Q3-46-123
Yes, I even tried to install an older version of the helper v1.7 but it didn't seem to help.
My MacroDroid permissions do seem to have the write secure permissions - somehow I was able to grant it those permissions early on, but I tried to revoke the media access location from MD Helper and when I use the dumpsys command it still shows as grant = true under runtime permissions, so I’m not quite sure what’s going on, these settings don’t really reflect even if I try to change it in the app permissions in the UI. But something seems to be messed up with the permissions manager or something... Since I had the same issue with MD Helper v1.7 so maybe it’s a wide system issue for me.

This is mine:
Model / XT2163-4
Android version / 11
Build number / RRH31.Q3-123-5-4

I wonder if my build which is "123-5-4" which is higher than yours "46-123" is what's blocking me from doing the permissions changes. Might need to see the Motorola updates revision history if they provide such thing if they did anything to block adb permissions updates in the name of "security concern".

UPDATE: Looks like on "Thu. Mar 30, 2023, PM pacific Daylight Time" I already had "RRHS31.Q3-46-123-(3 OR 5 OR 5-1)" and on 4/12/23 I installed Macrodroid and was able to grant it write secure settings permissions or some time after finding about the "adb hack" commands needed, so maybe it's not caused by these updates but something else... I’ll need to figure out what caused this to break and/or how to fix this. Maybe I’ll have to backup all data, factory reset and then restore the data one by one until I find out what’s causing it.

Anything special in your developers options settings that is different than my settings I provided in the screenshots above? Are you using wireless debugging or USB debugging? What's your permissions manager settings for MD helper is like or general settings? I'm thinking maybe I need to test other apps permissions to see if it's a system issue not specific to MD helper.

Last but not least, is there any other app that I could easily install that you could test granting the write secure settings permission and confirming that it’s giving it the permissions? That way I could do the same test on that other app to confirm that this is not specific to MD Helper.

Thanks again.
 
Last edited:
Top