yashsingh1/xdaforums huggingface dataset:
[Nook Touch General] LastSilmaril:
Thanks Renate! I remember that labels were arbitrary back in the day but wasn't sure now. But now, I'm not quite sure how to avoid the instruction code trap.

IIRC, I have only added registers once, in BNGossamerQuickNavBar's init() method.

EDIT: Looks like I was sloppy in the init() method and specified use of an extra register at the beginning but failed to use it. But looking over it, I'm not sure why another register is even necessary except to match up with the addition of another register between 112 and Xor, so I changed it back to the amount of registers the 115 version had. The v7 register used for glowlight checking in the 115 version can just be reused, right? I attached the init methods from all 4 versions below...
[Nook Touch General] LastSilmaril:
Out of curiosity, I decided to just dump what I've done so far back into android.policy and services, re-dexing the files and drop them in on the nook. When I try to reboot, this causes it to get stuck booting forever. (Made a backup right before so no harm/foul.)

There is more work to be done!

-e
[Nook Touch General] LastSilmaril:
This was with using the post-root 1.1.5 jars as a base.
[Nook Touch General] dr_diem:
Thanks for your work LastSimaril! (Also thanks for your sage input Renate).

I've not had time to review your new code yet, but certainly will do when my annoyingly busy schedule allows, and will develop and test it further if I can. We will get there!
[Nook Touch General] probbiethe1:
I am interested in this as well. I dont have much knowledge of smali but I can help test anything that anyone comes up with
[Nook Touch General] probbiethe1:
I am just wondering if anyone has made any advancements on this.
[Nook Touch General] dr_diem:
Am slowly reviewing the code LastSilmaril posted, to try to work out why it failed in his test. More here when I've more to share..
[Nook Touch General] LastSilmaril:
I have been a bit bogged down, and, uh, actually wanted to read some books, but hopefully I'll be able to return to this project soon enough. I don't see why, at the very least, we can't remap the 'reading now' button, if we only implement the changes to StatusBarService and drop in the XorZone.smali. Then, maybe we could slowly build out from there. NookTouchTools.apk would have to be reimplemented to account for the extra button on the Nook bar and for the default long-press behavior. And of course I suspect the new glow-light code conflicts with the XorZone long-press implementation.
[Nook Touch General] probbiethe1:
Very cool. Let me know if I can run any tests.
[Nook Touch General] dr_diem:
I like this approach. On that basis I've created a services.jar containing your mods and XorUtils.smali. This being my first time trying this however, I'm stuck on copying this file back onto my device. Have backed up via Noogie and dd, started ADBWireless and copied over the new file, but on a running Nook cannot rename the existing file (as root), being told 'Access Denied'. How would you go about the rename/overwrite?

Ah yes, hadn't even thought about the long press bit, nor that changes will be required to NookTouchTools.apk itself.
[Nook Touch General] probbiethe1:
could you share that services.jar with us? I would like to test it out if possible
[Nook Touch General] dr_diem:
Sure, here you go, do you have a hint as to how to copy it over the existing version on the NSTG?
[Nook Touch General] LastSilmaril:
There are two ways of doing this: booting up your Nook with Noogie and connecting your Nook to a *nix box or somehow using a Windows tool that lets you write to ext2/3 (yeah, that sounds like a good idea) or, running this from the shell:

mount -o rw,remount /dev/block/mmcblk0p5 /system

That makes the /system partition writable. You can also copy over systemrw and systemro scripts to /system/bin to do this for you (of course only after running the above code to make system writable at least once without using the little scripts you'll be copying in themselves). I attached these (they're from, originally, I think, eded's CWM thread somewhere, but packaged in a CWM zip, and it's easy enough to just write your own, but I figured what the hell)

ALSO: Can you please comment on what your base 1.1.5 jar is? Glownooted? Stock? Something else?
[Nook Touch General] probbiethe1:
Thanks for sharing this with us. I tried it out and I dont see any difference from the stock one. Maybe I just dont understand what its suppose to do.
[Nook Touch General] dr_diem:
D'oh! Of course - forgot about /system being ro. Thanks for the reminder (plus the handy scripts idea).

My base 1.1.5 services.jar for this work is Glownooted, but some time back I established that there are no differences between Glownooted and stock v1.1.5 services.jar and android.policy.jar, which does make our job a bit simpler.

@probbiethe1, so far the only difference is that when you tap the 'reading now' icon at screen top-left, it uses Xor's code to implement the link instead of the stock code. If that works in your test then we've at least made step 1 (of many!).

