[G2 and Desire Z Android Development] captainreynolds:
CRT Animations

I have been researching CRT On/Off animations all morning, and I have found ONE single thread on another website that seems to fully explain how, in a relatively simple way.

http://rootzwiki.com/topic/2553-dev-enabling-crt-on-off-animation-in-roms-how-to/

I'm able to get it done RIGHT UP until I need to recompile the services.jar from the decompiled folder again. I have NO idea how, I can't find out how anywhere, and it is f***ing pissing me off b/c I've found everything else. I used apktool to decompile the services.jar.

Tun4: All I want for christmas are those CRT on/off animations. Please help!

Below is the necessary code for the final method in PowerManagerService$BrightnessState.smali, Tun4. I've corrected the access$#### as best as I can tell, relating it back to PowerManagerService.smali. However, a few of the access$###'s had several different matching ones on the PowerManagerService.smali file. I wasn't really sure which one to use, so I would pick the first one I found.

.method public run()V
.registers 10

.prologue
const/4 v8, 0x0

.line 2076
iget-object v4, p0, Lcom/android/server/PowerManagerService$BrightnessState;->this$0:Lcom/android/server/PowerManagerService;

invoke-static {v4}, Lcom/android/server/PowerManagerService;->getContextZZ(Lcom/android/server/PowerManagerService;)Landroid/content/Context;

move-result-object v4

invoke-direct {p0, v4}, Lcom/android/server/PowerManagerService$BrightnessState;->getScreenAnimationMode(Landroid/content/Context;)I

move-result v4

if-nez v4, :cond_3b

iget-object v4, p0, Lcom/android/server/PowerManagerService$BrightnessState;->this$0:Lcom/android/server/PowerManagerService;

iget-boolean v4, v4, Lcom/android/server/PowerManagerService;->mAnimateScreenLights:Z

if-eqz v4, :cond_3b

.line 2077
iget-object v4, p0, Lcom/android/server/PowerManagerService$BrightnessState;->this$0:Lcom/android/server/PowerManagerService;

invoke-static {v4}, Lcom/android/server/PowerManagerService;->access$600(Lcom/android/server/PowerManagerService;)Lcom/android/server/PowerManagerService$LockList;

move-result-object v4

monitor-enter v4

.line 2078
:try_start_1a
invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J

move-result-wide v2

.line 2079
.local v2, now:J
iget-object v5, p0, Lcom/android/server/PowerManagerService$BrightnessState;->this$0:Lcom/android/server/PowerManagerService;

invoke-static {v5}, Lcom/android/server/PowerManagerService;->access$4600(Lcom/android/server/PowerManagerService;)Lcom/android/server/PowerManagerService$BrightnessState;

move-result-object v5

invoke-virtual {v5}, Lcom/android/server/PowerManagerService$BrightnessState;->stepLocked()Z

move-result v1

.line 2080
.local v1, more:Z
if-eqz v1, :cond_36

.line 2081
iget-object v5, p0, Lcom/android/server/PowerManagerService$BrightnessState;->this$0:Lcom/android/server/PowerManagerService;

invoke-static {v5}, Lcom/android/server/PowerManagerService;->access$3700(Lcom/android/server/PowerManagerService;)Landroid/os/Handler;

move-result-object v5

const-wide/16 v6, 0x10

add-long/2addr v6, v2

invoke-virtual {v5, p0, v6, v7}, Landroid/os/Handler;->postAtTime(Ljava/lang/Runnable;J)Z

.line 2083
:cond_36
monitor-exit v4

.line 2098
.end local v1 #more:Z
.end local v2 #now:J
:goto_37
return-void

.line 2083
:catchall_38
move-exception v5

monitor-exit v4
:try_end_3a
.catchall {:try_start_1a .. :try_end_3a} :catchall_38

throw v5

.line 2085
:cond_3b
iget-object v4, p0, Lcom/android/server/PowerManagerService$BrightnessState;->this$0:Lcom/android/server/PowerManagerService;

invoke-static {v4}, Lcom/android/server/PowerManagerService;->access$600(Lcom/android/server/PowerManagerService;)Lcom/android/server/PowerManagerService$LockList;

move-result-object v4

monitor-enter v4

.line 2087
:try_start_42
iget-boolean v5, p0, Lcom/android/server/PowerManagerService$BrightnessState;->animating:Z

if-eqz v5, :cond_6b

iget v5, p0, Lcom/android/server/PowerManagerService$BrightnessState;->targetValue:I

if-nez v5, :cond_6b

const/4 v5, 0x1

move v0, v5

.line 2088
.local v0, animate:Z
:goto_4c
if-eqz v0, :cond_5d

.line 2091
iget-object v5, p0, Lcom/android/server/PowerManagerService$BrightnessState;->this$0:Lcom/android/server/PowerManagerService;

iget-object v6, p0, Lcom/android/server/PowerManagerService$BrightnessState;->this$0:Lcom/android/server/PowerManagerService;

invoke-static {v6}, Lcom/android/server/PowerManagerService;->access$4400(Lcom/android/server/PowerManagerService;)I

move-result v6

const/4 v7, 0x4

if-ne v6, v7, :cond_6d

move v6, v8

:goto_5a
invoke-static {v5, v6}, Lcom/android/server/PowerManagerService;->access$5200(Lcom/android/server/PowerManagerService;I)V

.line 2095
:cond_5d
iget-object v5, p0, Lcom/android/server/PowerManagerService$BrightnessState;->this$0:Lcom/android/server/PowerManagerService;

invoke-static {v5}, Lcom/android/server/PowerManagerService;->access$4600(Lcom/android/server/PowerManagerService;)Lcom/android/server/PowerManagerService$BrightnessState;

move-result-object v5

invoke-virtual {v5}, Lcom/android/server/PowerManagerService$BrightnessState;->jumpToTargetLocked()V

.line 2096
monitor-exit v4

goto :goto_37

.end local v0 #animate:Z
:catchall_68
move-exception v5

monitor-exit v4
:try_end_6a
.catchall {:try_start_42 .. :try_end_6a} :catchall_68

throw v5

:cond_6b
move v0, v8

.line 2087
goto :goto_4c

.line 2091
.restart local v0 #animate:Z
:cond_6d
:try_start_6d
iget-object v6, p0, Lcom/android/server/PowerManagerService$BrightnessState;->this$0:Lcom/android/server/PowerManagerService;

invoke-static {v6}, Lcom/android/server/PowerManagerService;->access$1000(Lcom/android/server/PowerManagerService;)I
:try_end_72
.catchall {:try_start_6d .. :try_end_72} :catchall_68

move-result v6

iget-object v6, p0, Lcom/android/server/PowerManagerService$BrightnessState;->this$0:Lcom/android/server/PowerManagerService;

invoke-static {v6}, Lcom/android/server/PowerManagerService;->getContextZZ(Lcom/android/server/PowerManagerService;)Landroid/content/Context;

move-result-object v6

invoke-direct {p0, v6}, Lcom/android/server/PowerManagerService$BrightnessState;->getScreenAnimationMode(Landroid/content/Context;)I

move-result v6

goto :goto_5a
.end method

Our framework-res.apk bool value is already set to "true," so you don't even have to mess with that.

Evidently, while editing the PowerManagerService.smali, making the ANIM_STEPS:I 0xf as opposed to 0xa smooths out the animation a little bit (not much) and makes the on animation easier to see.

All the rest is explained at the link, and since you're a genius, it should take like 2 seconds? Haha.