[Android] Granting WRITE_SECURE_SETTINGS permission via ADB

Table of Contents

[Android] Granting WRITE_SECURE_SETTINGS permission via ADB

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/repository/platform-tools-latest-windows.zip Linux - https://dl.google.com/android/repository/platform-tools-latest-linux.zip Mac - https://dl.google.com/android/repository/platform-tools-latest-darwin.zip

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

https://developer.android.com/studio/command-line/adb.html

Lấy danh sách thiết bị

adb devices -l

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

image


https://www.tapatalk.com/groups/macrodroid/granting-write_secure_settings-permission-via-adb-t2923.html

https://gist.github.com/soiqualang/e62fde6fc0606621fde3a3c7a3f3d649

Leave a Reply

Your email address will not be published. Required fields are marked *