NST sleep but retain last screen image

Search This thread

rguk

New member
Jul 12, 2013
4
0
Forgive me if I have a gross misunderstanding about the hardware in the NST, but in my eyes it should be possible for the Nook to sleep but retain the screen, perhaps with a small banner indicating it's in sleep state and you need to press the 'n' to wake. It just seems silly having the benefit of an e-ink display only for the screensaver to kick it when it sleeps. If it didn't do this, I could (for example) leave a map open in OsmAnd and refer to it still while the Nook is sleeping. The only 'solutions' to this I've found involved plain and simply keeping the Nook awake! A hack I can think of would be to somehow bodge something together to take a screenshot just before the nook sleeps and set it as the screensaver image. Seems silly though... I've had a search around and can't find anything related to this specifically, more either people wanting to keep the nook awake or disable the slide to unlock.

Any thoughts welcome!
 

nivieru

Member
Nov 15, 2013
43
8
I had the exact same thought,
so I'm making an app that takes a screenshot every 1:50 minutes and saves it at a screensaver,
to be displayed when the nook goes to sleep.
hopefully it will be ready this weekend so stay tuned
 

Renate

Recognized Contributor / Inactive Recognized Dev
It should be be simple enough.

Modify /system/framework/android.policy.jar
The class is com.android.internal.policy.impl.LockScreen
What puts up the "screensaver" is updateBackgroundImage()

The layout is in /system/framework/framework-res.apk,
res/layout/keyguard_screen_gossamer_unlock.xml

I'm not sure if changing the layout to transparent and not updating the image should be enough.
 

nivieru

Member
Nov 15, 2013
43
8
It should be be simple enough.

Modify /system/framework/android.policy.jar
The class is com.android.internal.policy.impl.LockScreen
What puts up the "screensaver" is updateBackgroundImage()

The layout is in /system/framework/framework-res.apk,
res/layout/keyguard_screen_gossamer_unlock.xml

I'm not sure if changing the layout to transparent and not updating the image should be enough.

Oh I wish you would have said that two days ago...
It seems a far better solution than my app, maybe I'll try playing with that later.
 

nivieru

Member
Nov 15, 2013
43
8
I tried replacing updateBackgroundImage()
with a stub, but the screensaver still comes up as usual,
Only difference is the "slide to unlock" screen now has black background, so that's what this function is doing.

Time for plan B (or C, really):
If I were to modify framework-res.apk as you suggest, Will I need to resign the whole system, as here?
 
Last edited:

nivieru

Member
Nov 15, 2013
43
8
Update -
The function that sets the screensaver is createScreensaver(), in class com.android.server.PowerManagerService, found in /system/framework/services.jar

I modified it to make the screensaver invisible, but unfortunately it also means there's no indication that the nook sleeps.
Anyway, it's better than constantly taking screenshots, so I'll stick with that.
 

nhedgehog

Senior Member
Oct 21, 2009
91
22
Update -
The function that sets the screensaver is createScreensaver(), in class com.android.server.PowerManagerService, found in /system/framework/services.jar

I modified it to make the screensaver invisible, but unfortunately it also means there's no indication that the nook sleeps.
Anyway, it's better than constantly taking screenshots, so I'll stick with that.

How did you do that? I'm using the screenshot sreensaver app for that and I find it very useful. But the above mentioned way seems to be less power consuming. Could you explain it for somebody with very little knowledge about manipulating apk, though I know how to manipulate apk with xdaAutotool.
 

nivieru

Member
Nov 15, 2013
43
8
I don't know xdaAutotool, I use apktool but you can probably use whatever tool you like.
First you need a patched /system/framework/services.jar
the one I attached here is for firmware 1.2.1 rooted with NookManager, so it also includes the NookManager patches.
if this is your setup as well, skip to 4
if you run a different firmware or don't want the NookManager patches you will need to patch it yourself

patching /system/framework/services.jar - some vauge instructions:
you will need apktool (or XdaAutotool or whatever) and the android-sdk.

