OSDN Git Service

Update init.goldfish.sh
authorLingfeng Yang <lfy@google.com>
Thu, 5 Jan 2017 19:47:23 +0000 (11:47 -0800)
committerLingfeng Yang <lfy@google.com>
Thu, 5 Jan 2017 19:47:23 +0000 (11:47 -0800)
This allows internet to work on emulator

Change-Id: I903f3b6fb709ad936145537f1e6615f7afcc8058

init.goldfish.sh

index 459ed3b..412cd50 100755 (executable)
@@ -4,6 +4,38 @@
 ifconfig eth0 10.0.2.15 netmask 255.255.255.0 up
 route add default gw 10.0.2.2 dev eth0
 
+# ro.kernel.android.qemud is normally set when we
+# want the RIL (radio interface layer) to talk to
+# the emulated modem through qemud.
+#
+# However, this will be undefined in two cases:
+#
+# - When we want the RIL to talk directly to a guest
+#   serial device that is connected to a host serial
+#   device by the emulator.
+#
+# - We don't want to use the RIL but the VM-based
+#   modem emulation that runs inside the guest system
+#   instead.
+#
+# The following detects the latter case and sets up the
+# system for it.
+#
+qemud=`getprop ro.kernel.android.qemud`
+case "$qemud" in
+    "")
+    radio_ril=`getprop ro.kernel.android.ril`
+    case "$radio_ril" in
+        "")
+        # no need for the radio interface daemon
+        # telephony is entirely emulated in Java
+        setprop ro.radio.noril yes
+        stop ril-daemon
+        ;;
+    esac
+    ;;
+esac
+
 # Setup additionnal DNS servers if needed
 num_dns=`getprop ro.kernel.ndns`
 case "$num_dns" in
@@ -34,3 +66,6 @@ case "$my_ip" in
     *) ifconfig eth1 "$my_ip" netmask 255.255.255.0 up
     ;;
 esac
+
+# take the wake lock
+echo "emulator_wake_lock" > /sys/power/wake_lock