[Galaxy S II Themes and Apps] Tungstwenty:
I wonder if this will work ...

Actually, I'm terribly busy now and don't have time to implement straight away :D

But nevertheless I've looked at the problem, which is not as easy as before, and have devised a possible solution that needs to be put in place with some work.

The good news

libsurfaceflinger.so seems to contain both the methods for ON and OFF animation. I don't know if CRT-ON has some bugs or not, in addition to the effects mentioned by kamma. We'll need to test it out to see if it was something related with the AOSP ROM or not.

The bad news

There is missing code to handle invocation of the ON effect, not only in the java layer but also missing native methods in libandroid_servers.so to make the bridge between PowerManagerService and the surfaceflinger. These cannot be added by merely patching the file, we would need the original source which isn't available (or try starting from ASOP source which as rovo89 mentioned doesn't work on stock ROMs).

The solution I came up with (for now in my mind):

I would patch the existing entry point in libsurfaceflinger.so for CRT-Off effect to have a look at the received parameter; if a reserved bit is set, redirect it from that function to the CRT-On one (removing the bit, of course). That way, provided all the changes are performed on the java side, we wouldn't need to traverse the whole chain of libraries which is unfeasible.

Could anyone handle the java part and I'll try to do the ARM patching later today? rovo89? JKay? :D

The relevant bits, taken from this source repository, are in PowerManagerService.java:

final float windowScale = getFloat(WINDOW_ANIMATION_SCALE, 1.0f);
final float transitionScale = getFloat(TRANSITION_ANIMATION_SCALE, 1.0f);
mAnimationSetting = 0;
if (windowScale > 0.5f) {
mAnimationSetting |= ANIM_SETTING_OFF;
}
if (transitionScale > 0.5f) {
[COLOR="Red"] // Uncomment this if you want the screen-on animation.
// mAnimationSetting |= ANIM_SETTING_ON;
[/COLOR] }

and

final boolean turningOff = animating && targetValue == Power.BRIGHTNESS_OFF;
[COLOR="red"] final boolean turningOn = animating && curValue == Power.BRIGHTNESS_OFF;
[/COLOR] if (mAnimateScreenLights || (!turningOff && [COLOR="red"]!turningOn[/COLOR])) {
long now = SystemClock.uptimeMillis();
boolean more = mScreenBrightness.stepLocked();
if (more) {
mScreenOffHandler.postAtTime(this, now+(1000/60));
}
} else {
// It's pretty scary to hold mLocks for this long, and we should
// redesign this, but it works for now.
if (turningOff) {
nativeStartSurfaceFlingerAnimation(
mScreenOffReason == WindowManagerPolicy.OFF_BECAUSE_OF_PROX_SENSOR
? 0 : mAnimationSetting);
mScreenBrightness.jumpToTargetLocked();
[COLOR="red"]	} else if (turningOn) {
jumpToTarget();
[U]nativeStartSurfaceFlingerAnimation[B]On[/B][/U](mAnimationSetting);
animating = false;
}
[/COLOR] }

The decompiled code of the stock ROM shows that the lines in red are not present and must be added for the effects to work.

On the first block, TRANSITION_ANIMATION_SCALE (and WINDOW_ANIMATION_SCALE) should be manipulated so that it is possible to activate the 2 effects separately. It shouldn't be controlled solely by disabling "animate_screen_lights".

For the second block, in addition to adding the missing code, it would be needed to call "nativeStartSurfaceFlingerAnimation" instead of "nativeStartSurfaceFlingerAnimationOn" (which doesn't exist) and pass as argument "mAnimationSetting | 0x80" or some other bit that doesn't collide with 0x11 (both on) and that matches what was inserted on libsurfaceflinger.so

Again, I'll try to implement the native changes later on if I can. It would be great if someone could handle the java part so we can test the solution.