Post Reply

[GUIDE / HOW-TO] Add screen off animations to KitKat 4.4 [CRT/FADE/NONE]

OP rompnit

4th July 2014, 12:11 AM   |  #1  
rompnit's Avatar
OP Recognized Contributor / Themer
Flag Granger, IN
Thanks Meter: 17,249
 
2,834 posts
Join Date:Joined: Aug 2008
Donate to Me
More
It seems that no matter how many cool mods you put out there, a lot of folks continue to ask for CRT. So here's a 'How-To' based off of the Sprint NE5 4.4 release, but this should also work in other variants and/or Samsung devices.
We will be working with the services.jar, and some knowledge decompiling and/or baksmali is required.
Also note that the debug code has been removed; to do the same use the -b switch when decompiling with apktool.
Code:
apktool d -b services.jar
PART 1
To start:
  • Navigate and open
    Code:
    smali\com\android\server\power\DisplayPowerController.smali
  • ADD the lines in RED right at the top
    Code:
    .class final Lcom/android/server/power/DisplayPowerController;
    .super Ljava/lang/Object;
    .source "DisplayPowerController.java"
    
    # interfaces
    .implements Landroid/animation/Animator$AnimatorListener;
    
    # annotations
  • Search for and add the lines in RED
    Code:
    .field private mElectronBeamFadesConfig:Z
    
    .field private mElectronBeamOff:I
    
    .field private mElectronBeamOffAnimator:Landroid/animation/ObjectAnimator;
    
    .field private mElectronBeamOn:I
    
    .field private mElectronBeamOnAnimator:Landroid/animation/ObjectAnimator;
  • Next search for
    Code:
    .method private getDynamicAutoBrightnessHighHysteresis(F)F
    And add the following method DIRECTLY ABOVE
    Code:
    .method static getBeamCfg(Ljava/lang/String;I)I
        .locals 3
    
        move v0, p1
    
        invoke-static {p0}, Landroid/os/SystemProperties;->get(Ljava/lang/String;)Ljava/lang/String;
    
        move-result-object v1
    
        const-string v2, "none"
    
        invoke-virtual {v1, v2}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
    
        move-result v2
    
        if-eqz v2, :cond_0
    
        const v0, 0x0
    
        return v0
    
        :cond_0
        const-string v2, "crt"
    
        invoke-virtual {v1, v2}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
    
        move-result v2
    
        if-eqz v2, :cond_1
    
        const v0, 0x1
    
        return v0
    
        :cond_1
        const-string v2, "fade"
    
        invoke-virtual {v1, v2}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
    
        move-result v2
    
        if-eqz v2, :cond_2
    
        const v0, 0x2
    
        :cond_2
        return v0
    .end method
  • We will now be working in the following method so search for it next!
    Code:
    .method private initialize()V
  • Within the above referenced method, search for
    Code:
    iput-object v0, p0, Lcom/android/server/power/DisplayPowerController;->mPowerState:Lcom/android/server/power/DisplayPowerState;
  • And add the line in RED
    Code:
    iput-object v0, p0, Lcom/android/server/power/DisplayPowerController;->mPowerState:Lcom/android/server/power/DisplayPowerState;
    
    const v4, 0x2
    
    iget-object v0, p0, Lcom/android/server/power/DisplayPowerController;->mPowerState:Lcom/android/server/power/DisplayPowerState;
  • Still working within the same method REPLACE
    Code:
    const-wide/16 v1, 0xc8
    WITH
    Code:
    const-wide/16 v1, 0x190
    # This changes the animation speed. Looks much better
  • And yet still within this method, REPLACE these 2 lines
    Code:
    iget-object v1, p0, Lcom/android/server/power/DisplayPowerController;->mAnimatorListener:Landroid/animation/Animator$AnimatorListener;
    
    invoke-virtual {v0, v1}, Landroid/animation/Animator;->addListener(Landroid/animation/Animator$AnimatorListener;)V
    WITH THE FOLLOWING # This step updated 08.03.14
    Code:
    invoke-virtual {v0, p0}, Landroid/animation/ObjectAnimator;->addListener(Landroid/animation/Animator$AnimatorListener;)V
    
    const-string v2, "persist.sys.screen_off"
    
    const v3, 0x1
    
    invoke-static {v2, v3}, Lcom/android/server/power/DisplayPowerController;->getBeamCfg(Ljava/lang/String;I)I
    
    move-result v4
    
    iput v4, p0, Lcom/android/server/power/DisplayPowerController;->mElectronBeamOff:I
  • Finally ADD
    Code:
    nop
    
    nop
    DIRECTLY BELOW
    Code:
    return-void
  • That's it for this method!
