Android permanently off virtual key backlight

Source: Internet
Author: User
Tags save file

The Android system is Linux-based, so you can also use a Linux shell script, so the keyboard lights are forcibly closed using the shell script method.

Principle:

By checking some information, I learned that the keyboard lamp of Android is controlled by/sys/class/leds/button-backlight/brightness parameter in this file, brightness the value in this file will change dynamically with the system to 0 or 255, that is, off and on, that is to say we force the content of this file to be modified and kept to 0 can be closed all the time, know this is good to do.

First wrote a such sh file (equivalent to the bat batch file under Windows)

#!/system/bin/sh

#修改文件内容为0

echo 0 >/sys/class/leds/button-backlight/brightness

#取消系统修改brightness文件的权限

chmod 444/sys/class/leds/button-backlight/brightness

The original file permission is 644 modified to 444 that is, the owner's write permission is canceled

Test run, keyboard light off normally

But restart the system after the keyboard and so on, again to view the brightness file, the original permissions were changed back to the system, then, for the sake of convenience, I think should be turned on automatically run the shell.

The official original ROM does not resemble the CM and so on the ROM has the power to automatically call the Init.d folder Shell's function, but the Android system can be run first/system/etc/ Directory of the install-recovery.sh file, the original ROM does not have this file then I actually put the above code to save to install-recovery.sh change the permissions to the/system/etc/directory can be stored, But in order to add another boot automatically run scripts (such as loading the ext partition and APP2SD, etc.) is convenient, or turn off the keyboard lamp save file is better, so I saved for Init. closebuttonlight.sh, and then create a new install-recovery.sh file with the following contents:

#!/system/bin/sh

/system/etc/init. closebuttonlight.sh&

is actually running the ETC directory under the init. closebuttonlight.sh script only, after what other script can be added directly after install-recovery.sh.

After putting two files into the/system/etc/directory, the test is successful and the keyboard light will never open.

Android permanently off virtual key backlight

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.