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

Commit 3294bbba authored by Colin Cross's avatar Colin Cross
Browse files

init: Allow services to start before property triggers are up

Change-Id: I4f87657123bea88b7b5c537781868908d8d66b01
parent cd0f173e
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -193,9 +193,11 @@ void service_start(struct service *svc, const char *dynamic_args)
        char tmp[32];
        int fd, sz;

        if (properties_inited()) {
            get_property_workspace(&fd, &sz);
            sprintf(tmp, "%d,%d", dup(fd), sz);
            add_environment("ANDROID_PROPERTY_WORKSPACE", tmp);
        }

        for (ei = svc->envvars; ei; ei = ei->next)
            add_environment(ei->name, ei->value);
@@ -281,6 +283,7 @@ void service_start(struct service *svc, const char *dynamic_args)
    svc->pid = pid;
    svc->flags |= SVC_RUNNING;

    if (properties_inited())
        notify_service_state(svc->name, "running");
}

+7 −1
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@
#define PERSISTENT_PROPERTY_DIR  "/data/property"

static int persistent_properties_loaded = 0;
static int property_area_inited = 0;

static int property_set_fd = -1;

@@ -164,7 +165,7 @@ static int init_property_area(void)

        /* plug into the lib property services */
    __system_property_area__ = pa;

    property_area_inited = 1;
    return 0;
}

@@ -497,6 +498,11 @@ void property_init(void)
    load_properties_from_file(PROP_PATH_RAMDISK_DEFAULT);
}

int properties_inited(void)
{
    return property_area_inited;
}

void start_property_service(void)
{
    int fd;
+1 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ extern void start_property_service(void);
void get_property_workspace(int *fd, int *sz);
extern const char* property_get(const char *name);
extern int property_set(const char *name, const char *value);
extern int properties_inited();
int get_property_set_fd(void);

#endif	/* _INIT_PROPERTY_H */