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

Commit b0d94241 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Gerrit Code Review
Browse files

Merge "init: Reintroduce support for the older charger modes" into jellybean

parents ba77a51e 51b14a69
Loading
Loading
Loading
Loading
+20 −5
Original line number Diff line number Diff line
@@ -69,11 +69,17 @@ static int property_triggers_enabled = 0;
static int   bootchart_count;
#endif

#ifndef BOARD_CHARGING_CMDLINE_NAME
#define BOARD_CHARGING_CMDLINE_NAME "androidboot.battchg_pause"
#define BOARD_CHARGING_CMDLINE_VALUE "true"
#endif

static char console[32];
static char bootmode[32];
static char hardware[32];
static unsigned revision = 0;
static char qemu[32];
static char battchg_pause[32];

#ifdef HAVE_SELINUX
static int selinux_enabled = 1;
@@ -102,6 +108,8 @@ static const char *ENV[32];

static unsigned emmc_boot = 0;

static unsigned charging_mode = 0;

/* add_environment - add "key=value" to the current environment */
int add_environment(const char *key, const char *val)
{
@@ -650,6 +658,8 @@ static void import_kernel_nv(char *name, int for_emulator)
        if (!strcmp(value,"true")) {
            emmc_boot = 1;
        }
    } 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];
@@ -999,6 +1009,11 @@ int main(int argc, char **argv)
    queue_builtin_action(signal_init_action, "signal_init");
    queue_builtin_action(check_startup_action, "check_startup");

    /* Older bootloaders use non-standard charging modes. Check for
     * those now, after mounting the filesystems */
    if (strcmp(battchg_pause, BOARD_CHARGING_CMDLINE_VALUE) == 0)
        is_charger = 1;

    if (is_charger) {
        action_for_each_trigger("charger", action_add_queue_tail);
    } else {