Skip to content
This repository was archived by the owner on Nov 23, 2022. It is now read-only.

Commit

Permalink
DO NOT MERGE Android 8.0 stuff
Browse files Browse the repository at this point in the history
Change-Id: I8c8a9734adbf36c33463123844fa6e078934ae34
  • Loading branch information
Dees-Troy committed Aug 25, 2017
1 parent c0c5c3a commit 95e8007
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 11 deletions.
2 changes: 1 addition & 1 deletion crypto/ext4crypt/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions gpt/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 5 additions & 0 deletions libblkid/lib/fileutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions libpixelflinger/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions mtp/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 4 additions & 0 deletions mtp/MtpDataPacket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
18 changes: 18 additions & 0 deletions mtp/MtpDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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")) {
Expand All @@ -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);
Expand Down
14 changes: 7 additions & 7 deletions toolbox/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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 += \
Expand Down
25 changes: 22 additions & 3 deletions toybox/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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 \
Expand All @@ -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 += \
Expand All @@ -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 \
Expand Down

0 comments on commit 95e8007

Please sign in to comment.