Continue to Part 2 due to post length limitations
Last edited by rompnit; 3rd August 2014 at 09:02 PM.
The Following 12 Users Say Thank You to rompnit For This Useful Post: [ View ]
4th July 2014, 12:11 AM   |  #2  
rompnit's Avatar
OP Recognized Contributor / Themer
Flag Granger, IN
Thanks Meter: 17,249
 
2,834 posts
Join Date:Joined: Aug 2008
Donate to Me
More
Part 2
  • Almost there!! Search for
    Code:
    .method private updatePowerState()V
    And REPLACE THE ENTIRE METHOD WITH THE FOLLOWING
    Code:
    .method private updatePowerState()V
        .locals 12
    
        const/4 v7, 0x1
    
        const/4 v8, 0x0
    
        const/4 v0, 0x0
    
        iget-boolean v4, p0, Lcom/android/server/power/DisplayPowerController;->mTwilightChanged:Z
    
        const/4 v5, 0x0
    
        iput-boolean v8, p0, Lcom/android/server/power/DisplayPowerController;->mTwilightChanged:Z
    
        iget-object v9, p0, Lcom/android/server/power/DisplayPowerController;->mLock:Ljava/lang/Object;
    
        monitor-enter v9
    
        const/4 v6, 0x0
    
        :try_start_0
        iput-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mPendingUpdatePowerStateLocked:Z
    
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mPendingRequestLocked:Lcom/android/server/power/DisplayPowerRequest;
    
        if-nez v6, :cond_1
    
        monitor-exit v9
    
        :cond_0
        :goto_0
        return-void
    
        :cond_1
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mPowerRequest:Lcom/android/server/power/DisplayPowerRequest;
    
        if-nez v6, :cond_c
    
        new-instance v6, Lcom/android/server/power/DisplayPowerRequest;
    
        iget-object v10, p0, Lcom/android/server/power/DisplayPowerController;->mPendingRequestLocked:Lcom/android/server/power/DisplayPowerRequest;
    
        invoke-direct {v6, v10}, Lcom/android/server/power/DisplayPowerRequest;-><init>(Lcom/android/server/power/DisplayPowerRequest;)V
    
        iput-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mPowerRequest:Lcom/android/server/power/DisplayPowerRequest;
    
        iget-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mPendingWaitForNegativeProximityLocked:Z
    
        iput-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mWaitingForNegativeProximity:Z
    
        const/4 v6, 0x0
    
        iput-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mPendingWaitForNegativeProximityLocked:Z
    
        iget-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mPendingScreenOnEvenThoughProximityPositiveLocked:Z
    
        iput-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mScreenOnEvenThoughProximityPositive:Z
    
        const/4 v6, 0x0
    
        iput-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mPendingScreenOnEvenThoughProximityPositiveLocked:Z
    
        const/4 v6, 0x0
    
        iput-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mPendingRequestChangedLocked:Z
    
        const/4 v0, 0x1
    
        :cond_2
        :goto_1
        iget-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mDisplayReadyLocked:Z
    
        if-nez v6, :cond_10
    
        move v1, v7
    
        :goto_2
        monitor-exit v9
        :try_end_0
        .catchall {:try_start_0 .. :try_end_0} :catchall_0
    
        if-eqz v0, :cond_3
    
        invoke-direct {p0}, Lcom/android/server/power/DisplayPowerController;->initialize()V
    
        :cond_3
        iget-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mWaitProximityToggled:Z
    
        if-nez v6, :cond_4
    
        iget v6, p0, Lcom/android/server/power/DisplayPowerController;->mProximity:I
    
        if-ne v6, v7, :cond_4
    
        iget-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mScreenOnEvenThoughProximityPositive:Z
    
        if-eqz v6, :cond_4
    
        iput-boolean v7, p0, Lcom/android/server/power/DisplayPowerController;->mWaitProximityToggled:Z
    
        :cond_4
        iget-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mWaitProximityToggled:Z
    
        if-eqz v6, :cond_5
    
        iget v6, p0, Lcom/android/server/power/DisplayPowerController;->mProximity:I
    
        if-nez v6, :cond_5
    
        iput-boolean v8, p0, Lcom/android/server/power/DisplayPowerController;->mScreenOnEvenThoughProximityPositive:Z
    
        iput-boolean v8, p0, Lcom/android/server/power/DisplayPowerController;->mWaitProximityToggled:Z
    
        :cond_5
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mProximitySensor:Landroid/hardware/Sensor;
    
        if-eqz v6, :cond_18
    
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mPowerRequest:Lcom/android/server/power/DisplayPowerRequest;
    
        iget-boolean v6, v6, Lcom/android/server/power/DisplayPowerRequest;->useProximitySensor:Z
    
        if-eqz v6, :cond_15
    
        iget-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mScreenOffBecauseOfProximity:Z
    
        if-nez v6, :cond_11
    
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mPowerRequest:Lcom/android/server/power/DisplayPowerRequest;
    
        iget v6, v6, Lcom/android/server/power/DisplayPowerRequest;->screenState:I
    
        invoke-static {v6}, Lcom/android/server/power/DisplayPowerController;->wantScreenOn(I)Z
    
        move-result v6
    
        if-nez v6, :cond_11
    
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mPowerRequest:Lcom/android/server/power/DisplayPowerRequest;
    
        iget v6, v6, Lcom/android/server/power/DisplayPowerRequest;->lastGoToSleepReason:I
    
        if-nez v6, :cond_11
    
        invoke-direct {p0, v8}, Lcom/android/server/power/DisplayPowerController;->setProximitySensorEnabled(Z)V
    
        invoke-direct {p0, v8}, Lcom/android/server/power/DisplayPowerController;->setScreenOn(Z)V
    
        :cond_6
        :goto_3
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mLightSensor:Landroid/hardware/Sensor;
    
        if-eqz v6, :cond_7
    
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mTiltSensor:Landroid/hardware/Sensor;
    
        if-eqz v6, :cond_7
    
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mPowerRequest:Lcom/android/server/power/DisplayPowerRequest;
    
        iget-boolean v6, v6, Lcom/android/server/power/DisplayPowerRequest;->useAutoBrightness:Z
    
        if-eqz v6, :cond_19
    
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mPowerRequest:Lcom/android/server/power/DisplayPowerRequest;
    
        iget v6, v6, Lcom/android/server/power/DisplayPowerRequest;->screenState:I
    
        invoke-static {v6}, Lcom/android/server/power/DisplayPowerController;->wantScreenOn(I)Z
    
        move-result v6
    
        if-eqz v6, :cond_19
    
        move v6, v7
    
        :goto_4
        invoke-direct {p0, v6, v4}, Lcom/android/server/power/DisplayPowerController;->setLightSensorEnabled(ZZ)V
    
        :cond_7
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mPowerRequest:Lcom/android/server/power/DisplayPowerRequest;
    
        iget v6, v6, Lcom/android/server/power/DisplayPowerRequest;->screenState:I
    
        invoke-static {v6}, Lcom/android/server/power/DisplayPowerController;->wantScreenOn(I)Z
    
        move-result v6
    
        if-eqz v6, :cond_1d
    
        iget v6, p0, Lcom/android/server/power/DisplayPowerController;->mScreenAutoBrightness:I
    
        if-ltz v6, :cond_1a
    
        iget-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mLightSensorEnabled:Z
    
        if-eqz v6, :cond_1a
    
        iget v3, p0, Lcom/android/server/power/DisplayPowerController;->mScreenAutoBrightness:I
    
        iget-boolean v2, p0, Lcom/android/server/power/DisplayPowerController;->mUsingScreenAutoBrightness:Z
    
        iput-boolean v7, p0, Lcom/android/server/power/DisplayPowerController;->mUsingScreenAutoBrightness:Z
    
        :goto_5
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mPowerRequest:Lcom/android/server/power/DisplayPowerRequest;
    
        iget v6, v6, Lcom/android/server/power/DisplayPowerRequest;->screenState:I
    
        const/4 v9, 0x2
    
        if-ne v6, v9, :cond_8
    
        iput v3, p0, Lcom/android/server/power/DisplayPowerController;->mScreenBrightnessOnCover:I
    
        :cond_8
        invoke-direct {p0, v3}, Lcom/android/server/power/DisplayPowerController;->getFinalBrightness(I)I
    
        move-result v3
    
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mPowerRequest:Lcom/android/server/power/DisplayPowerRequest;
    
        iget v6, v6, Lcom/android/server/power/DisplayPowerRequest;->screenState:I
    
        if-ne v6, v7, :cond_1b
    
        add-int/lit8 v6, v3, -0xa
    
        iget v9, p0, Lcom/android/server/power/DisplayPowerController;->mScreenBrightnessDimConfig:I
    
        invoke-static {v6, v9}, Ljava/lang/Math;->min(II)I
    
        move-result v3
    
        const/4 v2, 0x0
    
        :cond_9
        :goto_6
        invoke-direct {p0, v3}, Lcom/android/server/power/DisplayPowerController;->clampScreenBrightness(I)I
    
        move-result v9
    
        if-eqz v2, :cond_1c
    
        const/16 v6, 0x1f4
    
        :goto_7
        invoke-direct {p0, v9, v6}, Lcom/android/server/power/DisplayPowerController;->animateScreenBrightness(II)V
    
        :goto_8
        iget-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mScreenOffBecauseOfProximity:Z
    
        if-nez v6, :cond_a
    
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mPowerRequest:Lcom/android/server/power/DisplayPowerRequest;
    
        iget v6, v6, Lcom/android/server/power/DisplayPowerRequest;->screenState:I
    
        invoke-static {v6}, Lcom/android/server/power/DisplayPowerController;->wantScreenOn(I)Z
    
        move-result v6
    
        if-eqz v6, :cond_23
    
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mElectronBeamOffAnimator:Landroid/animation/ObjectAnimator;
    
        invoke-virtual {v6}, Landroid/animation/ObjectAnimator;->isStarted()Z
    
        move-result v6
    
        if-nez v6, :cond_a
    
        invoke-direct {p0, v7}, Lcom/android/server/power/DisplayPowerController;->setScreenOn(Z)V
    
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mPowerRequest:Lcom/android/server/power/DisplayPowerRequest;
    
        iget-boolean v6, v6, Lcom/android/server/power/DisplayPowerRequest;->blockScreenOn:Z
    
        if-eqz v6, :cond_1e
    
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mPowerState:Lcom/android/server/power/DisplayPowerState;
    
        invoke-virtual {v6}, Lcom/android/server/power/DisplayPowerState;->getElectronBeamLevel()F
    
        move-result v6
    
        const v10, 0x0
    
        cmpl-float v6, v6, v10
    
        if-nez v6, :cond_1e
    
        invoke-direct {p0}, Lcom/android/server/power/DisplayPowerController;->blockScreenOn()V
    
        :cond_a
        :goto_9
        if-eqz v1, :cond_0
    
        iget-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mScreenOnWasBlocked:Z
    
        if-nez v6, :cond_0
    
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mElectronBeamOnAnimator:Landroid/animation/ObjectAnimator;
    
        invoke-virtual {v6}, Landroid/animation/ObjectAnimator;->isStarted()Z
    
        move-result v6
    
        if-nez v6, :cond_0
    
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mElectronBeamOffAnimator:Landroid/animation/ObjectAnimator;
    
        invoke-virtual {v6}, Landroid/animation/ObjectAnimator;->isStarted()Z
    
        move-result v6
    
        if-nez v6, :cond_0
    
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mPowerState:Lcom/android/server/power/DisplayPowerState;
    
        iget-object v7, p0, Lcom/android/server/power/DisplayPowerController;->mCleanListener:Ljava/lang/Runnable;
    
        invoke-virtual {v6, v7}, Lcom/android/server/power/DisplayPowerState;->waitUntilClean(Ljava/lang/Runnable;)Z
    
        move-result v6
    
        if-eqz v6, :cond_0
    
        iget-object v7, p0, Lcom/android/server/power/DisplayPowerController;->mLock:Ljava/lang/Object;
    
        monitor-enter v7
    
        :try_start_1
        iget-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mPendingRequestChangedLocked:Z
    
        if-nez v6, :cond_b
    
        const/4 v6, 0x1
    
        iput-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mDisplayReadyLocked:Z
    
        sget-boolean v6, Lcom/android/server/power/DisplayPowerController;->DEBUG:Z
    
        if-eqz v6, :cond_b
    
        const-string v6, "DisplayPowerController"
    
        const-string v8, "Display ready!"
    
        invoke-static {v6, v8}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I
    
        :cond_b
        monitor-exit v7
        :try_end_1
        .catchall {:try_start_1 .. :try_end_1} :catchall_1
    
        invoke-direct {p0}, Lcom/android/server/power/DisplayPowerController;->sendOnStateChangedWithWakelock()V
    
        goto/16 :goto_0
    
        :cond_c
        :try_start_2
        iget-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mPendingRequestChangedLocked:Z
    
        if-eqz v6, :cond_2
    
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mPowerRequest:Lcom/android/server/power/DisplayPowerRequest;
    
        iget v6, v6, Lcom/android/server/power/DisplayPowerRequest;->screenAutoBrightnessAdjustment:F
    
        iget-object v10, p0, Lcom/android/server/power/DisplayPowerController;->mPendingRequestLocked:Lcom/android/server/power/DisplayPowerRequest;
    
        iget v10, v10, Lcom/android/server/power/DisplayPowerRequest;->screenAutoBrightnessAdjustment:F
    
        cmpl-float v6, v6, v10
    
        if-eqz v6, :cond_d
    
        const/4 v4, 0x1
    
        :cond_d
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mPowerRequest:Lcom/android/server/power/DisplayPowerRequest;
    
        iget-boolean v6, v6, Lcom/android/server/power/DisplayPowerRequest;->autoBrightnessForEbookOnly:Z
    
        iget-object v10, p0, Lcom/android/server/power/DisplayPowerController;->mPendingRequestLocked:Lcom/android/server/power/DisplayPowerRequest;
    
        iget-boolean v10, v10, Lcom/android/server/power/DisplayPowerRequest;->autoBrightnessForEbookOnly:Z
    
        if-eq v6, v10, :cond_e
    
        const-string v6, "DisplayPowerController"
    
        new-instance v10, Ljava/lang/StringBuilder;
    
        invoke-direct {v10}, Ljava/lang/StringBuilder;-><init>()V
    
        const-string v11, "[DAB] updatePowerState : autoBrightnessForEbookOnly : "
    
        invoke-virtual {v10, v11}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
    
        move-result-object v10
    
        iget-object v11, p0, Lcom/android/server/power/DisplayPowerController;->mPendingRequestLocked:Lcom/android/server/power/DisplayPowerRequest;
    
        iget-boolean v11, v11, Lcom/android/server/power/DisplayPowerRequest;->autoBrightnessForEbookOnly:Z
    
        invoke-virtual {v10, v11}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;
    
        move-result-object v10
    
        invoke-virtual {v10}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
    
        move-result-object v10
    
        invoke-static {v6, v10}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I
    
        const/4 v4, 0x1
    
        :cond_e
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mPowerRequest:Lcom/android/server/power/DisplayPowerRequest;
    
        iget v6, v6, Lcom/android/server/power/DisplayPowerRequest;->screenState:I
    
        if-ne v6, v7, :cond_f
    
        move v5, v7
    
        :goto_a
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mPowerRequest:Lcom/android/server/power/DisplayPowerRequest;
    
        iget-object v10, p0, Lcom/android/server/power/DisplayPowerController;->mPendingRequestLocked:Lcom/android/server/power/DisplayPowerRequest;
    
        invoke-virtual {v6, v10}, Lcom/android/server/power/DisplayPowerRequest;->copyFrom(Lcom/android/server/power/DisplayPowerRequest;)V
    
        iget-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mWaitingForNegativeProximity:Z
    
        iget-boolean v10, p0, Lcom/android/server/power/DisplayPowerController;->mPendingWaitForNegativeProximityLocked:Z
    
        or-int/2addr v6, v10
    
        iput-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mWaitingForNegativeProximity:Z
    
        const/4 v6, 0x0
    
        iput-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mPendingWaitForNegativeProximityLocked:Z
    
        iget-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mScreenOnEvenThoughProximityPositive:Z
    
        iget-boolean v10, p0, Lcom/android/server/power/DisplayPowerController;->mPendingScreenOnEvenThoughProximityPositiveLocked:Z
    
        or-int/2addr v6, v10
    
        iput-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mScreenOnEvenThoughProximityPositive:Z
    
        const/4 v6, 0x0
    
        iput-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mPendingScreenOnEvenThoughProximityPositiveLocked:Z
    
        const/4 v6, 0x0
    
        iput-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mPendingRequestChangedLocked:Z
    
        const/4 v6, 0x0
    
        iput-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mDisplayReadyLocked:Z
    
        goto/16 :goto_1
    
        :catchall_0
        move-exception v6
    
        monitor-exit v9
        :try_end_2
        .catchall {:try_start_2 .. :try_end_2} :catchall_0
    
        throw v6
    
        :cond_f
        move v5, v8
    
        goto :goto_a
    
        :cond_10
        move v1, v8
    
        goto/16 :goto_2
    
        :cond_11
        invoke-direct {p0, v7}, Lcom/android/server/power/DisplayPowerController;->setProximitySensorEnabled(Z)V
    
        iget v6, p0, Lcom/android/server/power/DisplayPowerController;->mProximity:I
    
        if-ne v6, v7, :cond_14
    
        iget-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mScreenOnEvenThoughProximityPositive:Z
    
        if-nez v6, :cond_12
    
        iput-boolean v7, p0, Lcom/android/server/power/DisplayPowerController;->mScreenOffBecauseOfProximity:Z
    
        invoke-direct {p0, v8}, Lcom/android/server/power/DisplayPowerController;->setScreenOn(Z)V
    
        invoke-direct {p0}, Lcom/android/server/power/DisplayPowerController;->sendOnProximityPositiveWithWakelock()V
    
        goto/16 :goto_3
    
        :cond_12
        iget-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mScreenOffBecauseOfProximity:Z
    
        if-eqz v6, :cond_6
    
        iget-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mScreenOnEvenThoughProximityPositive:Z
    
        if-eqz v6, :cond_6
    
        iput-boolean v8, p0, Lcom/android/server/power/DisplayPowerController;->mScreenOffBecauseOfProximity:Z
    
        invoke-direct {p0, v7}, Lcom/android/server/power/DisplayPowerController;->setScreenOn(Z)V
    
        iget-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mScreenOnEvenThoughProximityPositive:Z
    
        if-eqz v6, :cond_13
    
        const-string v6, "DisplayPowerController"
    
        const-string v9, "[sensor] proximity : mScreenOnEvenThoughProximityPositive is true"
    
        invoke-static {v6, v9}, Landroid/util/Slog;->d(Ljava/lang/String;Ljava/lang/String;)I
    
        :cond_13
        invoke-direct {p0}, Lcom/android/server/power/DisplayPowerController;->sendOnProximityNegativeWithWakelock()V
    
        goto/16 :goto_3
    
        :cond_14
        iget v6, p0, Lcom/android/server/power/DisplayPowerController;->mProximity:I
    
        if-nez v6, :cond_6
    
        iget-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mScreenOffBecauseOfProximity:Z
    
        if-eqz v6, :cond_6
    
        iput-boolean v8, p0, Lcom/android/server/power/DisplayPowerController;->mScreenOffBecauseOfProximity:Z
    
        invoke-direct {p0, v7}, Lcom/android/server/power/DisplayPowerController;->setScreenOn(Z)V
    
        invoke-direct {p0}, Lcom/android/server/power/DisplayPowerController;->sendOnProximityNegativeWithWakelock()V
    
        goto/16 :goto_3
    
        :cond_15
        iget-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mWaitingForNegativeProximity:Z
    
        if-eqz v6, :cond_17
    
        iput-boolean v8, p0, Lcom/android/server/power/DisplayPowerController;->mScreenOnEvenThoughProximityPositive:Z
    
        iget v6, p0, Lcom/android/server/power/DisplayPowerController;->mProximity:I
    
        if-ne v6, v7, :cond_16
    
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mPowerRequest:Lcom/android/server/power/DisplayPowerRequest;
    
        iget v6, v6, Lcom/android/server/power/DisplayPowerRequest;->screenState:I
    
        invoke-static {v6}, Lcom/android/server/power/DisplayPowerController;->wantScreenOn(I)Z
    
        move-result v6
    
        if-eqz v6, :cond_6
    
        :cond_16
        invoke-direct {p0, v8}, Lcom/android/server/power/DisplayPowerController;->setProximitySensorEnabled(Z)V
    
        iput-boolean v8, p0, Lcom/android/server/power/DisplayPowerController;->mScreenOffBecauseOfProximity:Z
    
        invoke-direct {p0, v7}, Lcom/android/server/power/DisplayPowerController;->setScreenOn(Z)V
    
        invoke-direct {p0}, Lcom/android/server/power/DisplayPowerController;->sendOnProximityNegativeWithWakelock()V
    
        iput-boolean v8, p0, Lcom/android/server/power/DisplayPowerController;->mWaitingForNegativeProximity:Z
    
        goto/16 :goto_3
    
        :cond_17
        iput-boolean v8, p0, Lcom/android/server/power/DisplayPowerController;->mScreenOnEvenThoughProximityPositive:Z
    
        invoke-direct {p0, v8}, Lcom/android/server/power/DisplayPowerController;->setProximitySensorEnabled(Z)V
    
        iget-boolean v6, p0, Lcom/android/server/power/DisplayPowerController;->mScreenOffBecauseOfProximity:Z
    
        if-eqz v6, :cond_6
    
        iput-boolean v8, p0, Lcom/android/server/power/DisplayPowerController;->mScreenOffBecauseOfProximity:Z
    
        invoke-direct {p0, v7}, Lcom/android/server/power/DisplayPowerController;->setScreenOn(Z)V
    
        invoke-direct {p0}, Lcom/android/server/power/DisplayPowerController;->sendOnProximityNegativeWithWakelock()V
    
        goto/16 :goto_3
    
        :cond_18
        iput-boolean v8, p0, Lcom/android/server/power/DisplayPowerController;->mWaitingForNegativeProximity:Z
    
        goto/16 :goto_3
    
        :cond_19
        move v6, v8
    
        goto/16 :goto_4
    
        :cond_1a
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mPowerRequest:Lcom/android/server/power/DisplayPowerRequest;
    
        iget v3, v6, Lcom/android/server/power/DisplayPowerRequest;->screenBrightness:I
    
        const/4 v2, 0x0
    
        iput-boolean v8, p0, Lcom/android/server/power/DisplayPowerController;->mUsingScreenAutoBrightness:Z
    
        goto/16 :goto_5
    
        :cond_1b
        if-eqz v5, :cond_9
    
        const/4 v2, 0x0
    
        goto/16 :goto_6
    
        :cond_1c
        const/16 v6, 0x7d0
    
        goto/16 :goto_7
    
        :cond_1d
        iput-boolean v8, p0, Lcom/android/server/power/DisplayPowerController;->mUsingScreenAutoBrightness:Z
    
        goto/16 :goto_8
    
        :cond_1e
        invoke-direct {p0}, Lcom/android/server/power/DisplayPowerController;->unblockScreenOn()V
    
        iget v10, p0, Lcom/android/server/power/DisplayPowerController;->mElectronBeamOn:I
    
        if-nez v10, :cond_1f
    
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mPowerState:Lcom/android/server/power/DisplayPowerState;
    
        const/high16 v7, 0x3f80
    
        invoke-virtual {v6, v7}, Lcom/android/server/power/DisplayPowerState;->setElectronBeamLevel(F)V
    
        invoke-virtual {v6}, Lcom/android/server/power/DisplayPowerState;->dismissElectronBeam()V
    
        goto/16 :goto_9
    
        :cond_1f
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mElectronBeamOnAnimator:Landroid/animation/ObjectAnimator;
    
        invoke-virtual {v6}, Landroid/animation/ObjectAnimator;->isStarted()Z
    
        move-result v6
    
        if-nez v6, :cond_a
    
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mPowerState:Lcom/android/server/power/DisplayPowerState;
    
        invoke-virtual {v6}, Lcom/android/server/power/DisplayPowerState;->getElectronBeamLevel()F
    
        move-result v6
    
        const/high16 v7, 0x3f80
    
        cmpl-float v6, v6, v7
    
        if-nez v6, :cond_20
    
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mPowerState:Lcom/android/server/power/DisplayPowerState;
    
        invoke-virtual {v6}, Lcom/android/server/power/DisplayPowerState;->dismissElectronBeam()V
    
        goto/16 :goto_9
    
        :cond_20
        const v6, 0x2
    
        if-eq v6, v10, :cond_21
    
        const v10, 0x0
    
        :cond_21
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mPowerState:Lcom/android/server/power/DisplayPowerState;
    
        invoke-virtual {v6, v10}, Lcom/android/server/power/DisplayPowerState;->prepareElectronBeam(I)Z
    
        move-result v6
    
        if-eqz v6, :cond_22
    
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mElectronBeamOnAnimator:Landroid/animation/ObjectAnimator;
    
        invoke-virtual {v6}, Landroid/animation/ObjectAnimator;->start()V
    
        goto/16 :goto_9
    
        :cond_22
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mElectronBeamOnAnimator:Landroid/animation/ObjectAnimator;
    
        invoke-virtual {v6}, Landroid/animation/ObjectAnimator;->end()V
    
        goto/16 :goto_9
    
        :cond_23
        iget v10, p0, Lcom/android/server/power/DisplayPowerController;->mElectronBeamOff:I
    
        if-nez v10, :cond_24
    
        invoke-direct {p0, v8}, Lcom/android/server/power/DisplayPowerController;->setScreenOn(Z)V
    
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mPowerRequest:Lcom/android/server/power/DisplayPowerRequest;
    
        iget-boolean v6, v6, Lcom/android/server/power/DisplayPowerRequest;->blockScreenOn:Z
    
        if-nez v6, :cond_a
    
        invoke-direct {p0}, Lcom/android/server/power/DisplayPowerController;->unblockScreenOn()V
    
        goto/16 :goto_9
    
        :cond_24
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mElectronBeamOnAnimator:Landroid/animation/ObjectAnimator;
    
        invoke-virtual {v6}, Landroid/animation/ObjectAnimator;->isStarted()Z
    
        move-result v6
    
        if-nez v6, :cond_a
    
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mElectronBeamOffAnimator:Landroid/animation/ObjectAnimator;
    
        invoke-virtual {v6}, Landroid/animation/ObjectAnimator;->isStarted()Z
    
        move-result v6
    
        if-nez v6, :cond_a
    
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mPowerState:Lcom/android/server/power/DisplayPowerState;
    
        invoke-virtual {v6}, Lcom/android/server/power/DisplayPowerState;->getElectronBeamLevel()F
    
        move-result v6
    
        const v10, 0x0
    
        cmpl-float v6, v6, v10
    
        if-nez v6, :cond_25
    
        invoke-direct {p0, v8}, Lcom/android/server/power/DisplayPowerController;->setScreenOn(Z)V
    
        goto/16 :goto_9
    
        :cond_25
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mPowerState:Lcom/android/server/power/DisplayPowerState;
    
        iget v10, p0, Lcom/android/server/power/DisplayPowerController;->mElectronBeamOff:I
    
        invoke-virtual {v6, v10}, Lcom/android/server/power/DisplayPowerState;->prepareElectronBeam(I)Z
    
        move-result v6
    
        if-eqz v6, :cond_26
    
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mPowerState:Lcom/android/server/power/DisplayPowerState;
    
        invoke-virtual {v6}, Lcom/android/server/power/DisplayPowerState;->isScreenOn()Z
    
        move-result v6
    
        if-eqz v6, :cond_26
    
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mElectronBeamOffAnimator:Landroid/animation/ObjectAnimator;
    
        invoke-virtual {v6}, Landroid/animation/ObjectAnimator;->start()V
    
        goto/16 :goto_9
    
        :cond_26
        iget-object v6, p0, Lcom/android/server/power/DisplayPowerController;->mElectronBeamOffAnimator:Landroid/animation/ObjectAnimator;
    
        invoke-virtual {v6}, Landroid/animation/ObjectAnimator;->end()V
    
        goto/16 :goto_9
    
        :catchall_1
        move-exception v6
    
        :try_start_3
        monitor-exit v7
        :try_end_3
        .catchall {:try_start_3 .. :try_end_3} :catchall_1
    
        throw v6
    .end method
  • Last step in this smali
  • Search for
    Code:
    .method public requestPowerState(Lcom/android/server/power/DisplayPowerRequest;ZZ)Z
    And place the following methods DIRECTLY ABOVE it
    Code:
    .method public onAnimationCancel(Landroid/animation/Animator;)V
        .locals 0
    
        return-void
    .end method
    
    .method public onAnimationEnd(Landroid/animation/Animator;)V
        .locals 0
    
        invoke-direct {p0}, Lcom/android/server/power/DisplayPowerController;->sendUpdatePowerState()V
    
        return-void
    .end method
    
    .method public onAnimationRepeat(Landroid/animation/Animator;)V
        .locals 0
    
        return-void
    .end method
    
    .method public onAnimationStart(Landroid/animation/Animator;)V
        .locals 0
    
        return-void
    .end method
  • That's all for the services.jar!
  • Finally you must add this value to your build.prop
    Code:
    #CRT Mod
    persist.sys.screen_off=crt
  • You can use any of the following values for off : fade, crt, none
