[Galaxy Note 3 Android Development] oluwaponmile:
AOD & Night Clock Fix Guide.

I have had a lot of people contacting me since when we fixed the AOD and Night Clock blinking issue, wanting to know how it was fixed. I have helped some devs and users on this and the request grew more since Shinto remove the support for AOD in his kernel.

I have decided to share how to fix the issue here so people can do it themselves, I will only need to point them to this guide. Good idea to teach people how to fish rather than giving them fish.

This fix will work for any ported N7 rom irrespective of the device as long as the AOD feature has been ported correctly. Porting AOD feature is outside the scope of this guide. For other ported firmware e.g. s7e, some other smali need modifying to fix AOD for them. I can deal with this on individual bases as I don't have such device.

The fix entails using two resource ids from the framework-res.apk (config_powerDecoupleAutoSuspendModeFromDisplay" id="0x01120073", config_powerDecoupleInteractiveModeFromDisplay" id="0x01120074") but since the guide is for ported N7, those ids will be the same, so I won't be covering obtaining the IDs from the framework-res.apk file.

I have simplified the fix, so all that is need is a simple copy and replace a method in PowerManagerService.smali file.

Let's do it:

1. Decompile services.jar

2. Navigate to com/android/server/power and open PowerManagerService.smali

3. Search for .method private readConfigurationLocked()V

4. Replace the method with the method below

.method private readConfigurationLocked()V
.locals 3

const/4 v2, 0x1

iget-object v1, p0, Lcom/android/server/power/PowerManagerService;->mContext:Landroid/content/Context;

invoke-virtual {v1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

move-result-object v0

const v1, 0x1120073

invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getBoolean(I)Z

move-result v1

iput-boolean v1, p0, Lcom/android/server/power/PowerManagerService;->mDecoupleHalAutoSuspendModeFromDisplayConfig:Z

const v1, 0x1120074

invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getBoolean(I)Z

move-result v1

iput-boolean v1, p0, Lcom/android/server/power/PowerManagerService;->mDecoupleHalInteractiveModeFromDisplayConfig:Z

iput-boolean v2, p0, Lcom/android/server/power/PowerManagerService;->mWakeUpWhenPluggedOrUnpluggedConfig:Z

const v1, 0x112002f

invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getBoolean(I)Z

move-result v1

iput-boolean v1, p0, Lcom/android/server/power/PowerManagerService;->mWakeUpWhenPluggedOrUnpluggedInTheaterModeConfig:Z

const v1, 0x1120042

invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getBoolean(I)Z

move-result v1

iput-boolean v1, p0, Lcom/android/server/power/PowerManagerService;->mSuspendWhenScreenOffDueToProximityConfig:Z

const v1, 0x112006d

invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getBoolean(I)Z

move-result v1

iput-boolean v1, p0, Lcom/android/server/power/PowerManagerService;->mDreamsSupportedConfig:Z

const v1, 0x112006e

invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getBoolean(I)Z

move-result v1

iput-boolean v1, p0, Lcom/android/server/power/PowerManagerService;->mDreamsEnabledByDefaultConfig:Z

const v1, 0x1120070

invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getBoolean(I)Z

move-result v1

iput-boolean v1, p0, Lcom/android/server/power/PowerManagerService;->mDreamsActivatedOnSleepByDefaultConfig:Z

const v1, 0x112006f

invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getBoolean(I)Z

move-result v1

iput-boolean v1, p0, Lcom/android/server/power/PowerManagerService;->mDreamsActivatedOnDockByDefaultConfig:Z

const v1, 0x1120071

invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getBoolean(I)Z

move-result v1

iput-boolean v1, p0, Lcom/android/server/power/PowerManagerService;->mDreamsEnabledOnBatteryConfig:Z

const v1, 0x10e0080

invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getInteger(I)I

move-result v1

iput v1, p0, Lcom/android/server/power/PowerManagerService;->mDreamsBatteryLevelMinimumWhenPoweredConfig:I

const v1, 0x10e0081

invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getInteger(I)I

move-result v1

iput v1, p0, Lcom/android/server/power/PowerManagerService;->mDreamsBatteryLevelMinimumWhenNotPoweredConfig:I

const v1, 0x10e0082

invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getInteger(I)I

move-result v1

iput v1, p0, Lcom/android/server/power/PowerManagerService;->mDreamsBatteryLevelDrainCutoffConfig:I

const v1, 0x1120072

invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getBoolean(I)Z

move-result v1

iput-boolean v1, p0, Lcom/android/server/power/PowerManagerService;->mDozeAfterScreenOffConfig:Z

const v1, 0x10e0083

invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getInteger(I)I

move-result v1

iput v1, p0, Lcom/android/server/power/PowerManagerService;->mMinimumScreenOffTimeoutConfig:I

const v1, 0x10e0084

invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getInteger(I)I

move-result v1

iput v1, p0, Lcom/android/server/power/PowerManagerService;->mMaximumScreenDimDurationConfig:I

const v1, 0x1130002

invoke-virtual {v0, v1, v2, v2}, Landroid/content/res/Resources;->getFraction(III)F

move-result v1

iput v1, p0, Lcom/android/server/power/PowerManagerService;->mMaximumScreenDimRatioConfig:F

const v1, 0x11200b3

invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getBoolean(I)Z

move-result v1

iput-boolean v1, p0, Lcom/android/server/power/PowerManagerService;->mSupportsDoubleTapWakeConfig:Z

return-void
.end method

5. Recompile and enjoy

Will be linked in OP