[Galaxy S II General] Namoi:
Hi guys,

First, well yes that escalated quickly in here ;)

I am an old follower of the Neat Thread even if i don't participate a lot : always 20 pages behind when i could post useful things (just finished BTW to catch 150 pages as i was very busy this week).

I followed with interest the moding/theming tutos there ;) it was a great moment :)

I always restricted myself from posting a kind of "quest" there even if Spanaa suggested it to me. Always had the feeling that it would be inappropriate. But here, as I see all of you great themers and modders, i have the feeling that i won't be out of place, and that maybe all together we could achieve it.

So basically, here is the challenge : To fix the broken Lidroid Toggles.

Indeed, since JB, some of the toggles are broken :

The first one is the ring sound toggle, but we could speak of it later as it is not a big deal.

The second one is the brightness ring : this one doesn't work anymore. Whichever option one choose in Sadvance, it will end always by either toggling to full/auto or low/auto. Try them, you will get the picture.

At first i thought the bug could be located in Lidroid.apk, but now i am sure it's not : The bug is inside systemui.

I had a report of a guy saying that the toggles worked on alliance Rom.

What i did was to decompile alliance rom systemui and the systemui from JB reloaded 1.07, then dex2jar the smalis added by wanam (the ones in JB reloaded) and the smalis from alliance Rom. They are mostly similar, "mostly"...

So i checked to see what happen when one trigger the toggles using logcat filtered by "brightness".

And i noted this : when one use the toggle, a class/method (?) is triggered the "BrightnessObserver". This object AFAIK is implemented in the smalis added by wanam/alliance in systemui. And the purpose of it is to report, as i understood, the level of the brightness scalled from 0 to 255.

Te value reported in a Sammy Rom is inaccurate, there is a -40 delta (i don't know to be honest which value is reported in Alliance)

So my guess is : when one click the toggle, the correct value is set, but the values reported is false, so when one click again, the toggles work on a biased value hence the bug in the toggle cycle.

You can try this by looking at the brightness slider in the notification and choose in Sadvance the longest ring.

You will need to disable auto brightness and move the slider to the bottom. Now click the toggle and watch the slider move up until it reach 100. When on 100 it will trigger the auto check box and it will get stuck there and switch from 100% to auto. (sometimes you can even see the slider going at the bottom but immediately go back to 100 and then auto. Difficult to explain, but obvious when you see it, and more obvious when you have a logcat dynamically shows you this (ie the Brightness observer values reported and the one effectively applied).

Frome here i am stuck : i don't have the knowledge to fix this. I can "read" (decipher ?) Java, but to understand what to do and where to do it is far beyond my scope.

So I come here to find some help to try to fix this which i think could profit to all of the users. I will help as much as i can.

Thanks guys :D