1) use apktool to decompile services.jar
2) modify createScreensaver() in file smali/com/android/server/PowerManagerService.smali according to the attached patch-services.txt
notice - this patch is for firmware 1.2.1 with NookManager patches, it might not be ready for use with other versions - not only the line numbers, also the register v6 might not be a good choice if it is used later in the code without being assigned a new value first.
3) recompile with apktool.

replacing services.jar with patched version - complete instructions:
4) making a full backup before messing with the system is good practice, although the nook is notoriously hard to brick.
you could use NookManager to do the backup.
5) connect to your device with adb
6) apply these commands:
Code:
adb push pathced-services.jar /media
adb shell stop
adb shell mount -o remount,rw /dev/block/mmcblk0p5 /system
adb shell cp /system/framework/services.jar /system/framework/services.jar.backup
adb shell cp /media/pathced-services.jar /system/framework/services.jar
adb shell chmod 644 /system/framework/services.jar
adb shell reboot
7) relax, first boot takes a few minutes, this is normal.

with this patch the screensaver is invisible, so there is no indication at all that the device is asleep.
also, there's no magic button to change behavior - if you want to the screensaver back you need to replace services.jar with original version
 

Attachments

  • patch-services.txt
    1 KB · Views: 104
  • patched-services.jar
    542.2 KB · Views: 79
  • Like
Reactions: nhedgehog

nhedgehog

Senior Member
Oct 21, 2009
91
22
Got it.
I compared your PowerManagerService.smali with the one in my services.jar and made the changes.
Recompiled the services.jar.
Exchanged the original classes.dex with the new compiled classes.dex in 7zip.
Signed the jar file.
Had a lot of problems with adb, which didn't recognize my device.
Lost my temper, packed it into a ZIP-file and replaced it via CWM.
Everything is working now. Thanks!
 
Last edited:

tebra

Senior Member
Dec 8, 2010
455
91
Got it.
I compared your PowerManagerService.smali with the one in my services.jar and made the changes.
Recompiled the services.jar.
Exchanged the original classes.dex with the new compiled classes.dex in 7zip.
Signed the jar file.
Had a lot of problems with adb, which didn't recognize my device.
Lost my temper, packed it into a ZIP-file and replaced it via CWM.
Everything is working now. Thanks!

Hi @nhedgehog
I also use the custom rom from pinguy1982.
Can you share your zip file to flash with CWM
Thanks
 

nhedgehog

Senior Member
Oct 21, 2009
91
22

Attachments

  • Services-org.zip
    692.7 KB · Views: 31
  • Services-patch.zip
    689.5 KB · Views: 42
  • Like
Reactions: tebra

nikolazius

Member
Oct 20, 2014
11
0
Hi everyone!
I've patched the jar and now enjoy the last image in sleep mode. But, I'd like to wake app the Nook every few hours, update the page in dolphin and go back sleep. Page in dolphin has a meta refresh. But I can't wake up the Nook on interval. Is it impossible or I missing smth very important on this topic?
If anybody has some experience on topic, please comment.

Update, my solution:
Re-signed the system with personal cert and implemented an app instead of dolphin+web page.
App wakes up every few hours, updates view and throws device to deep sleep. Hope to get an uptime up to 10-15 days.
 
Last edited:

gsms

Senior Member
Sep 6, 2014
96
7
I

replacing services.jar with patched version - complete instructions:
4) making a full backup before messing with the system is good practice, although the nook is notoriously hard to brick.
you could use NookManager to do the backup.
5) connect to your device with adb
6) apply these commands:
Code:
adb push pathced-services.jar /media
adb shell stop
adb shell mount -o remount,rw /dev/block/mmcblk0p5 /system
adb shell cp /system/framework/services.jar /system/framework/services.jar.backup
adb shell cp /media/pathced-services.jar /system/framework/services.jar
adb shell chmod 644 /system/framework/services.jar
adb shell reboot
7) relax, first boot takes a few minutes, this is normal.

with this patch the screensaver is invisible, so there is no indication at all that the device is asleep.
also, there's no magic button to change behavior - if you want to the screensaver back you need to replace services.jar with original version

I've done exactly as described in points 4-7 on NST firmware 1.2.1 , rooted with Nook Manager.
I used Root explorer for replacement and rename of patched-services.jar.
After rebooting of NST, it works as intended - the screensaver is unseen, but it appears other problem.
When i click at random .apk, nothing happens, only the screen is flickering once and that's all.
I cannot install apk-s, nor uninstall them....? WTF ?
Someone with explanation...? :eek:
 

nivieru

Member
Nov 15, 2013
43
8
I've done exactly as described in points 4-7 on NST firmware 1.2.1 , rooted with Nook Manager.
I used Root explorer for replacement and rename of patched-services.jar.
After rebooting of NST, it works as intended - the screensaver is unseen, but it appears other problem.
When i click at random .apk, nothing happens, only the screen is flickering once and that's all.
I cannot install apk-s, nor uninstall them....? WTF ?
Someone with explanation...? :eek:

Replacing services.jar while the android system is running can cause problems, that's why I suggest doing it through adb after issuing the "stop" command, which stops android while leaving the underlying linux (with adb) running.
You should try that and see if it helps.
 

gsms

Senior Member
Sep 6, 2014
96
7
I will try, but before that another question from me.
Is there a chance the file "patched-services.jar" to be remade as .zip file and installed thru CWM.
If this can be done, i will be glad somebody to share the .zip file, because i think it is more comfortable for installation than using adb shell....
thanks

P.S. Adb don't work correctly for me, so the only available option is obviously flashable .zip file...:(
 
Last edited:

nmyshkin

Recognized Contributor
Nov 21, 2013
2,002
528
Has anyone tried this with FW 1.2.2 yet?
If the original services.jar was patched, it will break NTMM since that relies on patches. But if you can discern what the additional patches are you could patch the 1.2.2 file used in NookManager.

Edit: but if you just want to see how it might work, you can probably use the 1.2.1 jar without any problems. When I first started working on the update to NookManager I used the original 1.2.0 jars that were provided with FW 1.2.2 and saw no evidence of problems. A diff showed very minor changes. Depending on how extensive the patching is for this mod, it might be easier--if you still want the use of NTMM--to patch the file in post #8 for NTMM since the patches are well documented on github. Otherwise you have a lot of diffs to look at and sort out.
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    I don't know xdaAutotool, I use apktool but you can probably use whatever tool you like.
    First you need a patched /system/framework/services.jar
    the one I attached here is for firmware 1.2.1 rooted with NookManager, so it also includes the NookManager patches.
    if this is your setup as well, skip to 4
    if you run a different firmware or don't want the NookManager patches you will need to patch it yourself

    patching /system/framework/services.jar - some vauge instructions:
    you will need apktool (or XdaAutotool or whatever) and the android-sdk.

    1) use apktool to decompile services.jar
    2) modify createScreensaver() in file smali/com/android/server/PowerManagerService.smali according to the attached patch-services.txt
    notice - this patch is for firmware 1.2.1 with NookManager patches, it might not be ready for use with other versions - not only the line numbers, also the register v6 might not be a good choice if it is used later in the code without being assigned a new value first.
    3) recompile with apktool.

    replacing services.jar with patched version - complete instructions:
    4) making a full backup before messing with the system is good practice, although the nook is notoriously hard to brick.
    you could use NookManager to do the backup.
    5) connect to your device with adb
    6) apply these commands:
    Code:
    adb push pathced-services.jar /media
    adb shell stop
    adb shell mount -o remount,rw /dev/block/mmcblk0p5 /system
    adb shell cp /system/framework/services.jar /system/framework/services.jar.backup
    adb shell cp /media/pathced-services.jar /system/framework/services.jar
    adb shell chmod 644 /system/framework/services.jar
    adb shell reboot
    7) relax, first boot takes a few minutes, this is normal.

    with this patch the screensaver is invisible, so there is no indication at all that the device is asleep.
    also, there's no magic button to change behavior - if you want to the screensaver back you need to replace services.jar with original version
    1
    Hi @nhedgehog
    I also use the custom rom from pinguy1982.
    Can you share your zip file to flash with CWM

    Here you are:
    Patch (nivieru's method) via ZIP, tested only with modded ROM from pinguy1982 and installed Nooter-Part1.zip. Install via CWM, to be safe make a backup before you do the patch.

    Services-org.zip=original services.jar
    Services-patch.zip=patched services.jar