aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.android10
-rw-r--r--android/main.c1
-rw-r--r--android/qemulator.c9
-rw-r--r--android/ui-core-protocol.c11
-rw-r--r--android/ui-core-protocol.h13
5 files changed, 31 insertions, 13 deletions
diff --git a/Makefile.android b/Makefile.android
index 016126a..1ed3423 100644
--- a/Makefile.android
+++ b/Makefile.android
@@ -605,6 +605,9 @@ endif
CORE_MISC_SOURCES = android/boot-properties.c \
android/hw-kmsg.c \
android/hw-lcd.c \
+ android/gps.c \
+ android/hw-events.c \
+ android/hw-control.c \
ifeq ($(HOST_ARCH),x86)
CORE_MISC_SOURCES += i386-dis.c
@@ -640,6 +643,7 @@ UI_SOURCES = android/user-config.c \
android/resource.c \
android/qemulator.c \
android/keycode.c \
+ android/help.c \
##############################################################################
# lists of source files used by both, emulator UI and emulator core
@@ -647,6 +651,7 @@ UI_SOURCES = android/user-config.c \
UI_AND_CORE_SOURCES = android/keycode-array.c \
android/charmap.c \
+ android/hw-qemud.c \
##############################################################################
# now build the emulator itself
@@ -753,11 +758,6 @@ VL_SOURCES := vl-android.c osdep.c cutils.c \
android/cmdline-option.c \
android/config.c \
android/console.c \
- android/gps.c \
- android/help.c \
- android/hw-control.c \
- android/hw-events.c \
- android/hw-qemud.c \
android/hw-sensors.c \
android/main.c \
android/utils/bufprint.c \
diff --git a/android/main.c b/android/main.c
index 3da0602..b18e494 100644
--- a/android/main.c
+++ b/android/main.c
@@ -52,7 +52,6 @@
#include "android/hw-qemud.h"
#include "android/hw-kmsg.h"
#include "android/hw-lcd.h"
-#include "android/hw-control.h"
#include "android/hw-sensors.h"
#include "android/boot-properties.h"
#include "android/user-config.h"
diff --git a/android/qemulator.c b/android/qemulator.c
index 15cd668..06b07f7 100644
--- a/android/qemulator.c
+++ b/android/qemulator.c
@@ -10,7 +10,6 @@
** GNU General Public License for more details.
*/
-#include "android/hw-control.h"
#include "android/utils/debug.h"
#include "android/utils/bufprint.h"
#include "android/globals.h"
@@ -83,12 +82,8 @@ qemulator_setup( QEmulator* emulator )
}
/* initialize hardware control support */
- {
- AndroidHwControlFuncs funcs;
-
- funcs.light_brightness = qemulator_light_brightness;
- android_hw_control_init( emulator, &funcs );
- }
+ android_core_set_brightness_change_callback(qemulator_light_brightness,
+ emulator);
}
static void
diff --git a/android/ui-core-protocol.c b/android/ui-core-protocol.c
index ec49b7e..e61cd86 100644
--- a/android/ui-core-protocol.c
+++ b/android/ui-core-protocol.c
@@ -20,6 +20,7 @@
*/
#include "android/globals.h"
+#include "android/hw-control.h"
#include "android/ui-core-protocol.h"
int
@@ -27,3 +28,13 @@ android_core_get_hw_lcd_density(void)
{
return android_hw->hw_lcd_density;
}
+
+void
+android_core_set_brightness_change_callback(AndroidHwLightBrightnessCallback callback,
+ void* opaque)
+{
+ AndroidHwControlFuncs funcs;
+
+ funcs.light_brightness = callback;
+ android_hw_control_init( opaque, &funcs );
+}
diff --git a/android/ui-core-protocol.h b/android/ui-core-protocol.h
index e8f6489..e454b14 100644
--- a/android/ui-core-protocol.h
+++ b/android/ui-core-protocol.h
@@ -24,4 +24,17 @@
/* Gets LCD density property from the core properties. */
int android_core_get_hw_lcd_density(void);
+/* This is temporary redeclaration for AndroidHwLightBrightnessFunc declared
+ * in android/hw-control.h We redeclare it here in order to keep type
+ * consistency between android_core_set_brightness_change_callback and
+ * light_brightness field of AndroidHwControlFuncs structure.
+ */
+typedef void (*AndroidHwLightBrightnessCallback)( void* opaque,
+ const char* light,
+ int brightness );
+
+/* Registers a UI callback to be called when brightness is changed by the core. */
+void android_core_set_brightness_change_callback(AndroidHwLightBrightnessCallback callback,
+ void* opaque);
+
#endif // QEMU_ANDROID_UI_CORE_PROTOCOL_H