libcutils: android_reboot: add thermal shutdown command

Add ANDROID_RB_THERMOFF command to android_reboot(), denoting a power
off due to thermal limits exceeded.  When this command is used, Android
may provide notification to the user about the potentially unexpected
power off at next boot.

Bug: 30994946
Test: Manual: setprop sys.powerctl thermal-shutdown
Change-Id: If2cde1b6a3c281a5750b50295412a4801ed5b2f2
This commit is contained in:
Todd Poynor 2017-01-30 17:27:39 -08:00
parent 5ff091a1fd
commit 061778a8da
2 changed files with 5 additions and 0 deletions

View file

@ -209,6 +209,10 @@ int android_reboot_with_callback(
LINUX_REBOOT_CMD_RESTART2, arg);
break;
case ANDROID_RB_THERMOFF:
ret = reboot(RB_POWER_OFF);
break;
default:
ret = -1;
}

View file

@ -25,6 +25,7 @@ __BEGIN_DECLS
#define ANDROID_RB_RESTART 0xDEAD0001
#define ANDROID_RB_POWEROFF 0xDEAD0002
#define ANDROID_RB_RESTART2 0xDEAD0003
#define ANDROID_RB_THERMOFF 0xDEAD0004
/* Properties */
#define ANDROID_RB_PROPERTY "sys.powerctl"