summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2017-08-25 04:45:50 +0200
committerEthan Yonker <dees_troy@teamw.in>2017-08-25 04:45:50 +0200
commit95e8007578193422ef7fe2d098b80e8ba99fc48d (patch)
tree856f90d15b1f7c74d497503bd6ac6fd12b08b32d
parentMerge "Fix typos / inconsistencies in German language" into android-7.1 (diff)
downloadandroid_bootable_recovery-95e8007578193422ef7fe2d098b80e8ba99fc48d.tar
android_bootable_recovery-95e8007578193422ef7fe2d098b80e8ba99fc48d.tar.gz
android_bootable_recovery-95e8007578193422ef7fe2d098b80e8ba99fc48d.tar.bz2
android_bootable_recovery-95e8007578193422ef7fe2d098b80e8ba99fc48d.tar.lz
android_bootable_recovery-95e8007578193422ef7fe2d098b80e8ba99fc48d.tar.xz
android_bootable_recovery-95e8007578193422ef7fe2d098b80e8ba99fc48d.tar.zst
android_bootable_recovery-95e8007578193422ef7fe2d098b80e8ba99fc48d.zip
-rw-r--r--crypto/ext4crypt/Android.mk2
-rw-r--r--gpt/Android.mk2
-rw-r--r--libblkid/lib/fileutils.c5
-rw-r--r--libpixelflinger/Android.mk2
-rw-r--r--mtp/Android.mk3
-rw-r--r--mtp/MtpDataPacket.cpp4
-rw-r--r--mtp/MtpDevice.cpp18
-rw-r--r--toolbox/Android.mk14
-rw-r--r--toybox/Android.mk25
9 files changed, 64 insertions, 11 deletions
diff --git a/crypto/ext4crypt/Android.mk b/crypto/ext4crypt/Android.mk
index bcbcccfa2..8b1dcd4d8 100644
--- a/crypto/ext4crypt/Android.mk
+++ b/crypto/ext4crypt/Android.mk
@@ -8,7 +8,7 @@ LOCAL_CFLAGS :=
LOCAL_SRC_FILES := Decrypt.cpp Ext4Crypt.cpp Keymaster.cpp KeyStorage.cpp ScryptParameters.cpp Utils.cpp HashPassword.cpp ext4_crypt.cpp
LOCAL_SHARED_LIBRARIES := libselinux libc libc++ libext4_utils libsoftkeymaster libbase libcrypto libcutils libkeymaster_messages libhardware libprotobuf-cpp-lite
LOCAL_STATIC_LIBRARIES := libscrypt_static
-LOCAL_C_INCLUDES := system/extras/ext4_utils external/scrypt/lib/crypto system/security/keystore hardware/libhardware/include/hardware system/security/softkeymaster/include/keymaster system/keymaster/include
+LOCAL_C_INCLUDES := system/extras/ext4_utils system/extras/ext4_utils/include/ext4_utils external/scrypt/lib/crypto system/security/keystore hardware/libhardware/include/hardware system/security/softkeymaster/include/keymaster system/keymaster/include
ifneq ($(wildcard hardware/libhardware/include/hardware/keymaster0.h),)
LOCAL_CFLAGS += -DTW_CRYPTO_HAVE_KEYMASTERX
diff --git a/gpt/Android.mk b/gpt/Android.mk
index 7369339b3..3c2ec3b7a 100644
--- a/gpt/Android.mk
+++ b/gpt/Android.mk
@@ -3,7 +3,9 @@ LOCAL_PATH := $(call my-dir)
# Build libgpt_twrp library
include $(CLEAR_VARS)
+ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 26; echo $$?),0)
LOCAL_CLANG := false
+endif
LOCAL_MODULE := libgpt_twrp
LOCAL_MODULE_TAGS := optional
diff --git a/libblkid/lib/fileutils.c b/libblkid/lib/fileutils.c
index c6eb0d6c9..92a391d7e 100644
--- a/libblkid/lib/fileutils.c
+++ b/libblkid/lib/fileutils.c
@@ -9,6 +9,7 @@
#include <unistd.h>
#include <sys/time.h>
#include <sys/resource.h>
+#include <sys/limits.h>
#include "c.h"
#include "fileutils.h"
@@ -18,6 +19,10 @@
#define _PATH_TMP "/tmp/"
#endif
+#ifndef OPEN_MAX
+#define OPEN_MAX 256
+#endif
+
/* Create open temporary file in safe way. Please notice that the
* file permissions are -rw------- by default. */
int xmkstemp(char **tmpname, char *dir)
diff --git a/libpixelflinger/Android.mk b/libpixelflinger/Android.mk
index 044eea892..1cbde57f6 100644
--- a/libpixelflinger/Android.mk
+++ b/libpixelflinger/Android.mk
@@ -89,7 +89,9 @@ endif
#
include $(CLEAR_VARS)
+ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 26; echo $$?),0)
LOCAL_CLANG := false
+endif
LOCAL_MODULE:= libpixelflinger_twrp
LOCAL_SRC_FILES := $(PIXELFLINGER_SRC_FILES)
LOCAL_SRC_FILES_arm := $(PIXELFLINGER_SRC_FILES_arm)
diff --git a/mtp/Android.mk b/mtp/Android.mk
index c6a7fb7db..32518d3fa 100644
--- a/mtp/Android.mk
+++ b/mtp/Android.mk
@@ -40,6 +40,9 @@ LOCAL_SHARED_LIBRARIES += libz libc libusbhost libstdc++ libdl libcutils libutil
ifneq ($(TW_MTP_DEVICE),)
LOCAL_CFLAGS += -DUSB_MTP_DEVICE=$(TW_MTP_DEVICE)
endif
+ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 25; echo $$?),0)
+ LOCAL_CFLAGS += -DHAS_USBHOST_TIMEOUT
+endif
include $(BUILD_SHARED_LIBRARY)
diff --git a/mtp/MtpDataPacket.cpp b/mtp/MtpDataPacket.cpp
index 2c517252a..845db968e 100644
--- a/mtp/MtpDataPacket.cpp
+++ b/mtp/MtpDataPacket.cpp
@@ -427,7 +427,11 @@ int MtpDataPacket::readDataAsync(struct usb_request *req) {
// Wait for result of readDataAsync
int MtpDataPacket::readDataWait(struct usb_device *device) {
+#ifdef HAS_USBHOST_TIMEOUT
+ struct usb_request *req = usb_request_wait(device, 200);
+#else
struct usb_request *req = usb_request_wait(device);
+#endif
return (req ? req->actual_length : -1);
}
diff --git a/mtp/MtpDevice.cpp b/mtp/MtpDevice.cpp
index 53f8b2e9f..089fc2272 100644
--- a/mtp/MtpDevice.cpp
+++ b/mtp/MtpDevice.cpp
@@ -50,6 +50,10 @@ static bool isMtpDevice(uint16_t vendor, uint16_t product) {
}
#endif
+#ifdef HAS_USBHOST_TIMEOUT
+static const int USB_CONTROL_TRANSFER_TIMEOUT_MS = 200;
+#endif
+
MtpDevice* MtpDevice::open(const char* deviceName, int fd) {
struct usb_device *device = usb_device_new(deviceName, fd);
if (!device) {
@@ -70,15 +74,24 @@ MtpDevice* MtpDevice::open(const char* deviceName, int fd) {
interface->bInterfaceSubClass == 1 && // Still Image Capture
interface->bInterfaceProtocol == 1) // Picture Transfer Protocol (PIMA 15470)
{
+#ifdef HAS_USBHOST_TIMEOUT
+ char* manufacturerName = usb_device_get_manufacturer_name(device, USB_CONTROL_TRANSFER_TIMEOUT_MS);
+ char* productName = usb_device_get_product_name(device, USB_CONTROL_TRANSFER_TIMEOUT_MS);
+#else
char* manufacturerName = usb_device_get_manufacturer_name(device);
char* productName = usb_device_get_product_name(device);
+#endif
MTPD("Found camera: \"%s\" \"%s\"\n", manufacturerName, productName);
free(manufacturerName);
free(productName);
} else if (interface->bInterfaceClass == 0xFF &&
interface->bInterfaceSubClass == 0xFF &&
interface->bInterfaceProtocol == 0) {
+#ifdef HAS_USBHOST_TIMEOUT
+ char* interfaceName = usb_device_get_string(device, interface->iInterface, USB_CONTROL_TRANSFER_TIMEOUT_MS);
+#else
char* interfaceName = usb_device_get_string(device, interface->iInterface);
+#endif
if (!interfaceName) {
continue;
} else if (strcmp(interfaceName, "MTP")) {
@@ -88,8 +101,13 @@ MtpDevice* MtpDevice::open(const char* deviceName, int fd) {
free(interfaceName);
// Looks like an android style MTP device
+#ifdef HAS_USBHOST_TIMEOUT
+ char* manufacturerName = usb_device_get_manufacturer_name(device, USB_CONTROL_TRANSFER_TIMEOUT_MS);
+ char* productName = usb_device_get_product_name(device, USB_CONTROL_TRANSFER_TIMEOUT_MS);
+#else
char* manufacturerName = usb_device_get_manufacturer_name(device);
char* productName = usb_device_get_product_name(device);
+#endif
MTPI("Found MTP device: \"%s\" \"%s\"\n", manufacturerName, productName);
free(manufacturerName);
free(productName);
diff --git a/toolbox/Android.mk b/toolbox/Android.mk
index 45edd01c7..b8f4d2e74 100644
--- a/toolbox/Android.mk
+++ b/toolbox/Android.mk
@@ -47,14 +47,14 @@ ifeq ($(TW_USE_TOOLBOX), true)
$(if $(filter $(PLATFORM_SDK_VERSION), 23 24), du)
OUR_TOOLS := \
- iftop \
- ioctl \
- nandread \
+ $(if $(shell test $(PLATFORM_SDK_VERSION) -lt 26; iftop),) \
+ $(if $(shell test $(PLATFORM_SDK_VERSION) -lt 26; ioctl),) \
+ $(if $(shell test $(PLATFORM_SDK_VERSION) -lt 26; nandread),) \
newfs_msdos \
- prlimit \
- sendevent \
- start \
- stop \
+ $(if $(shell test $(PLATFORM_SDK_VERSION) -lt 26; prlimit),) \
+ $(if $(shell test $(PLATFORM_SDK_VERSION) -lt 26; sendevent),) \
+ $(if $(shell test $(PLATFORM_SDK_VERSION) -lt 26; start),) \
+ $(if $(shell test $(PLATFORM_SDK_VERSION) -lt 26; stop),) \
ifneq (,$(filter $(PLATFORM_SDK_VERSION), 23))
BSD_TOOLS += \
diff --git a/toybox/Android.mk b/toybox/Android.mk
index c4f0395f7..ca8fe46cc 100644
--- a/toybox/Android.mk
+++ b/toybox/Android.mk
@@ -69,7 +69,6 @@ LOCAL_SRC_FILES := \
toys/android/runcon.c \
toys/android/setenforce.c \
toys/android/setprop.c \
- toys/lsb/dmesg.c \
toys/lsb/hostname.c \
toys/lsb/killall.c \
toys/lsb/md5sum.c \
@@ -213,7 +212,6 @@ LOCAL_SRC_FILES += \
toys/other/xxd.c \
toys/pending/arp.c \
toys/pending/diff.c \
- toys/pending/ftpget.c \
toys/pending/lsof.c \
toys/pending/telnet.c \
toys/pending/test.c \
@@ -222,6 +220,17 @@ LOCAL_SRC_FILES += \
toys/posix/ps.c \
toys/posix/ulimit.c
+ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 25; echo $$?),0)
+# Android 8.0 had some tools in different paths
+LOCAL_SRC_FILES += \
+ toys/pending/dmesg.c \
+ toys/net/ftpget.c
+else
+LOCAL_SRC_FILES += \
+ toys/lsb/dmesg.c \
+ toys/pending/ftpget.c
+endif
+
# Account for master branch changes pulld into CM14.1
ifneq ($(CM_BUILD),)
LOCAL_SRC_FILES += \
@@ -242,12 +251,22 @@ LOCAL_SRC_FILES += \
toys/posix/file.c
else
LOCAL_SRC_FILES += \
+ toys/other/switch_root.c
+ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 25; echo $$?),0)
+# Android 8.0 had some tools in different paths
+LOCAL_SRC_FILES += \
+ toys/net/ifconfig.c \
+ toys/net/netcat.c \
+ toys/net/netstat.c \
+ toys/net/rfkill.c
+else
+LOCAL_SRC_FILES += \
toys/other/ifconfig.c \
toys/other/netcat.c \
toys/other/rfkill.c \
- toys/other/switch_root.c \
toys/pending/netstat.c
endif
+endif
else
LOCAL_SRC_FILES += \
toys/other/ifconfig.c \