Remove All Ads from XDA

[MOD][DEVS][SENSE ONLY] Night Mode Feature

1,875 posts
Thanks Meter: 814
By ihtfp69, Senior Member on 27th June 2011, 06:11 PM
Post Reply Email Thread
I had a couple people ask me how to do this. I figured I would put together a brief thread on how to accomplish this. I may expand it later if people need more help. This is intended for ROM devs only; however, that should not stop anyone from trying.

The snippet of code below will allow you to turn night mode on/off. Night mode essentially turns off all of the led lights on your phone. I believe the method setNightMode is in most, if not all, Sense roms. I do not believe it is in AOSP.

This can be added as a setting in your Display preferences with a little work. I will attach what I changed on my rom to add the setting. If your rom is based off of the stock inc rom, then you can just replace your files with mine and recompile to get the feature. In addition, you will need to add two strings (night_mode_title & night_mode_summary) to public.xml and strings.xml.

    const-string v1, "power"

    const/4 v2, 0x1

    const/4, v3, 0x0

    invoke-static {v1}, Landroid/os/ServiceManager;->getService(Ljava/lang/String;)Landroid/os/IBinder;

    move-result-object v1

    invoke-static {v1}, Landroid/os/IPowerManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/os/IPowerManager;

    move-result-object v1

    #turn on
    invoke-interface {v1, v2}, Landroid/os/IPowerManager;->setNightMode(I)V

    #turn off
    invoke-interface {v1, v3}, Landroid/os/IPowerManager;->setNightMode(I)V
Attached Files
File Type: zip - [Click for QR Code] (4.2 KB, 38 views)
27th June 2011, 06:11 PM |#2  
ihtfp69's Avatar
OP Senior Member
Thanks Meter: 814
Donate to Me
Reserved for future use ...
27th June 2011, 06:18 PM |#3  
incubus26jc's Avatar
Inactive Recognized Developer
Flag Illinois
Thanks Meter: 3,576
Donate to Me
Thanks bud, Ill try my luck with it
27th June 2011, 08:07 PM |#4  
rosser725's Avatar
Senior Member
Flag Concord, NH
Thanks Meter: 30
Donate to Me
Cool!!! I'll have to try this
Post Reply Subscribe to Thread

mode, night, sense

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes