[Nook Touch General] LastSilmaril:
Some progress, I hope

Hey all,

So I read through the thread and decided to take a crack at this - much thanks to Dr_Diem for defining the problem and getting the ball rolling. Here are my findings; all changes described are viewable in the attached zip. (I have NOT done any testing yet, at all.)

1) BNGossamerQuickNavBar

a) The init() method hasn't actually changed between 1.1.2 and 1.1.5 nearly as much as Dr_Diem suggested. There's a whole section at the beginning of the method dedicated to figuring out whether or not the Nook has a Glowlight and setting a bit (mHasGlowLight) to that effect, and that bit gets checked in the course of the rest of the init, but the actual 'algorithm' for 'setting up' the buttons has not changed. Turned out not to be difficult to patch. I also made a minor modification/optimization to the glowlight checking code (can it be removed altogether? I'm scared) but if this doesn't work it's easy to roll back.

b) The changes I made necessitate a change in XorUtils.smali to support the extra button, however I'm not quite sure how to do this properly. More on this later.

c) I replaced the long onClick() method with Xor's.

d) Did not touch the new glow-related methods yet.

2) StatusBarService was indeed a quick fix.

3) PhoneWindowManager took the longest to deal with because of extensive changes between 1.1.0 and 1.1.5 - lots of extra methods and glow-related stuff stuck in there. Took this slow but think I've put XorZone's changes to 1.1.0 in the right spots. Still, I was flying a bit blind in here, especially in (a).

a) The key method here is interceptKeyTi, which is now much longer. I'm not sure what the 'algorithms' in here do, but I'm confident that I figured out the 'context' properly and put XorZone's changes in the right spot. Still, I'd check it out...

b) The other major blocks are in rotationForOrientationLw and showRecentAppsDialog, which have changed slightly but more or less work the same way and aren't super-long unwieldy beasts, so it wasn't difficult to patch in Xor's additions. There are some minor changes scattered about earlier as well.

c) PhoneWindowManager$9 is completely original to Xor so it'll be dropped in.

4) RecentApplicationsDialog

a) This is almost identical between 1.1.0 and 1.1.5, with very minor exceptions, so I just dropped in Xor's file and applied the changes to it.

b) RecentApplicationsDialog$1 is *exactly* identical between 1.1.0 and 1.1.5, so I just dropped in Xor, period.

c) RecentApplicationsDialog$2 and $3 are exclusive to Xor's framework, so these were also dropped in.

5) XorUtils from services.jar (didn't look at the one in android.policy.jar at all) needs to be patched in order for glowlight to work. This needs to happen in at least two places, in launchButton() and in updateQNButtonIcon().

a) I think I figured out part of what needs to happen in updateQNButtonIcon - the relevant part is just a switch - but there's one 128-bit parameter whose value I have to provide for the glowlight (for a bitmap or something?). It's at line 1074, if you want to take a look.

b) In launchButton, which is basically one big switch, I just added one for the glow. I'm not sure if I did this properly, however. The pack_switch starts at 0x1020196, and the number for the wedged-in glowlight button, per the untouched init() from 1.1.5, is 0x102019b, which is not sequential (the settings button gets 0x102019a). So I put the glowlight button last in the switch on that basis (seems to be like that in the stock onClick() as well).

c) I really don't know what to do with launchActivity() to make sure it works with the light and am not even sure that anything is necessary at all. That said, I really don't know how launchActivity itself works...

A few notes:

-GlowNooter does not seem to have changed any of the above files at all, and nor have any of them changed between 1.1.0 and 1.1.2.

-I don't 'speak smali' or whatever - just relying on what I know about assembly code (16-bit x86 and some ARM) and java from back in school, plus these helpful resources:

http://androidcracking.blogspot.com/2010/09/examplesmali.html

http://pallergabor.uw.hu/androidblog/dalvik_opcodes.html

http://www.netmite.com/android/mydroid/dalvik/docs/dalvik-bytecode.html

-I'm not sure if the cond_ labels in gotos and compares need to make sense and fit, or if they can be totally arbitrary. If the former, then there's more work to be done, as I have not been too careful in this regard.

-Everything I've done so far is attached. Changes are marked with a "# XOR" and "# END" comment. (I may have used others though, and anyway you should just diff them to find out what's going on.) Files marked 'ls' are mine; the older ones are also included for diffing/convenience.