diff options
| author | atinm <atinm.dev@gmail.com> | 2011-05-03 00:26:33 -0400 |
|---|---|---|
| committer | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2012-07-10 22:45:28 +0100 |
| commit | 418954f50ff22300c6663f2be058ee440f31a032 (patch) | |
| tree | e8924389f049e51a2f9a2a1caf8bf365a8382d14 /libcutils | |
| parent | bb9f0bbcaf41ee39b24c4ef99766976a0a922a25 (diff) | |
| download | system_core-418954f50ff22300c6663f2be058ee440f31a032.tar.gz system_core-418954f50ff22300c6663f2be058ee440f31a032.tar.bz2 system_core-418954f50ff22300c6663f2be058ee440f31a032.zip | |
Use RECOVERY_PRE_COMMAND before calling __reboot() recovery
For the Power menu,
frameworks/base/core/jni/android_os_Power.cpp#L180
already uses RECOVERY_PRE_COMMAND if
TARGET_RECOVERY_PRE_COMMAND is defined in the
BoardConfig.mk for a device to make a system() call before
calling __reboot() for recovery. This commit adds
the same thing to the other places that we know we are
getting into recovery using __reboot(), namely,
adb reboot recovery, the reboot binary and init
in the case of errors.
Change-Id: If0a9c7f22de2aa187c921b60ad5edd77b49e095d
Diffstat (limited to 'libcutils')
| -rw-r--r-- | libcutils/Android.mk | 5 | ||||
| -rw-r--r-- | libcutils/android_reboot.c | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/libcutils/Android.mk b/libcutils/Android.mk index 5c227b6d..e98c6a8a 100644 --- a/libcutils/Android.mk +++ b/libcutils/Android.mk @@ -141,7 +141,12 @@ endif # !x86-atom endif # !sh endif # !arm +ifneq ($(TARGET_RECOVERY_PRE_COMMAND),) + LOCAL_CFLAGS += -DRECOVERY_PRE_COMMAND='$(TARGET_RECOVERY_PRE_COMMAND)' +endif + LOCAL_C_INCLUDES := $(libcutils_c_includes) $(KERNEL_HEADERS) + LOCAL_STATIC_LIBRARIES := liblog LOCAL_CFLAGS += $(targetSmpFlag) include $(BUILD_STATIC_LIBRARY) diff --git a/libcutils/android_reboot.c b/libcutils/android_reboot.c index 33a7358e..c6d30522 100644 --- a/libcutils/android_reboot.c +++ b/libcutils/android_reboot.c @@ -121,6 +121,10 @@ int android_reboot(int cmd, int flags, char *arg) break; case ANDROID_RB_RESTART2: +#ifdef RECOVERY_PRE_COMMAND + if (!strncmp((char *)arg,"recovery",8)) + system( RECOVERY_PRE_COMMAND ); +#endif ret = __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, arg); break; |
