Rework AvdInfo processing.
This patch changes the code in android/avd/info.c to prepare
for future patches that will move initialization disk images
to the core (including locking and creating temporary files).
+ Remove AvdInfo structure dependencies on many of the
functions, to make them more generic/usable.
+ Remove skin-related processing from avdInfo_new() and
avdInfo_newFromBuild().
+ Remove avdInfo_getSkinName() and avdInfo_getSkinDir(), and
replace them with a single avdInfo_getSkinInfo().
+ Rename 'qemu-hardware.ini' to 'hardware-qemu.ini' to follow
the same naming convention than the one used for disk
images (e.g. "userdata-qemu.img" and "system-qemu.img")
Change-Id: I32cb0a5850f8c0b9df93d2630552941fd2b461c1
diff --git a/android/main-common.c b/android/main-common.c
index 05108a1..3bca6c4 100644
--- a/android/main-common.c
+++ b/android/main-common.c
@@ -710,26 +710,9 @@
android_avdParams->forcePaths[imageType] = path;
}
-AvdInfo* createAVD(AndroidOptions* opts, int* inAndroidBuild)
+
+void sanitizeOptions( AndroidOptions* opts )
{
- AvdInfo* ret = NULL;
- char tmp[MAX_PATH];
- char* tmpend = tmp + sizeof(tmp);
- char* android_build_root = NULL;
- char* android_build_out = NULL;
-
- /* setup the virtual device parameters from our options
- */
- if (opts->no_cache) {
- android_avdParams->flags |= AVDINFO_NO_CACHE;
- }
- if (opts->wipe_data) {
- android_avdParams->flags |= AVDINFO_WIPE_DATA | AVDINFO_WIPE_CACHE;
- }
- if (opts->no_snapstorage) {
- android_avdParams->flags |= AVDINFO_NO_SNAPSHOTS;
- }
-
/* legacy support: we used to use -system <dir> and -image <file>
* instead of -sysdir <dir> and -system <file>, so handle this by checking
* whether the options point to directories or files.
@@ -762,6 +745,72 @@
opts->system = NULL;
}
+ if (opts->nojni) {
+ opts->no_jni = opts->nojni;
+ opts->nojni = 0;
+ }
+
+ if (opts->nocache) {
+ opts->no_cache = opts->nocache;
+ opts->nocache = 0;
+ }
+
+ if (opts->noaudio) {
+ opts->no_audio = opts->noaudio;
+ opts->noaudio = 0;
+ }
+
+ if (opts->noskin) {
+ opts->no_skin = opts->noskin;
+ opts->noskin = 0;
+ }
+
+ /* If -no-cache is used, ignore any -cache argument */
+ if (opts->no_cache) {
+ opts->cache = 0;
+ }
+
+ /* the purpose of -no-audio is to disable sound output from the emulator,
+ * not to disable Audio emulation. So simply force the 'none' backends */
+ if (opts->no_audio)
+ opts->audio = "none";
+
+ /* we don't accept -skindir without -skin now
+ * to simplify the autoconfig stuff with virtual devices
+ */
+ if (opts->no_skin) {
+ opts->skin = "320x480";
+ opts->skindir = NULL;
+ }
+
+ if (opts->skindir) {
+ if (!opts->skin) {
+ derror( "the -skindir <path> option requires a -skin <name> option");
+ exit(1);
+ }
+ }
+}
+
+AvdInfo* createAVD(AndroidOptions* opts, int* inAndroidBuild)
+{
+ AvdInfo* ret = NULL;
+ char tmp[MAX_PATH];
+ char* tmpend = tmp + sizeof(tmp);
+ char* android_build_root = NULL;
+ char* android_build_out = NULL;
+
+ /* setup the virtual device parameters from our options
+ */
+ if (opts->no_cache) {
+ android_avdParams->flags |= AVDINFO_NO_CACHE;
+ }
+ if (opts->wipe_data) {
+ android_avdParams->flags |= AVDINFO_WIPE_DATA | AVDINFO_WIPE_CACHE;
+ }
+ if (opts->no_snapstorage) {
+ android_avdParams->flags |= AVDINFO_NO_SNAPSHOTS;
+ }
+
/* If no AVD name was given, try to find the top of the
* Android build tree
*/
@@ -884,20 +933,6 @@
_forceAvdImagePath(AVD_IMAGE_SDCARD, opts->sdcard, "SD Card", 0);
_forceAvdImagePath(AVD_IMAGE_SNAPSHOTS, opts->snapstorage, "snapshots", 0);
- /* we don't accept -skindir without -skin now
- * to simplify the autoconfig stuff with virtual devices
- */
- if (opts->no_skin) {
- opts->skin = "320x480";
- opts->skindir = NULL;
- }
-
- if (opts->skindir) {
- if (!opts->skin) {
- derror( "the -skindir <path> option requires a -skin <name> option");
- exit(1);
- }
- }
android_avdParams->skinName = opts->skin;
android_avdParams->skinRootPath = opts->skindir;