aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--android/avd/hardware-properties.ini10
-rw-r--r--android/avd/hw-config-defs.h7
-rw-r--r--android/avd/info.c8
-rw-r--r--android/skin/file.c20
-rw-r--r--android/skin/file.h1
-rw-r--r--android/utils/ini.c9
-rw-r--r--android/utils/ini.h9
-rw-r--r--hw/goldfish_events_device.c5
8 files changed, 49 insertions, 20 deletions
diff --git a/android/avd/hardware-properties.ini b/android/avd/hardware-properties.ini
index 8e5cc41..6b106f4 100644
--- a/android/avd/hardware-properties.ini
+++ b/android/avd/hardware-properties.ini
@@ -51,6 +51,16 @@ default = yes
abstract = Keyboard support
description = Whether the device has a QWERTY keyboard.
+# Keyboard lid support
+# (I.e. can the qwerty keyboard be closed/hidden or opened/visible)
+# this will be ignored if hw.keyboard is false
+#
+name = hw.keyboard.lid
+type = boolean
+default = yes
+abstract = Keyboard lid support
+description = Whether the QWERTY keyboard can be opened/closed.
+
# DPad keys
name = hw.dPad
type = boolean
diff --git a/android/avd/hw-config-defs.h b/android/avd/hw-config-defs.h
index 9602a4a..0c87bdb 100644
--- a/android/avd/hw-config-defs.h
+++ b/android/avd/hw-config-defs.h
@@ -46,6 +46,13 @@ HWCFG_BOOL(
"Whether the device has a QWERTY keyboard.")
HWCFG_BOOL(
+ hw_keyboard_lid,
+ "hw.keyboard.lid",
+ "yes",
+ "Keyboard lid support",
+ "Whether the QWERTY keyboard can be opened/closed.")
+
+HWCFG_BOOL(
hw_dPad,
"hw.dPad",
"yes",
diff --git a/android/avd/info.c b/android/avd/info.c
index 3d91a30..058226c 100644
--- a/android/avd/info.c
+++ b/android/avd/info.c
@@ -260,7 +260,7 @@ _getSearchPaths( AvdInfo* i )
if (p >= end)
continue;
- path = iniFile_getString( i->configIni, temp );
+ path = iniFile_getString( i->configIni, temp, NULL );
if (path != NULL) {
DD(" found image search path: %s", path);
if (!path_is_absolute(path)) {
@@ -323,7 +323,7 @@ _getRootIni( AvdInfo* i )
static int
_getContentPath( AvdInfo* i )
{
- i->contentPath = iniFile_getString(i->rootIni, ROOT_PATH_KEY);
+ i->contentPath = iniFile_getString(i->rootIni, ROOT_PATH_KEY, NULL);
if (i->contentPath == NULL) {
derror("bad config: %s",
@@ -978,7 +978,7 @@ _getSkin( AvdInfo* i, AvdInfoParams* params )
if (params->skinName) {
skinName = ASTRDUP(params->skinName);
} else {
- skinName = iniFile_getString( i->configIni, SKIN_PATH );
+ skinName = iniFile_getString( i->configIni, SKIN_PATH, NULL );
explicitSkin = 0;
}
@@ -1081,7 +1081,7 @@ _getSDCardPath( AvdInfo* i, AvdInfoParams* params )
if (params->forcePaths[AVD_IMAGE_SDCARD] != NULL)
return;
- path = iniFile_getString(i->configIni, SDCARD_PATH);
+ path = iniFile_getString(i->configIni, SDCARD_PATH, NULL);
if (path == NULL)
return;
diff --git a/android/skin/file.c b/android/skin/file.c
index 5947ad9..dddc279 100644
--- a/android/skin/file.c
+++ b/android/skin/file.c
@@ -609,6 +609,7 @@ skin_file_load_from_v1( SkinFile* file, AConfig* aconfig, const char* basepat
*ptail = layout;
ptail = &layout->next;
}
+ file->version = 1;
return 0;
}
@@ -662,6 +663,7 @@ skin_file_load_from_v2( SkinFile* file, AConfig* aconfig, const char* basepat
if (file->layouts == NULL)
return -1;
+ file->version = 2;
return 0;
}
@@ -671,19 +673,29 @@ skin_file_create_from_aconfig( AConfig* aconfig, const char* basepath )
SkinFile* file;
ANEW0(file);
+
if ( aconfig_find(aconfig, "parts") != NULL) {
if (skin_file_load_from_v2( file, aconfig, basepath ) < 0) {
- skin_file_free( file );
- file = NULL;
+ goto BAD_FILE;
+ }
+ file->version = aconfig_int(aconfig, "version", 2);
+ /* The file version must be 1 or higher */
+ if (file->version <= 0) {
+ dprint( "## WARNING: invalid skin version: %d", file->version);
+ goto BAD_FILE;
}
}
else {
if (skin_file_load_from_v1( file, aconfig, basepath ) < 0) {
- skin_file_free( file );
- file = NULL;
+ goto BAD_FILE;
}
+ file->version = 1;
}
return file;
+
+BAD_FILE:
+ skin_file_free( file );
+ return NULL;
}
void
diff --git a/android/skin/file.h b/android/skin/file.h
index 4e3a8fc..21922e6 100644
--- a/android/skin/file.h
+++ b/android/skin/file.h
@@ -99,6 +99,7 @@ extern SkinDisplay* skin_layout_get_display( SkinLayout* layout );
extern SkinRotation skin_layout_get_dpad_rotation( SkinLayout* layout );
typedef struct SkinFile {
+ int version; /* 1, 2 or 3 */
SkinPart* parts;
SkinLayout* layouts;
int num_parts;
diff --git a/android/utils/ini.c b/android/utils/ini.c
index 1a1449c..a5914dd 100644
--- a/android/utils/ini.c
+++ b/android/utils/ini.c
@@ -326,12 +326,15 @@ iniFile_saveToFile( IniFile* f, const char* filepath )
}
char*
-iniFile_getString( IniFile* f, const char* key )
+iniFile_getString( IniFile* f, const char* key, const char* defaultValue )
{
const char* val = iniFile_getValue(f, key);
- if (!val)
- return NULL;
+ if (!val) {
+ if (!defaultValue)
+ return NULL;
+ val= defaultValue;
+ }
return ASTRDUP(val);
}
diff --git a/android/utils/ini.h b/android/utils/ini.h
index 77d760f..5730ee0 100644
--- a/android/utils/ini.h
+++ b/android/utils/ini.h
@@ -48,9 +48,10 @@ int iniFile_getPairCount( IniFile* f );
*/
const char* iniFile_getValue( IniFile* f, const char* key );
-/* returns a copy of the value of a given key, or NULL
+/* returns a copy of the value of a given key, or NULL if defaultValue is NULL.
+ * caller must free() it.
*/
-char* iniFile_getString( IniFile* f, const char* key );
+char* iniFile_getString( IniFile* f, const char* key, const char* defaultValue );
/* returns an integer value, or a default in case the value string is
* missing or badly formatted
@@ -67,10 +68,6 @@ int64_t iniFile_getInt64( IniFile* f, const char* key, int64_t defaultValue )
*/
double iniFile_getDouble( IniFile* f, const char* key, double defaultValue );
-/* returns a copy of a given key's value, if any, or NULL if it is missing
- * caller must call free() to release it */
-char* iniFile_getString( IniFile* f, const char* key );
-
/* parses a key value as a boolean. Accepted values are "1", "0", "yes", "YES",
* "no" and "NO". Returns either 1 or 0.
* note that the default value must be provided as a string too
diff --git a/hw/goldfish_events_device.c b/hw/goldfish_events_device.c
index f9775bf..340dc76 100644
--- a/hw/goldfish_events_device.c
+++ b/hw/goldfish_events_device.c
@@ -458,10 +458,9 @@ void events_dev_init(uint32_t base, qemu_irq irq)
* was closed or opened (done when we switch layouts through
* KP-7 or KP-9).
*
- * We only support this when there is a real keyboard, which
- * we assume can be hidden/revealed.
+ * We only support this when hw.keyboard.lid is true.
*/
- if (config->hw_keyboard) {
+ if (config->hw_keyboard && config->hw_keyboard_lid) {
events_set_bit(s, EV_SYN, EV_SW);
events_set_bit(s, EV_SW, 0);
}