Fix battery emulation.
When the AVD config.ini contained 'hw.battery=no', the emulator failed to
emulate a battery device. This had two effects:
- Displaying a red battery icon in the notification area in the emulated
system.
- Crashing the emulator when any 'power' command was typed in the console.
This patches fixes both issues. When hw.battery is set to 'no', the emulator
now indicates to the system that the device is connected to AC, and that the
battery is not present / dead.
Related bug http://b.android/com/65308
Change-Id: I84156a7d4582639569aad98e5a5e90e58087d93a
diff --git a/hw/android/android_mips.c b/hw/android/android_mips.c
index 16cde78..a7b7b20 100644
--- a/hw/android/android_mips.c
+++ b/hw/android/android_mips.c
@@ -221,8 +221,7 @@
}
goldfish_memlog_init(GOLDFISH_MEMLOG);
- if (android_hw->hw_battery)
- goldfish_battery_init();
+ goldfish_battery_init(android_hw->hw_battery);
goldfish_add_device_no_io(&event0_device);
events_dev_init(event0_device.base, goldfish_pic[event0_device.irq]);