Commit 95e80075 authored by Ethan Yonker's avatar Ethan Yonker

DO NOT MERGE Android 8.0 stuff

Change-Id: I8c8a9734adbf36c33463123844fa6e078934ae34
parent c0c5c3a1
......@@ -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
......
......@@ -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
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -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 += \
......
......@@ -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 += \
......@@ -241,13 +250,23 @@ LOCAL_SRC_FILES += \
toys/pending/resize.c \
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 \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment