Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,771,463 Members 50,903 Now Online
XDA Developers Android and Mobile Development Forum

NoRefresh enabler

Tip us?
 
bardo8430
Old
#1  
Junior Member - OP
Thanks Meter 12
Posts: 13
Join Date: Feb 2012
Default NoRefresh enabler

Hi,

I am trying to put a code together to control the refresh behavior of the e-ink screen. The final goal is to have a drop-in library for app developers to help making their app more e-ink friendly.

The code works already for the PRS-T1, but needs a different driver for the Nook Touch (N2EpdController included).

My one and only beta tester gets the famous "There is a problem parsing the package" error. Pls find enclosed the sources.

I would be grateful if someone could fix possible Eclipse setting or other errors.
Attached Files
File Type: zip NoRefresh.zip - [Click for QR Code] (64.1 KB, 5572 views)
The Following 12 Users Say Thank You to bardo8430 For This Useful Post: [ Click to Expand ]
 
marspeople
Old
#2  
Member
Thanks Meter 97
Posts: 69
Join Date: Jul 2011
Hi,

I have some interest in adapting apps to the eink screen, so I will try to help with this. Unfortunately, I cannot post in the dev forums yet.

When you get error installing apps via android UI, it is useful to do via "adb install" to be able to know the error cause. The message was "INSTALL_FAILED_OLDER_SDK", which I solved by lowering the android:minSdkVersion parameter in Manifest. Then, the app installed and ran fine, but didn't do the desired effect yet. I will check the code now...

---------- Post added at 02:41 AM ---------- Previous post was at 01:53 AM ----------

I see that you're trying to use enterA2Mode() for the nook (btw, there is a typo at NoRefreshEnablerActivity.java:29, it should read EINK_NOOK). I've been playing around with this some time ago when I started developing a fast e-ink drawing app for the NST, you can see it here: https://github.com/marspeople/E-Paper (WIP).

With few testing I've done, I guess the 1-bit mode (A2) setting is not applied globally: it should take effect only in the View from which it is called. I haven't investigated further to try to use it globally.
 
bardo8430
Old
#3  
Junior Member - OP
Thanks Meter 12
Posts: 13
Join Date: Feb 2012
Hi marspeople,

Thanks for pointing out the type, it should read
} else if (DeviceInfo.EINK_NOOK)

Regarding the global value of mode setting. From what I understand, A2 is a permanent mode, so whatever function or app is setting the updatemode, it is kept. With the PRS-T1, it is reset by calling any stock (Sony) app. For the Nook I don't know..

Good luck in compiling, hopefully we come to a version which works on both devices. Then I can proceed to dynamically change the updatemode within an app.
 
marspeople
Old
#4  
Member
Thanks Meter 97
Posts: 69
Join Date: Jul 2011
Yes, the A2 mode is kept until any process resets the EPD. Using logcat, I noticed several epd_reset_region messages appearing automatically when I close your app to go back to the launcher. It seems the system overrides the EPD setting, making impossible to use A2 system-wide (at least by this method).

However, if you want A2 just for an app, calling enterA2mode() will probably work, as I used in my own app above.
 
salsichad2
Old
#5  
Senior Member
Thanks Meter 35
Posts: 108
Join Date: Sep 2010
Location: Brasília - DF
Can you send me your apk?
 
marspeople
Old
#6  
Member
Thanks Meter 97
Posts: 69
Join Date: Jul 2011
Quote:
Originally Posted by salsichad2 View Post
Can you send me your apk?
You mean the apk for "NoRefresh" or my drawing app?
 
bardo8430
Old
#7  
Junior Member - OP
Thanks Meter 12
Posts: 13
Join Date: Feb 2012
Hi marspeople,

I would be most interested to know why the initial source code does compile ok, works on the PRS-T1 and does not install on the Nook Touch + the fixes.

With this knowledge I can write either an app to set refresh modes or within apps.

Did you succeed to compile and install on Nook?
 
bardo8430
Old
#8  
Junior Member - OP
Thanks Meter 12
Posts: 13
Join Date: Feb 2012
Hi again,