I have also attached both the original and edited smali for diffing out
Enjoy!!
Attached Files
File Type: zip Diffs.zip - [Click for QR Code] (40.6 KB, 43 views)
Last edited by rompnit; 3rd August 2014 at 08:55 PM.
The Following 14 Users Say Thank You to rompnit For This Useful Post: [ View ]
4th July 2014, 12:12 AM   |  #3  
rompnit's Avatar
OP Recognized Contributor / Themer
Flag Granger, IN
Thanks Meter: 17,249
 
2,834 posts
Join Date:Joined: Aug 2008
Donate to Me
More
Reserved just because
The Following 3 Users Say Thank You to rompnit For This Useful Post: [ View ]
4th July 2014, 05:21 AM   |  #4  
tdunham's Avatar
Recognized Contributor
TampaBay
Thanks Meter: 18,890
 
8,399 posts
Join Date:Joined: Jun 2008
Donate to Me
More
Great guide.
Can't wait to see it in action.
The Following 2 Users Say Thank You to tdunham For This Useful Post: [ View ]
4th July 2014, 05:05 PM   |  #5  
AxAtAx's Avatar
Recognized Contributor
Flag ViSiONViLLE
Thanks Meter: 13,061
 
10,699 posts
Join Date:Joined: Mar 2011
Donate to Me
More
Aewsome, this is great, thanks @rompnit, great work! Out of thanks, be back shortly, I got to do this mod here real quick....
The Following User Says Thank You to AxAtAx For This Useful Post: [ View ]
4th July 2014, 07:14 PM   |  #6  
AxAtAx's Avatar
Recognized Contributor
Flag ViSiONViLLE
Thanks Meter: 13,061
 
