You have root right? You want to try this step by step, or else troubleshooting it will be a pain.
1. First disable AutoSync and run this command from your terminal shell as root:
grep listen-for-tickles /data/system/sync/accounts.xml
With luck, this will return something like: "listen-for-tickles=false"
Then enable AutoSync and run the command again:
grep listen-for-tickles /data/system/sync/accounts.xml
Again, with luck, this time you'll get back nothing. That's how you'll program-matically detect the two states.
2. Everything else is just refinements:
grep listen-for-tickles /data/system/sync/accounts.xml | wc -l
will return 1 for AutoSync disabled, 0 for enabled.
3. To make the values more normal, flip it around this way:
echo $((1 - `grep listen-for-tickles /data/system/sync/accounts.xml | wc -l`))
will return 1 for AutoSync enabled, 0 for disabled.
4. I would use the Secure Settings plugin to execute the shell command, since it can run commands as root, and it can accept return values from the shell command. That's more elegant than the write value into a file and then read it from the file method I used.
Tom