summaryrefslogtreecommitdiffstats
path: root/init/init.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'init/init.cpp')
-rw-r--r--init/init.cpp41
1 files changed, 40 insertions, 1 deletions
diff --git a/init/init.cpp b/init/init.cpp
index 93fe944..402331b 100644
--- a/init/init.cpp
+++ b/init/init.cpp
@@ -63,13 +63,20 @@
#include "util.h"
#include "ueventd.h"
#include "watchdogd.h"
+#include "vendor_init.h"
struct selabel_handle *sehandle;
struct selabel_handle *sehandle_prop;
static int property_triggers_enabled = 0;
+#ifndef BOARD_CHARGING_CMDLINE_NAME
+#define BOARD_CHARGING_CMDLINE_NAME "androidboot.battchg_pause"
+#define BOARD_CHARGING_CMDLINE_VALUE "true"
+#endif
+
static char qemu[32];
+static char battchg_pause[32];
static struct action *cur_action = NULL;
static struct command *cur_command = NULL;
@@ -529,6 +536,9 @@ static void msg_restart(const char *name)
void handle_control_message(const char *msg, const char *arg)
{
+ if (!vendor_handle_control_message(msg, arg))
+ return;
+
if (!strcmp(msg,"start")) {
msg_start(arg);
} else if (!strcmp(msg,"stop")) {
@@ -782,6 +792,8 @@ static void import_kernel_nv(char *name, bool for_emulator)
if (!strcmp(name,"qemu")) {
strlcpy(qemu, value, sizeof(qemu));
+ } else if (!strcmp(name,BOARD_CHARGING_CMDLINE_NAME)) {
+ strlcpy(battchg_pause, value, sizeof(battchg_pause));
} else if (!strncmp(name, "androidboot.", 12) && name_len > 12) {
const char *boot_prop_name = name + 12;
char prop[PROP_NAME_MAX];
@@ -799,12 +811,16 @@ static void export_kernel_boot_props() {
const char *dst_prop;
const char *default_value;
} prop_map[] = {
+#ifndef IGNORE_RO_BOOT_SERIALNO
{ "ro.boot.serialno", "ro.serialno", "", },
+#endif
{ "ro.boot.mode", "ro.bootmode", "unknown", },
{ "ro.boot.baseband", "ro.baseband", "unknown", },
{ "ro.boot.bootloader", "ro.bootloader", "unknown", },
{ "ro.boot.hardware", "ro.hardware", "unknown", },
+#ifndef IGNORE_RO_BOOT_REVISION
{ "ro.boot.revision", "ro.revision", "0", },
+#endif
};
for (size_t i = 0; i < ARRAY_SIZE(prop_map); i++) {
char value[PROP_VALUE_MAX];
@@ -986,6 +1002,24 @@ static void selinux_initialize(bool in_kernel_domain) {
}
}
+static int charging_mode_booting(void) {
+#ifndef BOARD_CHARGING_MODE_BOOTING_LPM
+ return 0;
+#else
+ int f;
+ char cmb;
+ f = open(BOARD_CHARGING_MODE_BOOTING_LPM, O_RDONLY);
+ if (f < 0)
+ return 0;
+
+ if (1 != read(f, (void *)&cmb,1))
+ return 0;
+
+ close(f);
+ return ('1' == cmb);
+#endif
+}
+
int main(int argc, char** argv) {
if (!strcmp(basename(argv[0]), "ueventd")) {
return ueventd_main(argc, argv);
@@ -1097,8 +1131,13 @@ int main(int argc, char** argv) {
// Don't mount filesystems or start core system services in charger mode.
char bootmode[PROP_VALUE_MAX];
- if (property_get("ro.bootmode", bootmode) > 0 && strcmp(bootmode, "charger") == 0) {
+ if (((property_get("ro.bootmode", bootmode) > 0 && strcmp(bootmode, "charger") == 0) ||
+ strcmp(battchg_pause, BOARD_CHARGING_CMDLINE_VALUE) == 0)
+ || charging_mode_booting()) {
action_for_each_trigger("charger", action_add_queue_tail);
+ } else if (strncmp(bootmode, "ffbm", 4) == 0) {
+ KLOG_ERROR("Booting into ffbm mode\n");
+ action_for_each_trigger("ffbm", action_add_queue_tail);
} else {
action_for_each_trigger("late-init", action_add_queue_tail);
}