Skip to content

Commit

Permalink
Merge "Load the persistent properties after decrypting the /data part…
Browse files Browse the repository at this point in the history
…ition" into honeycomb-mr1
  • Loading branch information
Ken Sumrall authored and Android (Google) Code Review committed Mar 11, 2011
2 parents 7098710 + c5c5103 commit 5db0897
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 1 deletion.
11 changes: 10 additions & 1 deletion init/builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ int do_mount(int nargs, char **args)
unsigned flags = 0;
int n, i;
int wait = 0;
char *prop;

for (n = 4; n < nargs; n++) {
for (i = 0; mount_flags[i].name; i++) {
Expand Down Expand Up @@ -416,6 +415,8 @@ int do_mount(int nargs, char **args)
* unencrypted, and also trigger the action for a nonencrypted system.
*/
if (!strcmp(target, DATA_MNT_POINT)) {
const char *prop;

prop = property_get("ro.crypto.state");
if (! prop) {
prop = "notset";
Expand Down Expand Up @@ -631,6 +632,14 @@ int do_loglevel(int nargs, char **args) {
return -1;
}

int do_load_persist_props(int nargs, char **args) {
if (nargs == 1) {
load_persist_props();
return 0;
}
return -1;
}

int do_wait(int nargs, char **args)
{
if (nargs == 2) {
Expand Down
1 change: 1 addition & 0 deletions init/init_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ int lookup_keyword(const char *s)
break;
case 'l':
if (!strcmp(s, "oglevel")) return K_loglevel;
if (!strcmp(s, "oad_persist_props")) return K_load_persist_props;
break;
case 'm':
if (!strcmp(s, "kdir")) return K_mkdir;
Expand Down
2 changes: 2 additions & 0 deletions init/keywords.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ int do_copy(int nargs, char **args);
int do_chown(int nargs, char **args);
int do_chmod(int nargs, char **args);
int do_loglevel(int nargs, char **args);
int do_load_persist_props(int nargs, char **args);
int do_wait(int nargs, char **args);
#define __MAKE_KEYWORD_ENUM__
#define KEYWORD(symbol, flags, nargs, func) K_##symbol,
Expand Down Expand Up @@ -81,6 +82,7 @@ enum {
KEYWORD(chown, COMMAND, 2, do_chown)
KEYWORD(chmod, COMMAND, 2, do_chmod)
KEYWORD(loglevel, COMMAND, 1, do_loglevel)
KEYWORD(load_persist_props, COMMAND, 0, do_load_persist_props)
KEYWORD(ioprio, OPTION, 0, 0)
#ifdef __MAKE_KEYWORD_ENUM__
KEYWORD_COUNT,
Expand Down
12 changes: 12 additions & 0 deletions init/property_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,18 @@ int properties_inited(void)
return property_area_inited;
}

/* When booting an encrypted system, /data is not mounted when the
* property service is started, so any properties stored there are
* not loaded. Vold triggers init to load these properties once it
* has mounted /data.
*/
void load_persist_props(void)
{
load_properties_from_file(PROP_PATH_LOCAL_OVERRIDE);
/* Read persistent properties after all default values have been loaded. */
load_persistent_properties();
}

void start_property_service(void)
{
int fd;
Expand Down
1 change: 1 addition & 0 deletions init/property_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

extern void handle_property_set_fd(void);
extern void property_init(void);
extern void load_persist_props(void);
extern void start_property_service(void);
void get_property_workspace(int *fd, int *sz);
extern const char* property_get(const char *name);
Expand Down
3 changes: 3 additions & 0 deletions rootdir/init.rc
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,9 @@ on nonencrypted
on property:vold.decrypt=trigger_reset_main
class_reset main

on property:vold.decrypt=trigger_load_persist_props
load_persist_props

on property:vold.decrypt=trigger_post_fs_data
trigger post-fs-data

Expand Down

0 comments on commit 5db0897

Please sign in to comment.