Page 1 of 1

Blob pattern in action "init variable system setting

Posted: 17 Sep 2018 15:58
by Bluscre
Can you support blob in action "init variable system setting" to iterate over them?

Re: Blob pattern in action "init variable system setting

Posted: 21 Sep 2018 10:07
by Martin
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

Re: Blob pattern in action "init variable system setting

Posted: 22 Sep 2018 11:35
by Bluscre
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"

Re: Blob pattern in action "init variable system setting

Posted: 22 Sep 2018 17:17
by Desmanto
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/.

Re: Blob pattern in action "init variable system setting

Posted: 22 Oct 2018 09:27
by Bluscre
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

Re: Blob pattern in action "init variable system setting

Posted: 22 Oct 2018 12:31
by Desmanto
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: