Permission error when running shell script

adarshhegde

New member
I was trying to run an adb command via the shell script action and i got security error, i tried granting the permission mentioned in the error log but it says macrodroid has not requested the permission, i really want to run some adb commands that I've tested via adb shell externally from my pc to switch active mobile data between two sim slots, it will be helpful if a native action can be implemented to do this or provide some guidance on how to get this shell script working, thank you

I've only tried running a simple adb command in the screenshot but here's the full working shell script that i want to run through macrodroid

current_sim=$(settings get global multi_sim_data_call)
current_sim in
1 ) settings put global multi_sim_data_call 2;;
2 ) settings put global multi_sim_data_call 1;;
* ) settings put global multi_sim_data_call 1;;
esac
svc data disable
svc data enable
 

Attachments

  • Screenshot_20230307-210637_MacroDroid.png
    Screenshot_20230307-210637_MacroDroid.png
    185.3 KB · Views: 13
  • Screenshot_20230307-210644_MacroDroid.png
    Screenshot_20230307-210644_MacroDroid.png
    371.4 KB · Views: 12
Last edited:

Dimlos

Well-known member
The ADB Shell [Tasker Plugin] allows you to execute adb commands.

To use ADB Shell [Tasker Plugin], you must first connect to your PC and enter the adb command adb tcpip 5555.
This command is valid until the device is rebooted.
 

FrameXX

Well-known member
AFAIK android.permission.INTERACT_ACROSS_USERS is a privilegied permission and can only be granted to system apps. Android shell does have this permission so what @Dimlos is proposing may work.

It seems you are trying to get a value of settings in the global table. Instead you could try to use the Set Variable action and set the "test" variable to {setting_global=multi_sim_data_call}.
 
Last edited:

adarshhegde

New member
I think you have misunderstood. The settings get global is a shell command that must be executed through the shell script action. I'm not setting global state. That entire string is part of an adb command ....
AFAIK android.permission.INTERACT_ACROSS_USERS is a privilegied permission and can only be granted to system apps.

It seems you are trying to get a value of settings in the global table. Instead try to use the Set Variable action and set the "test" variable to {setting_global=multi_sim_data_call}.
 

FrameXX

Well-known member
I think you have misunderstood. The settings get global is a shell command that must be executed through the shell script action. I'm not setting global state. That entire string is part of an adb command ....

Yes but you expect to get a value of that system settings as the output. The solution I proposed should do the same and set the "test" variable to value of this system settings without using any shell script whatsoever.

EDIT: I only looked at the screebshots 😮.
 
Last edited:

Dimlos

Well-known member
I think "svc data disable" and "svc data enable" will work for sure, but SIM related settings may not work even if they are reflected.
 

adarshhegde

New member
I think "svc data disable" and "svc data enable" will work for sure, but SIM related settings may not work even if they are reflected.
The settings are reflected and my mobile data is toggling between the two Sims when I test this through adb shell from my PC.

I tried the solution which @FrameXX mentioned earlier, the value doesn't seem to be changing realtime. It isn't reflecting the current active sim,

And regarding the Tasker plugin you mentioned, it doesn't seem to work on Android 13 😅
 

Attachments

  • Screenshot_20230308-021138.png
    Screenshot_20230308-021138.png
    274 KB · Views: 15

Dimlos

Well-known member
I don't think it doesn't work because of Android 13, but rather it doesn't work on your device.
It is installable and works on several devices I have.
 
Top