Blob pattern in action "init variable system setting

Post your feature requets for new triggers, conditions, actions and other improvements.

Moderator: Martin

Locked
User avatar
Bluscre
Posts: 145
Joined: 31 Aug 2017 13:58
Location: Germany
Contact:

Blob pattern in action "init variable system setting

Post by Bluscre » 17 Sep 2018 15:58

Can you support blob in action "init variable system setting" to iterate over them?
Unofficial AutoMagic Telegram Group: https://t.me/automagicforandroid
Check out my other flows here: https://github.com/Bluscream/AutoMagicFlows or here.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Blob pattern in action "init variable system setting

Post by Martin » 21 Sep 2018 10:07

I'm not sure if I understand your request properly. Do you want to enter a glob pattern in the action 'init variable system setting' so that the action would return a list of all matched settings?
In this case I would prefer to return a map that contains the key and the value of each matched setting.

You could already build a loop to query each setting of interest. To achieve this you can initialize a list with the setting names of interest in a script action and then add a template to loop over the list:
-in the script action build the list with: items = newList("setting1", "setting2", "setting3");
-save the script action
-drag the plus-icon from the script action down, select 'Template', 'Loop over list (condensed)'.
-replace action 'Notification on Screen' by action 'Init Variable System Setting' and one more action to do whatever you want to do with the setting value.

Regards,
Martin

User avatar
Bluscre
Posts: 145
Joined: 31 Aug 2017 13:58
Location: Germany
Contact:

Re: Blob pattern in action "init variable system setting

Post by Bluscre » 22 Sep 2018 11:35

You could already build a loop to query each setting of interest. To achieve this you can initialize a list with the setting names of interest in a script action and then add a template to loop over the list:
That does not apply to the scenario where i want to use it: i want a object containing all system setting (or a part of them) so i know all entries in the system settings. For example to find anything containing "ad" or "id"
Unofficial AutoMagic Telegram Group: https://t.me/automagicforandroid
Check out my other flows here: https://github.com/Bluscream/AutoMagicFlows or here.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Blob pattern in action "init variable system setting

Post by Desmanto » 22 Sep 2018 17:17

Martin wrote: In this case I would prefer to return a map that contains the key and the value of each matched setting.
+1 for this. Having a map that contains all available value from each global, secure, system, will be nice. Previously, I ended up using execute root command, cat those 3 xml and parse them using regex, rearrange them into new map. This require root.

@Bluscre : What android version you are using? I created the flow for Oreo 8.1. The configuration files has been changed after Nougat (CMIIW), it will stored as xml in /data/system/.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

User avatar
Bluscre
Posts: 145
Joined: 31 Aug 2017 13:58
Location: Germany
Contact:

Re: Blob pattern in action "init variable system setting

Post by Bluscre » 22 Oct 2018 09:27

Desmanto wrote:What android version you are using? I created the flow for Oreo 8.1. The configuration files has been changed after Nougat (CMIIW), it will stored as xml in /data/system/.
6.1
Unofficial AutoMagic Telegram Group: https://t.me/automagicforandroid
Check out my other flows here: https://github.com/Bluscream/AutoMagicFlows or here.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Blob pattern in action "init variable system setting

Post by Desmanto » 22 Oct 2018 12:31

Marshmallow 6.0.1 seems still using the SQLite database, as opposed to xml in Nougat 7.0+. But I found that the root command should work (probably require busybox)

Code: Select all

settings list global
settings list secure
settings list system
Each of this will output the key-value in format
KEY=VALUE
So you can split them or parse them into a list which you can iterate later.

But of course, it will better if the init variable system setting can provide us the full map of the whole system. Even then, we still need the global pattern support as has been supported in the trigger "System Setting Changed". Speaking of the trigger, now we can use the trigger to detect any changes in the system setting, so we can use to avoid using Control UI. I just found so many wonderful things can be done. I am recreating my flow from scratch now.

As additional request, because it is very similar, please provide a new action and trigger for the LOS too. Maybe can be called trigger "System Setting Changed (LineageOS)" and action "Init Variable System Setting (LineageOS)". Both are similar to the default android, except they are for LineageOS ROM. This will benefit LOS users and its derivative, since it is one of the most popular custom ROM and has so many forks based on it. I am using RR 6.2.0, which is based on LOS 15.1, and I can still use the Set LineageOS System Setting to change some setting, such as color calibration. I already have some evil things added to the to-do list :twisted:
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Locked