Hmmm, okay, replaced the services.jar with mine but now the 'Reading Now' button does nothing at all, nor do any of the other status bar buttons, so I think that my jar was poorly constructed (as distinct from the modifications having been wrong). Will go looking at the logs to see if they suggest anything useful..

..all I get in the main log (adb logcat) when I tap anywhere on the status bar is:

D/StatusBar( 775): Default clicked

which to my ignorant eye looks like a UI message. Will try again with the stock services.jar back in place..

..and yeah, with stock services.jar I get:

D/StatusBar( 775): Sending intent to launch last book
I/ActivityManager( 775): Starting activity: Intent { act=android.intent.action.VIEW dat=file:///data/media/B&N Downloads/Books/9780

followed by a bunch more stuff which is self-evidently 'right', and also means that I was wrong, the log line sent with the modified jar in place was not a standard UI message, it was indeed telling us that nothing was picking up and processing the click on the status bar area. Regardless, to my mind this just means the modified jar was malpackaged and hence is not working at all. Back to the drawing board..
[Nook Touch General] probbiethe1:
O OK I see now, My status bar is doing the same thing so at least we know the .jar file does do something. Is there any way we could change it so that the quick nav bar buttons dont do anything?
[Nook Touch General] LastSilmaril:
The next step is to install NookTouchTools.apk and attempt to assign a diff app to that top button. But I'm watching the debate atm.

EDIT: I didn't read the post too closely, and can confirm that none of the status bar buttons work at all now, including the notifications icon. NookTouchTools checks for a patched android.policy.jar before allowing any remapping of B&N buttons, including the ReadingNow button. The Nook also took much longer than usual to boot up.
[Nook Touch General] LastSilmaril:
So I rolled my own replacements for services.jar and android.policy jar, but used the stock BNGossamerQuickNavBar. This allowed the glowworm to boot, so I'm assuming that the bootlooping is due to the changes I made in BNGQNB, somehow. Either that, or I rolled the jars badly or something last time.

The changes in SBS still do not allow for the StatusBar to work whatsoever.

Putting in the patched android.policy.jar does allow the NookTouchTools 'B&N Buttons' menu to function. I did not, of course, attempt to reassign stuff on the QuickNav bar. I tried to reassign the ReadingNow button, but it remained unresponsive, as did all the other buttons I tried, which all gave the same message in logcat (see dr_diem's post).

One thing that did work is long-press. You can, in fact, assign something to the longpress via NookTouchTools (not assigning will mean a long press bring up the Recent Apps dialog). Because of this, I had a way to check if the orientation switcher works - and indeed it does! However, longpressing will simultaneously toggle the light, hehe.

The long boot-up I reported initially does not apply to subsequent reboots - not the same extent anyway - so I guess that was due to the file changing, or something.

Attached is a logcat output, which at the beginning shows NTT.apk crashing. I do not think this is related to pushing any of the status bar buttons.
[Nook Touch General] dr_diem:
My testing matches your LastSilmaril, with one addition:

- long bootup just once after replacing framework jar

- a notification that "8 tasks killed, <X> MB free"

- greyed-out 'B&N Buttons' in NookTouchTools due to missing android.policy.jar

For what it's worth, side-button remapping works (even with the stock jars) but is not particularly useful. When reading a book, here's what each potentially interesting remap does:

HOME - as if the 'n' button has been pressed

MENU - no effect

BACK - no effect

SEARCH - as if the Search option on the 'n' button menu had been pressed, only not displaying the status bar

LastSilmaril, what's your take on the log output and status bar non-function with your services.jar? Do you think that it's a question of the code changes not being right yet, or that they're correct but cannot help until appropriate (re)mapping is done in NookTouchTools? I'm thinking the former - surely the rest of the status bar should work otherwise?

yan
[Nook Touch General] LastSilmaril:
Sorry, you used the android.policy.jar that I included in the above zip, but it didn't result in you being able to use the B&N Buttons menu? Or did you not push it at all?

You managed to get a notification? Is that from Advanced Task Killer or something? Because as a consequence of the status bar not working, I've found that though the number of notifications listed by the notifications button increases, the notifications themselves also do NOT pop up.

Cool beans. I really do not care about this functionality so didn't test it at all. I think roustabout said that the side-button remap works, but in his testing only on rooted NSTGLs without gapps. I don't know if I changed anything, or if this functionality is related to something in the XorZone smalis I added back in. In any case, good to know.

I'm honestly not sure. Maybe both are true. But the fact that the rest of the status bar does not work at all leads me to believe that I missed something, or that there was some change in 115 elsewhere that is mucking things up. It is possible that this is an issue with XZ tools. I dunno, let's see :silly:

-e
[Nook Touch General] dr_diem:
Didn't push it - I only pushed my build of services.jar.

Ah, I think it'll have been from Autorun Manager - that's the only thing that runs after boot to control what tasks are running. It popped up by itself - the notification button doesn't work.

Short version is that our results are effectively identical.
[Nook Touch General] dr_diem:
In further reading I think the delayed startup might be to do with rebuilding the dalvik-cache, on the basis that the Nook senses a change to the files that make up that cache.

Also, in my tests up 'til now I hadn't set the permissions of the replacement jar correctly (to 644), but retested just now and it made no difference.
[Nook Touch General] LastSilmaril:
Oh noes! Weesa crashéd

I figured out the issue with the unresponsive StatusBar. This was due to my subtracting where the pswitch starts by a byte, changing it back to the way it was in 112 from 115. Changing it back to the 115 default makes it responsive again. Change should never have been made.

However, clicking the Reading Now button now results in a partial reboot of the Nook, regardless of whether you assigned anything to it in NookTouchTools or not. Judging by the trace, it looks like our smart idea not to touch BNGQNB wasn't so smart after all. Looks like there's an invalid argument early on as well. Also there's a friggin 'verify error', whatever the hell that means. StackOverflow sez::

I'm not sure if this is a result of the apparent parameter mismatch (see the beginning of log) or if I'm using the wrong JDK (6u35 x64) or smali/baksmali (1.4) or something.

Note that the smiley is a semicolon followed by a closed parens.

D/StatusBar( 2637): Sending intent to launch last book

W/dalvikvm( 2637): VFY: register1 v1 type 0, wanted ref

W/dalvikvm( 2637): VFY: bad arg 2 (into Ljava/lang/String;)

W/dalvikvm( 2637): VFY: rejecting call to Lcom/android/server/status/XorUtils;.launchActivity (Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;Lcom/android/server/status/StatusBarService;Z)V

W/dalvikvm( 2637): VFY: rejecting opcode 0x71 at 0x0031

W/dalvikvm( 2637): VFY: rejected Lcom/android/server/status/XorUtils;.launchButton (Landroid/content/Context;ILcom/android/server/status/StatusBarService;)V

W/dalvikvm( 2637): Verifier rejected class Lcom/android/server/status/XorUtils;

W/dalvikvm( 2637): threadid=15: thread exiting with uncaught exception (group=0x4001b170)

E/AndroidRuntime( 2637): Uncaught handler: thread android.server.ServerThread exiting due to uncaught exception

E/AndroidRuntime( 2637): *** EXCEPTION IN SYSTEM PROCESS. System will crash.

E/AndroidRuntime( 2637): java.lang.VerifyError: com.android.server.status.XorUtils

E/AndroidRuntime( 2637):	at com.android.server.status.StatusBarService.onQuicknavButtonClick(StatusBarService.java:1784)

E/AndroidRuntime( 2637):	at com.android.server.status.StatusBarView.onClick(StatusBarView.java:136)

E/AndroidRuntime( 2637):	at android.view.View.performClick(View.java:2373)

E/AndroidRuntime( 2637):	at android.view.View.onTouchEvent(View.java:4197)

E/AndroidRuntime( 2637):	at android.view.View.dispatchTouchEvent(View.java:3727)

E/AndroidRuntime( 2637):	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:904)

E/AndroidRuntime( 2637):	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:904)

