Fix adb shell in 7.0 tree

busybox sh does not seem to work properly in 7.0 trees so use
mksh for sh instead.

Change-Id: Ia33bc3894f929b1348c8714d4ddd00a2671c7e94
diff --git a/Android.mk b/Android.mk
index 8456e84..a73311e 100644
--- a/Android.mk
+++ b/Android.mk
@@ -478,6 +478,9 @@
 # Create busybox symlinks... gzip and gunzip are excluded because those need to link to pigz instead
 BUSYBOX_LINKS := $(shell cat external/busybox/busybox-full.links)
 exclude := tune2fs mke2fs mkdosfs mkfs.vfat gzip gunzip
+ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 24; echo $$?),0)
+    exclude += sh
+endif
 
 # Having /sbin/modprobe present on 32 bit devices with can cause a massive
 # performance problem if the kernel has CONFIG_MODULES=y
diff --git a/gui/Android.mk b/gui/Android.mk
index 3f97ca7..b514e5b 100644
--- a/gui/Android.mk
+++ b/gui/Android.mk
@@ -173,8 +173,10 @@
 	cp -fr $(TWRP_THEME_LOC)/* $(TARGET_RECOVERY_ROOT_OUT)$(TWRES_PATH)
 	mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/sbin/
 ifneq ($(TW_USE_TOOLBOX), true)
+ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 24; echo $$?),0)
 	ln -sf $(TWRP_SH_TARGET) $(TARGET_RECOVERY_ROOT_OUT)/sbin/sh
 endif
+endif
 	ln -sf /sbin/pigz $(TARGET_RECOVERY_ROOT_OUT)/sbin/gzip
 	ln -sf /sbin/unpigz $(TARGET_RECOVERY_ROOT_OUT)/sbin/gunzip
 
diff --git a/prebuilt/Android.mk b/prebuilt/Android.mk
index 169f87f..a81781b 100644
--- a/prebuilt/Android.mk
+++ b/prebuilt/Android.mk
@@ -17,6 +17,9 @@
 RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/bu
 ifneq ($(TW_USE_TOOLBOX), true)
 	RELINK_SOURCE_FILES += $(TARGET_OUT_OPTIONAL_EXECUTABLES)/busybox
+	ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 24; echo $$?),0)
+		RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/sh
+	endif
 else
 	RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/sh
 	RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libcrypto.so