Fix compatibility across the board

Change-Id: I6376920775ddabb4d4af505fffd86e404403a64a
diff --git a/minadbd/Android.mk b/minadbd/Android.mk
index 2bfe119..ef59945 100644
--- a/minadbd/Android.mk
+++ b/minadbd/Android.mk
@@ -7,6 +7,7 @@
     -Wno-unused-parameter \
     -Wno-missing-field-initializers \
     -DADB_HOST=0 \
+    -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
 
 include $(CLEAR_VARS)
 
diff --git a/minadbd/adb_main.cpp b/minadbd/adb_main.cpp
index 0694280..1db0d5f 100644
--- a/minadbd/adb_main.cpp
+++ b/minadbd/adb_main.cpp
@@ -36,7 +36,7 @@
     init_transport_registration();
     usb_init();
 
-    VLOG(ADB) << "Event loop starting";
+    //VLOG(ADB) << "Event loop starting";
     fdevent_loop();
 
     return 0;
diff --git a/minadbd/services.cpp b/minadbd/services.cpp
index 658a43f..753a14e 100644
--- a/minadbd/services.cpp
+++ b/minadbd/services.cpp
@@ -73,7 +73,12 @@
     sti->cookie = cookie;
     sti->fd = s[1];
 
+#if PLATFORM_SDK_VERSION == 23
+    adb_thread_t t;
+    if (adb_thread_create( &t, (adb_thread_func_t)service_bootstrap_func, sti)){
+#else
     if (!adb_thread_create(service_bootstrap_func, sti)) {
+#endif
         free(sti);
         adb_close(s[0]);
         adb_close(s[1]);
@@ -81,7 +86,7 @@
         return -1;
     }
 
-    VLOG(SERVICES) << "service thread started, " << s[0] << ":" << s[1];
+    //VLOG(SERVICES) << "service thread started, " << s[0] << ":" << s[1];
     return s[0];
 }
 
@@ -102,3 +107,10 @@
     }
     return ret;
 }
+
+#if PLATFORM_SDK_VERSION == 23
+int service_to_fd(const char* name) {
+    atransport transport;
+    return service_to_fd(name, &transport);
+}
+#endif