init: Allow services to start before property triggers are up
Change-Id: I4f87657123bea88b7b5c537781868908d8d66b01
This commit is contained in:
parent
cd0f173e27
commit
3294bbbad9
11
init/init.c
11
init/init.c
|
@ -193,9 +193,11 @@ void service_start(struct service *svc, const char *dynamic_args)
|
|||
char tmp[32];
|
||||
int fd, sz;
|
||||
|
||||
get_property_workspace(&fd, &sz);
|
||||
sprintf(tmp, "%d,%d", dup(fd), sz);
|
||||
add_environment("ANDROID_PROPERTY_WORKSPACE", tmp);
|
||||
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,7 +283,8 @@ void service_start(struct service *svc, const char *dynamic_args)
|
|||
svc->pid = pid;
|
||||
svc->flags |= SVC_RUNNING;
|
||||
|
||||
notify_service_state(svc->name, "running");
|
||||
if (properties_inited())
|
||||
notify_service_state(svc->name, "running");
|
||||
}
|
||||
|
||||
void service_stop(struct service *svc)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue