Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6ba39f66 authored by atinm's avatar atinm Committed by Steve Kondik
Browse files

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
parent 85e6eaad
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -135,7 +135,12 @@ LOCAL_SRC_FILES += memory.c
endif # !x86-atom
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)
+4 −0
Original line number Diff line number Diff line
@@ -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;