E/AndroidRuntime( 2637):	at android.view.ViewRoot.handleMessage(ViewRoot.java:1691)

E/AndroidRuntime( 2637):	at android.os.Handler.dispatchMessage(Handler.java:99)

E/AndroidRuntime( 2637):	at android.os.Looper.loop(Looper.java:123)

E/AndroidRuntime( 2637):	at com.android.server.ServerThread.run(SystemServer.java:434)

I/Process ( 2637): Sending signal. PID: 2637 SIG: 9​
[Nook Touch General] dr_diem:
Interesting stuff! The way I read the log it's the XorUtils class that's being rejected ("Verifier rejected class Lcom/android/server/status/XorUtils;") but there's also the suggestion that it's not the launchLastBook call that is the issue, rather the call it then makes to launchActivity ("rejecting call to Lcom/android/server/status/XorUtils;.launchActivity") with a parameter mismatch ("register1 v1 type 0, wanted ref" and "bad arg 2 (into Ljava/lang/String);"). This suggests that there's an internal issue with the XorUtils you have.

I note that in your work your XorUtils.smali is a single file, where when I smali'ed the NTT jars (from jars-1.1b0_nook1.1) I got two files from the services.jar one (XorUtils.smali and XorUtils$1.smali) and six(!) from the android.policy.jar one (same filenames as services.jar but up to $5).

