merge in ics-release history after reset to master
diff --git a/Android.mk b/Android.mk
index 508eb4c..282862f 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,5 +1,3 @@
-ifneq ($(TARGET_SIMULATOR),true)
-
 LOCAL_PATH := $(call my-dir)
 include $(CLEAR_VARS)
 
@@ -74,5 +72,3 @@
 include $(commands_recovery_local_path)/updater/Android.mk
 include $(commands_recovery_local_path)/applypatch/Android.mk
 commands_recovery_local_path :=
-
-endif    # !TARGET_SIMULATOR
diff --git a/applypatch/Android.mk b/applypatch/Android.mk
index 2848b51..0e529d4 100644
--- a/applypatch/Android.mk
+++ b/applypatch/Android.mk
@@ -12,8 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-ifneq ($(TARGET_SIMULATOR),true)
-
 LOCAL_PATH := $(call my-dir)
 include $(CLEAR_VARS)
 
@@ -57,5 +55,3 @@
 LOCAL_STATIC_LIBRARIES += libz libbz
 
 include $(BUILD_HOST_EXECUTABLE)
-
-endif  # !TARGET_SIMULATOR
diff --git a/mtdutils/Android.mk b/mtdutils/Android.mk
index 4166536..ef417fa 100644
--- a/mtdutils/Android.mk
+++ b/mtdutils/Android.mk
@@ -1,5 +1,3 @@
-ifneq ($(TARGET_SIMULATOR),true)
-
 LOCAL_PATH := $(call my-dir)
 include $(CLEAR_VARS)
 
@@ -18,5 +16,3 @@
 LOCAL_STATIC_LIBRARIES := libmtdutils
 LOCAL_SHARED_LIBRARIES := libcutils libc
 include $(BUILD_EXECUTABLE)
-
-endif	# !TARGET_SIMULATOR
diff --git a/tools/ota/Android.mk b/tools/ota/Android.mk
index 0bde7ee..142c3b2 100644
--- a/tools/ota/Android.mk
+++ b/tools/ota/Android.mk
@@ -14,8 +14,6 @@
 
 LOCAL_PATH := $(call my-dir)
 
-ifneq ($(TARGET_SIMULATOR),true)
-
 include $(CLEAR_VARS)
 LOCAL_FORCE_STATIC_EXECUTABLE := true
 LOCAL_MODULE := add-property-tag
@@ -33,5 +31,3 @@
 LOCAL_SRC_FILES := check-lost+found.c
 LOCAL_STATIC_LIBRARIES := libcutils libc
 include $(BUILD_EXECUTABLE)
-
-endif  # !TARGET_SIMULATOR
diff --git a/ui.c b/ui.c
index 0744da4..1736319 100644
--- a/ui.c
+++ b/ui.c
@@ -592,17 +592,18 @@
 
 // Return true if USB is connected.
 static int usb_connected() {
-    int fd = open("/sys/class/switch/usb_connected/state", O_RDONLY);
+    int fd = open("/sys/class/android_usb/android0/state", O_RDONLY);
     if (fd < 0) {
-        printf("failed to open /sys/class/switch/usb_connected/state: %s\n",
+        printf("failed to open /sys/class/android_usb/android0/state: %s\n",
                strerror(errno));
         return 0;
     }
 
     char buf;
-    int connected = (read(fd, &buf, 1) == 1) && (buf == '1');
+    /* USB is connected if android_usb state is CONNECTED or CONFIGURED */
+    int connected = (read(fd, &buf, 1) == 1) && (buf == 'C');
     if (close(fd) < 0) {
-        printf("failed to close /sys/class/switch/usb_connected/state: %s\n",
+        printf("failed to close /sys/class/android_usb/android0/state: %s\n",
                strerror(errno));
     }
     return connected;