Snap for 4829593 from 317e1620eaf0fa4d64b9ac90a4bc5dfb4c0ae22b to pi-release

Change-Id: I8d95ae52e7c915ed454e43aae721307874cdaca6
diff --git a/init.ranchu-core.sh b/init.ranchu-core.sh
index 3358382..0b2e6fd 100755
--- a/init.ranchu-core.sh
+++ b/init.ranchu-core.sh
@@ -1,4 +1,14 @@
 #!/vendor/bin/sh
 
+#init cannot access ro.kernel.android.bootanim,
+#so do a translation into vendor.qemu space
+bootanim=`getprop ro.kernel.android.bootanim`
+case "$bootanim" in
+    "")
+    ;;
+    *) setprop vendor.qemu.android.bootanim 0
+    ;;
+esac
+
 # take the wake lock
 echo "emulator_wake_lock" > /sys/power/wake_lock
diff --git a/init.ranchu.rc b/init.ranchu.rc
index d069b34..2193c58 100644
--- a/init.ranchu.rc
+++ b/init.ranchu.rc
@@ -27,6 +27,8 @@
 
     setprop wifi.interface wlan0
 
+    start goldfish-logcat
+
 
 service ranchu-setup /vendor/bin/init.ranchu-core.sh
     class core
@@ -34,12 +36,15 @@
     group root
     oneshot
 
-on property:qemu.timezone=*
-    setprop persist.sys.timezone ${qemu.timezone}
+on property:vendor.qemu.timezone=*
+    setprop persist.sys.timezone ${vendor.qemu.timezone}
 
-on property:ro.kernel.android.bootanim=0
+on property:vendor.qemu.android.bootanim=0
     setprop debug.sf.nobootanimation 1
 
+on property:dev.bootcomplete=1
+    setprop vendor.qemu.dev.bootcomplete 1
+
 service ranchu-net /vendor/bin/init.ranchu-net.sh
     class late_start
     user root
@@ -83,9 +88,6 @@
     group root
     oneshot
 
-on property:qemu.logcat=start
-    start goldfish-logcat
-
 # -Q is a special logcat option that forces the
 # program to check wether it runs on the emulator
 # if it does, it redirects its output to the device
diff --git a/qemu-props/qemu-props.c b/qemu-props/qemu-props.c
index e54c2d5..e1b8ae7 100644
--- a/qemu-props/qemu-props.c
+++ b/qemu-props/qemu-props.c
@@ -27,7 +27,7 @@
 #define DEBUG  1
 
 #if DEBUG
-#  include <cutils/log.h>
+#  include <log/log.h>
 #  define  DD(...)    ALOGI(__VA_ARGS__)
 #else
 #  define  DD(...)    ((void)0)
@@ -88,6 +88,7 @@
         DD("receiving..");
         char* q;
         char  temp[BUFF_SIZE];
+        char  vendortemp[BUFF_SIZE];
         int   len = qemud_channel_recv(qemud_fd, temp, sizeof temp - 1);
 
         /* lone NUL-byte signals end of properties */
@@ -106,9 +107,25 @@
         }
         *q++ = '\0';
 
-        if (property_set(temp, q) < 0) {
-            DD("could not set property '%s' to '%s'", temp, q);
+        char* final_prop_name = NULL;
+        if (strcmp(temp, "qemu.sf.lcd.density") == 0 ) {
+            final_prop_name = temp;
+        } else if (strcmp(temp, "qemu.hw.mainkeys") == 0 ) {
+            final_prop_name = temp;
+        } else if (strcmp(temp, "qemu.cmdline") == 0 ) {
+            final_prop_name = temp;
+        } else if (strcmp(temp, "dalvik.vm.heapsize") == 0 ) {
+            continue; /* cannot set it here */
+        } else if (strcmp(temp, "ro.opengles.version") == 0 ) {
+            continue; /* cannot set it here */
         } else {
+            snprintf(vendortemp, sizeof(vendortemp), "vendor.%s", temp);
+            final_prop_name = vendortemp;
+        }
+        if (property_set(temp, q) < 0) {
+            ALOGW("could not set property '%s' to '%s'", final_prop_name, q);
+        } else {
+            ALOGI("successfully set property '%s' to '%s'", final_prop_name, q);
             count += 1;
         }
     }
@@ -116,20 +133,15 @@
     char temp[BUFF_SIZE];
     for (;;) {
         usleep(5000000); /* 5 seconds */
-        property_get("sys.boot_completed", temp, "");
+        property_get("vendor.qemu.dev.bootcomplete", temp, "");
         int is_boot_completed = (strncmp(temp, "1", 1) == 0) ? 1 : 0;
         if (is_boot_completed) {
+            ALOGI("tell the host boot completed");
             notifyHostBootComplete();
             break;
         }
     }
 
-    /* HACK start adbd periodically every minute, if adbd is already running, this is a no-op */
-    for(;;) {
-        usleep(60000000); /* 1 minute */
-        property_set("qemu.adbd", "start");
-    }
-
     /* finally, close the channel and exit */
     if (s_QemuMiscPipe >= 0) {
         close(s_QemuMiscPipe);
@@ -153,7 +165,7 @@
     WriteFully(s_QemuMiscPipe, &pipe_command_length, sizeof(pipe_command_length));
     WriteFully(s_QemuMiscPipe, set, pipe_command_length);
     ReadFully(s_QemuMiscPipe, &pipe_command_length, sizeof(pipe_command_length));
-    if (pipe_command_length > sizeof(set) || pipe_command_length <= 0)
+    if (pipe_command_length > (int)(sizeof(set)) || pipe_command_length <= 0)
         return;
     ReadFully(s_QemuMiscPipe, set, pipe_command_length);
 }