FWIW, I am using apktool 1.4.3 and JDK 1.6.0_35; could you post your fixed StatusBarService.smali (I think I could reproduce your corrections, but I'd like to test exactly like with like) and I'll try it out on my setup.
[Nook Touch General] LastSilmaril:
Right, so changes may need to be made to the android.policy XorZone smalis (all included in the above zip) too, I suppose. The changes I made to XorZoneUtils should not have anything to do with this, since I didn't touch launchActivity at all, and didn't really know what to do with it. Further investigation is required, heh...
[Nook Touch General] dr_diem:
Some progress! I have a tweaked services.jar that uses XorUtils to launch the last book being read :victory:

I took a vanilla, Glownooted 1.1.5 services.jar (though it is already established that Glownoot does not change this jar), baksmali'ed it, inserted Xor's changes to StatusBarService, then smali'ed and pushed it to my Nook. Rebooted, and the status bar all works properly! Here's the log output:

10-17 16:29:09.235 D/StatusBar( 775): Sending intent to launch last book
10-17 16:29:09.274 I/ActivityManager( 775): Starting activity: Intent { act=android.intent.action.VIEW dat=file:///data/media/B&N Downloads/Books/2980007426813.v5.epub typ=application/epub flg=0x34000000 cmp=com.bn.nook.reader.activities/.ReaderActivity (has extras) }

The services.jar is attached. I'm now going to reproduce this work, only this time with a modified log output line to make absolute certain that my code changes are being run ;)
[Nook Touch General] LastSilmaril:
What did you do differently? How did you create the jar? I'm asusming that something I did to modify XorUtils was at fault, since it seems like you didn't touch it at all. Can you post your SBS for me?

Checking it out now. In comparison with mine, your services.jar is 12kb bigger, so I must have missed something else, too...pls enlighten if possible
[Nook Touch General] probbiethe1:
Wow this is some great progress. I havent checked out the new service.jar yet but I am excited too!!!!! Also how would I change the current read soft button to lunch a different app?
[Nook Touch General] LastSilmaril:
Can confirm that it works! Thanks dr!

Download and install NookTouchTools.apk from Xor's original thread.

EDIT: Diffing our status folders yields only 3kb of differences (e.g. the ones I suspected; there's an extra nop in your SBS that I removed though I don't understand why that would make a difference at all). So I'm not sure where the rest comes from...
[Nook Touch General] dr_diem:
Yes, sorry, I did drop in XorUtils, but the one I obtain from baksmali'ing his jars-1.1b0_nook1.1 which gave me two smali files as I noted in an earlier post. I've now retested with the modified log output and the launchLastBook softbutton still works, as does the rest of the status bar. See the first line of log output below for proof :D

What is strange is that in this second test, I am 100% certain that the _only_ change was to add "Xor " to that log output line, and yet note all the extra output complaining about not being able to resolve toggleRotation?! Perhaps this is due to the fact that my android.policy.jar is still stock? Either way, I'm well pleased with myself. My SBS is attached.

@probbiethe1: Hold yer horses there mate! We can't reassign the button yet - the mere fact that it is launching the book using Xor's code is all we can do for now!

And that's me done for today - kids coming home soon and then out this evening. Will resume tomorrow!

10-17 16:53:13.362 D/StatusBar( 775): Sending Xor intent to launch last book

10-17 16:53:13.362 I/dalvikvm( 775): Could not find method com.android.internal.policy.impl.XorUtils.toggleRotation, referenced from method com.android.server.status.XorUtils.launchActivity

10-17 16:53:13.362 W/dalvikvm( 775): VFY: unable to resolve static method 1441: Lcom/android/internal/policy/impl/XorUtils;.toggleRotation (Landroid/content/Context;)V

10-17 16:53:13.362 D/dalvikvm( 775): VFY: replacing opcode 0x71 at 0x008d

10-17 16:53:13.362 D/dalvikvm( 775): Making a copy of Lcom/android/server/status/XorUtils;.launchActivity code (393 bytes)

10-17 16:53:13.392 D/dalvikvm( 1509): GC freed 3915 objects / 278736 bytes in 10ms

10-17 16:53:13.408 D/DeviceManagerBroadcastReceiver( 1243): action (com.bn.devicemanager.ACTION_DEVICE_USAGE)

10-17 16:53:13.408 I/DeviceManagerHandler( 1243): HandleMessage(): msg.what (7)

10-17 16:53:13.455 D/SurfaceFlinger( 775): Frame buffer posted; elapsed time = 54 msecs

10-17 16:53:13.502 D/dalvikvm( 1243): Trying to load lib /system/lib/libbndeviceinfo.so 0x4a056338

10-17 16:53:13.509 D/dalvikvm( 1243): Added shared lib /system/lib/libbndeviceinfo.so 0x4a056338

10-17 16:53:14.127 W/dalvikvm( 1243): ERROR: Unable to find decl for native Lcom/bn/app/deviceinfo/DeviceInfo;.setFirmwareVersion ()Ljava/lang/String;

10-17 16:53:14.127 E/JNIHelp ( 1243): RegisterNatives failed for 'com/bn/app/deviceinfo/DeviceInfo'

10-17 16:53:14.181 I/ActivityManager( 775): Starting activity: Intent { act=android.intent.action.VIEW dat=file:///data/media/B&N Downloads/Books/9780679603580_epub.v6.epub typ=application/epub flg=0x34000000 cmp=com.bn.nook.reader.activities/.ReaderActivity (has extras) }
[Nook Touch General] LastSilmaril:
"method com.android.internal.policy.impl.XorUtils.toggleRotation"

This is, indeed, a change in android.policy.jar. If you use drop in the one I posted above and install NookTouchTools.apk, then a) rotation works fine b) recent apps dialog works fine, c) you can assign any program to the ReadingNow button and it'll work fine. Personally I'm assigning it to roustabout's ReadingNow app, the use of which solves the whole stupid 'two sets of bookmarks/highlights/annotations' error.

