by Ricardo Fernández Serrata
More efficient in EVERY aspect. Time, Space, and Energy are efficiently used.
The Fork is only used for responsiveness (because Get Setting and Toast have latency that could prevent Content Changed to detect a new change), you can use a simple loop if you don't need too much responsiveness.
`s & 3` exists because dictionaries are expensive, so I tried to find something that allows optimization, and realized that the 4th char of all of them at the rightmost (least significant) bits, matches their IDs ("system" is 0b00, "secure" is 0b01, and "global" is 0b10). I used `& 3` instead of `% 4` because of a benchmark I did on my device where `modulo` was slower than `bit and`. Bitwise ops require 2-way conversions, but they seem faster than software division.
Rate and review within the app in the Community section.