From 873c3cb5688092d2822837511cfb2b330d265801 Mon Sep 17 00:00:00 2001 From: Vladimir Chtchetkine Date: Wed, 14 Mar 2012 12:46:51 -0700 Subject: Fix snapshot autoconfig This CL should fix external issue 26839, where system gets loaded from a snapshot even it is explicitly disabled in config.ini. The reason for that was a bug in autoconfig generator that didn't respect config.ini settings for snapshot. Change-Id: I617e9de7f7472f8d5b75d544f81c5b160f81c2f8 --- android/avd/info.c | 9 +++++++++ android/avd/info.h | 9 +++++++++ android/main.c | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/android/avd/info.c b/android/avd/info.c index 7fd8cc4..f850f5b 100644 --- a/android/avd/info.c +++ b/android/avd/info.c @@ -1207,3 +1207,12 @@ int avdInfo_getAdbdCommunicationMode( AvdInfo* i ) { return path_getAdbdCommunicationMode(i->androidOut); } + +int avdInfo_getSnapshotPresent(AvdInfo* i) +{ + if (i->configIni == NULL) { + return 0; + } else { + return iniFile_getBoolean(i->configIni, "snapshot.present", "no"); + } +} diff --git a/android/avd/info.h b/android/avd/info.h index 74a9b01..11f4897 100644 --- a/android/avd/info.h +++ b/android/avd/info.h @@ -252,6 +252,15 @@ const char* avdInfo_getCoreHwIniPath( AvdInfo* i ); */ int avdInfo_getAdbdCommunicationMode( AvdInfo* i ); +/* Returns config.ini snapshot presense status. + * This routine checks if snapshots are enabled in AVD config.ini file. + * Return: + * 1 - Snapshots are enabled in AVD config.ini file. + * 0 - Snapshots are disabled in AVD config.ini file, of config.ini file is not + * found. +*/ +int avdInfo_getSnapshotPresent(AvdInfo* i); + /* */ #endif /* ANDROID_AVD_INFO_H */ diff --git a/android/main.c b/android/main.c index 2723834..854356c 100644 --- a/android/main.c +++ b/android/main.c @@ -853,7 +853,7 @@ int main(int argc, char **argv) } else { - if (!opts->snapstorage) { + if (!opts->snapstorage && avdInfo_getSnapshotPresent(avd)) { opts->snapstorage = avdInfo_getSnapStoragePath(avd); if (opts->snapstorage != NULL) { D("autoconfig: -snapstorage %s", opts->snapstorage); -- cgit v1.1