I included all of Xor's files and understood that there was more than one extra file in services.jar. What I understand now (I think) is that the changes I made to XorUtils mucked things up somewhere, somehow. I'm going to try to roll my own to make sure that there is nothing wrong with my setup, and get back to you guys.

EDIT: and here's a partial console output showing what happens once something is assigned to the ReadingNow button (in this case roustabout's app)
[Nook Touch General] probbiethe1:
Just double checking is this the file to use you were talking about attempt2_no_bngossamer_changes.7z?
[Nook Touch General] LastSilmaril:
Update/summary of progress

I have successfully rolled my own services.jar that works with the ReadingNow button. It turns out the 12kb in the size of the jar follow from my using a program with a slightly better ZIP algorithm than the one Dr Diem's is using. The random addition 'nop' command in SBS was left out and is apparently unnecessary. Pushing android.policy.jar allows access to the part of Xor's app that lets you assign side buttons, restores orientation switching functionality, and lets you assign something to longpress - except that a long-press will still turn the light on and off, and then will do whatever assignment you specify. Note that the default action will *always* get triggered; there is no way to shut the longpress functionality of Xor off right now.

The files are attached for anyone who wants to try them. Big thanks to dr_diem for helping isolate the problem here.

Yeah, I was referring to the android.policy.jar inside that .7z. I reposted that jar inside the new zip file I just posted here.
[Nook Touch General] probbiethe1:
awesome thanks. I am trying it now

---------- Post added 18th October 2012 at 12:17 AM ---------- Previous post was 17th October 2012 at 11:41 PM ----------

This is awesome and it is working!! I was able to remap the recent reading button to another app!!

I do have a random question though, does any one know where I can find the boot animation files? I am talking about the screen that says nook and then has the dots underneath it/
[Nook Touch General] LastSilmaril:
Glad to help! Thank the good dr, too, for having the idea to roll a services.jar with Xor's original files.

I don't really know how to do that and think that should be a separate project. Maybe it can later be integrated into one app or something.
[Nook Touch General] probbiethe1:
You guys have done some great work I cant wait for the next steps.

With the boot animation questions I thought about that after I wrote it that I should ask it in this thread.

---------- Post added at 02:17 AM ---------- Previous post was at 02:08 AM ----------

I also wanted to add this http://xdaforums.com/showthread.php?t=1650593 in that root method he says that nook touch tools work. I dont know if it does or not but just thought I would share.
[Nook Touch General] LastSilmaril:
Appreciate it but you misunderstood dude. I've already spoken to roustabout, who wrote that thread, a few weeks ago. He pointed me here, and said that the side button assignment of NookTouchTools works on a Tinynooted glowworm which still had the native framework (this gets patched for Gapps to work in Gabrial's TouchNooter) but not the B&N Buttons functionality. Actually, he's said that in this very thread.
[Nook Touch General] probbiethe1:
o ok thanks for steering me straight.