in your N2EpdController.java

Code:
83: mtSetRegion.invoke(null, "aarddict", enumsRegion[region], regionParams, enumsMode[mode]);
I would like to replace the hardcoded "aarddict" by something dynamic.
What would be the correct function to infer the wanted name?
Code:
activity.class.getName() 
this.getClass().toString()
.. ?
 
marspeople
Old
#9  
Member
Thanks Meter 97
Posts: 69
Join Date: Jul 2011
Quote:
Originally Posted by bardo8430 View Post
Hi marspeople,

I would be most interested to know why the initial source code does compile ok, works on the PRS-T1 and does not install on the Nook Touch + the fixes.

With this knowledge I can write either an app to set refresh modes or within apps.

Did you succeed to compile and install on Nook?
Yes, sorry about the confusion, but I managed to do it, despite the A2 mode didn't work. What I did was just edit the AndroidManifest.xml, changing the android:minSdkVersion parameter to 7 (since the NST runs Android 2.1).

Good luck finding out how to set A2 mode permanently. I guess you don't have a Nook, so feel free to ask me for testing purposes.
 
marspeople
Old
(Last edited by marspeople; 6th December 2012 at 02:23 PM.) Reason: Ver 2.2: Fix contrast setting behaviour
#10  
Member
Thanks Meter 97
Posts: 69
Join Date: Jul 2011
Since the Nook A2 mode seems to be overridden when switching foreground activity, I've tried another approach with a background service which toggles A2 mode when requested by user. This way, the foreground activity isn't switched and "fast refreshing" mode works (until you change activity).

This fast refresh mode (called A2) is only possible because it uses only 1-bit depth, i.e, just black on white, meaning you can't see grayscale pictures but it's good enough for black text on white background and scrolling. I have not "created it", it is built-in from the device (you can test using the stock reader, it is activated when holding a page button). What I implemented is a way to activate and deactivate it at user will from inside any app.

Thanks to dairyknight for his N2EpdController class, which made this possible.
Thanks to bardo8430 for bringing the idea.
Thanks to AndroSS source code for screenshots used in automatic contrast.

Changelog:
01/Mar: Now when you launch the app and it is already running, it will activate NoRefresh mode. So you can also use an activation shortcut to the app using NookTouchTools (i.e. B&N's book icon at top left corner).
02/Mar: Improve activation shortcut to perform toggle between modes. Tap gestures aren't needed anymore (use "-noGestures" apk version if you don't want them).
04/Mar: Got rid of initial ghosting by redrawing the screen after activating A2.
04/Mar (2): Minor improvement of removing ghosting at screen edges.
12/Mar (Beta): Now you can adjust contrast in A2 mode. Images shouldn't be dark or black anymore if you raise the contrast a bit.

22/May: Completely redesigned version 2.0:
- Several options can be customized via settings screen.
- NoRefresh can be toggled by manual app shortcut, tap gestures or automatically according to screen animation (new).
- New App Whitelist to avoid unwanted activation in specific apps (except for manual mode).
- Background service can be launched at boot.
- Small improvements and tweaks.
- Custom app icon (finally )

06/Jun: Fix crash on empty whitelist

08/Jul: (Version 2.1)
- Automatic contrast when activating NoRefresh, according to total "brightness" of the screen (simple algorithm). This should ask you for root permission.
- Also supports manual setting in specific situations (customizable).
- Fix possible crash at startup.

26/Jul: (Version 2.2)
- Fix contrast setting behaviour

06/Dec:
- Alternative version with fixed compatibility for FW 1.2.0 available at https://github.com/marspeople/NoRefreshToggle/downloads

First Video: http://youtu.be/6pBPsyno5PY
Other Video: http://youtu.be/kBbl6egyPsQ
Another demo: http://youtu.be/5b7JjllImjM

Repository: https://github.com/marspeople/NoRefreshToggle
Attached Files
File Type: apk NoRefreshToggle.apk - [Click for QR Code] (67.8 KB, 13129 views)

The Following 41 Users Say Thank You to marspeople For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes