goldfish: allow emulator to suspend

Previously we install an emulator_wake_lock to prevent
it from being suspended, and that is the right
behavior for most cases.

However, sometime we do want the emualtor to suspend
(such as doing sensor verifier tests).

This cl will skip installing the emualtor_wake_lock
if -qemu -append qemu.allowsuspend=1 is given.

The default behavior is unchanged.

BUG: 112074471
Change-Id: I5bcdd4d4394f6c15fd15c78603c0a52c0d46c777
diff --git a/init.ranchu-core.sh b/init.ranchu-core.sh
index 0b2e6fd..e6c9de4 100755
--- a/init.ranchu-core.sh
+++ b/init.ranchu-core.sh
@@ -11,4 +11,12 @@
 esac
 
 # take the wake lock
-echo "emulator_wake_lock" > /sys/power/wake_lock
+allowsuspend=`getprop ro.kernel.qemu.allowsuspend`
+case "$allowsuspend" in
+    "") echo "emulator_wake_lock" > /sys/power/wake_lock
+    ;;
+    1) echo "emulator_wake_lock" > /sys/power/wake_unlock
+    ;;
+    *) echo "emulator_wake_lock" > /sys/power/wake_lock
+    ;;
+esac