10,699 posts
Join Date:Joined: Mar 2011
Donate to Me
More
worked on both S5 and Note3...rocking now...thanks. Nice work...👍
The Following User Says Thank You to AxAtAx For This Useful Post: [ View ]
5th July 2014, 08:49 AM   |  #7  
Senior Member
Thanks Meter: 96
 
404 posts
Join Date:Joined: Mar 2008
Great guide, thank you!

In theory, someone that has this working on a stock (rooted of course) NCG build could share the modded files to save others the more sensitive and tricky work right? If so, anyone willing to share those files? Haven't touched bs in a couple years now ☺
7th July 2014, 09:32 PM   |  #8  
Versatile1's Avatar
Senior Member
Flag Texoma
Thanks Meter: 312
 
455 posts
Join Date:Joined: Aug 2011
Donate to Me
More
Know of any other bool or setting that would be preventing this from working?
7th July 2014, 11:16 PM   |  #9  
rompnit's Avatar
OP Recognized Contributor / Themer
Flag Granger, IN
Thanks Meter: 17,249
 
2,834 posts
Join Date:Joined: Aug 2008
Donate to Me
More
Quote:
Originally Posted by Versatile1

Know of any other bool or setting that would be preventing this from working?

Could double check framework-res for
Code:
<bool name="config_animateScreenLights">true</bool>
Make sure it's indeed set to 'true'.
What firmware/device are you modding?
7th July 2014, 11:24 PM   |  #10  
Versatile1's Avatar
Senior Member
Flag Texoma
Thanks Meter: 312
 
455 posts
Join Date:Joined: Aug 2011
Donate to Me
More
S5 DEV edition G900VOYU1ANCG

services.jar is almost identical as retail.

Sent from my SM-G900V using Tapatalk

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Samsung Galaxy S 5 Unified Development by ThreadRank