Send unsolicited time response to first signal strength query after loadvm
Change-Id: I9c6260493d42564ee3aa34799313368bb2de7d4d
diff --git a/android/cmdline-options.h b/android/cmdline-options.h
index b65b29a..3ee5f45 100644
--- a/android/cmdline-options.h
+++ b/android/cmdline-options.h
@@ -84,6 +84,7 @@
OPT_FLAG ( no_snapshot_save, "do not auto-save to snapshot on exit: abandon changed state" )
OPT_FLAG ( no_snapshot_load, "do not auto-start from snapshot: perform a full boot" )
OPT_FLAG ( snapshot_list, "show a list of available snapshots" )
+OPT_FLAG ( no_snapshot_update_time, "do not do try to correct snapshot time on restore" )
#endif
OPT_FLAG ( wipe_data, "reset the use data image (copy it from initdata)" )
CFG_PARAM( avd, "<name>", "use a specific android virtual device" )
diff --git a/android/help.c b/android/help.c
index 93ae8b1..f226cf6 100644
--- a/android/help.c
+++ b/android/help.c
@@ -721,6 +721,17 @@
}
static void
+help_no_snapshot_update_time(stralloc_t* out)
+{
+ PRINTF(
+ " Prevent the emulator from sending an unsolicited time update\n"
+ " in response to the first signal strength query after loadvm,\n"
+ " to avoid a sudden time jump that might upset testing. (Signal\n"
+ " strength is queried approximately every 15 seconds)\n\n"
+ );
+}
+
+static void
help_snapshot_list(stralloc_t* out)
{
PRINTF(
diff --git a/android/main-ui.c b/android/main-ui.c
index b0cd538..5f3b8e9 100644
--- a/android/main-ui.c
+++ b/android/main-ui.c
@@ -1647,13 +1647,13 @@
} else if (opts->no_snapshot_load || opts->no_snapshot_save) {
D("ignoring redundant option(s) '-no-snapshot-load' and/or '-no-snapshot-save' implied by '-no-snapshot'");
}
+ // TODO: Convey -no-snapshot-time-update to core subprocess (?)
} else if (opts->snapshot || opts->snapstorage) {
dwarning("option '-no-snapstorage' overrides '-snapshot' and '-snapstorage', "
"continuing with full boot, state snapshots are disabled");
} else if (opts->no_snapshot) {
D("ignoring redundant option '-no-snapshot' implied by '-no-snapstorage'");
}
-
if (opts->snapshot_list) {
snapshot_print_and_exit(opts->snapstorage);
}
diff --git a/android/main.c b/android/main.c
index 03bd472..0eebffb 100644
--- a/android/main.c
+++ b/android/main.c
@@ -1425,6 +1425,9 @@
} else if (opts->no_snapshot_load || opts->no_snapshot_save) {
D("ignoring redundant option(s) '-no-snapshot-load' and/or '-no-snapshot-save' implied by '-no-snapshot'");
}
+ if (opts->no_snapshot_update_time) {
+ android_snapshot_update_time = 0;
+ }
} else if (opts->snapshot || opts->snapstorage) {
dwarning("option '-no-snapstorage' overrides '-snapshot' and '-snapstorage', "
"continuing with full boot, state snapshots are disabled");
diff --git a/android/snapshot.h b/android/snapshot.h
index be03818..c0d5965 100644
--- a/android/snapshot.h
+++ b/android/snapshot.h
@@ -26,6 +26,10 @@
*/
void snapshot_print_and_exit( const char *snapstorage );
+
+extern int android_snapshot_update_time;
+extern int android_snapshot_update_time_request;
+
#endif
#endif /* SNAPSHOTS_H_ */