Skip to content

Commit 95e8007

Browse files
committed
DO NOT MERGE Android 8.0 stuff
Change-Id: I8c8a9734adbf36c33463123844fa6e078934ae34
1 parent c0c5c3a commit 95e8007

File tree

9 files changed

+64
-11
lines changed

9 files changed

+64
-11
lines changed

crypto/ext4crypt/Android.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ LOCAL_CFLAGS :=
88
LOCAL_SRC_FILES := Decrypt.cpp Ext4Crypt.cpp Keymaster.cpp KeyStorage.cpp ScryptParameters.cpp Utils.cpp HashPassword.cpp ext4_crypt.cpp
99
LOCAL_SHARED_LIBRARIES := libselinux libc libc++ libext4_utils libsoftkeymaster libbase libcrypto libcutils libkeymaster_messages libhardware libprotobuf-cpp-lite
1010
LOCAL_STATIC_LIBRARIES := libscrypt_static
11-
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
11+
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
1212

1313
ifneq ($(wildcard hardware/libhardware/include/hardware/keymaster0.h),)
1414
LOCAL_CFLAGS += -DTW_CRYPTO_HAVE_KEYMASTERX

gpt/Android.mk

+2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ LOCAL_PATH := $(call my-dir)
33
# Build libgpt_twrp library
44

55
include $(CLEAR_VARS)
6+
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 26; echo $$?),0)
67
LOCAL_CLANG := false
8+
endif
79
LOCAL_MODULE := libgpt_twrp
810
LOCAL_MODULE_TAGS := optional
911

libblkid/lib/fileutils.c

+5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <unistd.h>
1010
#include <sys/time.h>
1111
#include <sys/resource.h>
12+
#include <sys/limits.h>
1213

1314
#include "c.h"
1415
#include "fileutils.h"
@@ -18,6 +19,10 @@
1819
#define _PATH_TMP "/tmp/"
1920
#endif
2021

22+
#ifndef OPEN_MAX
23+
#define OPEN_MAX 256
24+
#endif
25+
2126
/* Create open temporary file in safe way. Please notice that the
2227
* file permissions are -rw------- by default. */
2328
int xmkstemp(char **tmpname, char *dir)

libpixelflinger/Android.mk

+2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ endif
8989
#
9090

9191
include $(CLEAR_VARS)
92+
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 26; echo $$?),0)
9293
LOCAL_CLANG := false
94+
endif
9395
LOCAL_MODULE:= libpixelflinger_twrp
9496
LOCAL_SRC_FILES := $(PIXELFLINGER_SRC_FILES)
9597
LOCAL_SRC_FILES_arm := $(PIXELFLINGER_SRC_FILES_arm)

mtp/Android.mk

+3
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ LOCAL_SHARED_LIBRARIES += libz libc libusbhost libstdc++ libdl libcutils libutil
4040
ifneq ($(TW_MTP_DEVICE),)
4141
LOCAL_CFLAGS += -DUSB_MTP_DEVICE=$(TW_MTP_DEVICE)
4242
endif
43+
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 25; echo $$?),0)
44+
LOCAL_CFLAGS += -DHAS_USBHOST_TIMEOUT
45+
endif
4346

4447
include $(BUILD_SHARED_LIBRARY)
4548

mtp/MtpDataPacket.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,11 @@ int MtpDataPacket::readDataAsync(struct usb_request *req) {
427427

428428
// Wait for result of readDataAsync
429429
int MtpDataPacket::readDataWait(struct usb_device *device) {
430+
#ifdef HAS_USBHOST_TIMEOUT
431+
struct usb_request *req = usb_request_wait(device, 200);
432+
#else
430433
struct usb_request *req = usb_request_wait(device);
434+
#endif
431435
return (req ? req->actual_length : -1);
432436
}
433437

mtp/MtpDevice.cpp

+18
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ static bool isMtpDevice(uint16_t vendor, uint16_t product) {
5050
}
5151
#endif
5252

53+
#ifdef HAS_USBHOST_TIMEOUT
54+
static const int USB_CONTROL_TRANSFER_TIMEOUT_MS = 200;
55+
#endif
56+
5357
MtpDevice* MtpDevice::open(const char* deviceName, int fd) {
5458
struct usb_device *device = usb_device_new(deviceName, fd);
5559
if (!device) {
@@ -70,15 +74,24 @@ MtpDevice* MtpDevice::open(const char* deviceName, int fd) {
7074
interface->bInterfaceSubClass == 1 && // Still Image Capture
7175
interface->bInterfaceProtocol == 1) // Picture Transfer Protocol (PIMA 15470)
7276
{
77+
#ifdef HAS_USBHOST_TIMEOUT
78+
char* manufacturerName = usb_device_get_manufacturer_name(device, USB_CONTROL_TRANSFER_TIMEOUT_MS);
79+
char* productName = usb_device_get_product_name(device, USB_CONTROL_TRANSFER_TIMEOUT_MS);
80+
#else
7381
char* manufacturerName = usb_device_get_manufacturer_name(device);
7482
char* productName = usb_device_get_product_name(device);
83+
#endif
7584
MTPD("Found camera: \"%s\" \"%s\"\n", manufacturerName, productName);
7685
free(manufacturerName);
7786
free(productName);
7887
} else if (interface->bInterfaceClass == 0xFF &&
7988
interface->bInterfaceSubClass == 0xFF &&
8089
interface->bInterfaceProtocol == 0) {
90+
#ifdef HAS_USBHOST_TIMEOUT
91+
char* interfaceName = usb_device_get_string(device, interface->iInterface, USB_CONTROL_TRANSFER_TIMEOUT_MS);
92+
#else
8193
char* interfaceName = usb_device_get_string(device, interface->iInterface);
94+
#endif
8295
if (!interfaceName) {
8396
continue;
8497
} else if (strcmp(interfaceName, "MTP")) {
@@ -88,8 +101,13 @@ MtpDevice* MtpDevice::open(const char* deviceName, int fd) {
88101
free(interfaceName);
89102

90103
// Looks like an android style MTP device
104+
#ifdef HAS_USBHOST_TIMEOUT
105+
char* manufacturerName = usb_device_get_manufacturer_name(device, USB_CONTROL_TRANSFER_TIMEOUT_MS);
106+
char* productName = usb_device_get_product_name(device, USB_CONTROL_TRANSFER_TIMEOUT_MS);
107+
#else
91108
char* manufacturerName = usb_device_get_manufacturer_name(device);
92109
char* productName = usb_device_get_product_name(device);
110+
#endif
93111
MTPI("Found MTP device: \"%s\" \"%s\"\n", manufacturerName, productName);
94112
free(manufacturerName);
95113
free(productName);

toolbox/Android.mk

+7-7
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ ifeq ($(TW_USE_TOOLBOX), true)
4747
$(if $(filter $(PLATFORM_SDK_VERSION), 23 24), du)
4848

4949
OUR_TOOLS := \
50-
iftop \
51-
ioctl \
52-
nandread \
50+
$(if $(shell test $(PLATFORM_SDK_VERSION) -lt 26; iftop),) \
51+
$(if $(shell test $(PLATFORM_SDK_VERSION) -lt 26; ioctl),) \
52+
$(if $(shell test $(PLATFORM_SDK_VERSION) -lt 26; nandread),) \
5353
newfs_msdos \
54-
prlimit \
55-
sendevent \
56-
start \
57-
stop \
54+
$(if $(shell test $(PLATFORM_SDK_VERSION) -lt 26; prlimit),) \
55+
$(if $(shell test $(PLATFORM_SDK_VERSION) -lt 26; sendevent),) \
56+
$(if $(shell test $(PLATFORM_SDK_VERSION) -lt 26; start),) \
57+
$(if $(shell test $(PLATFORM_SDK_VERSION) -lt 26; stop),) \
5858

5959
ifneq (,$(filter $(PLATFORM_SDK_VERSION), 23))
6060
BSD_TOOLS += \

toybox/Android.mk

+22-3
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ LOCAL_SRC_FILES := \
6969
toys/android/runcon.c \
7070
toys/android/setenforce.c \
7171
toys/android/setprop.c \
72-
toys/lsb/dmesg.c \
7372
toys/lsb/hostname.c \
7473
toys/lsb/killall.c \
7574
toys/lsb/md5sum.c \
@@ -213,7 +212,6 @@ LOCAL_SRC_FILES += \
213212
toys/other/xxd.c \
214213
toys/pending/arp.c \
215214
toys/pending/diff.c \
216-
toys/pending/ftpget.c \
217215
toys/pending/lsof.c \
218216
toys/pending/telnet.c \
219217
toys/pending/test.c \
@@ -222,6 +220,17 @@ LOCAL_SRC_FILES += \
222220
toys/posix/ps.c \
223221
toys/posix/ulimit.c
224222

223+
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 25; echo $$?),0)
224+
# Android 8.0 had some tools in different paths
225+
LOCAL_SRC_FILES += \
226+
toys/pending/dmesg.c \
227+
toys/net/ftpget.c
228+
else
229+
LOCAL_SRC_FILES += \
230+
toys/lsb/dmesg.c \
231+
toys/pending/ftpget.c
232+
endif
233+
225234
# Account for master branch changes pulld into CM14.1
226235
ifneq ($(CM_BUILD),)
227236
LOCAL_SRC_FILES += \
@@ -241,13 +250,23 @@ LOCAL_SRC_FILES += \
241250
toys/pending/resize.c \
242251
toys/posix/file.c
243252
else
253+
LOCAL_SRC_FILES += \
254+
toys/other/switch_root.c
255+
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 25; echo $$?),0)
256+
# Android 8.0 had some tools in different paths
257+
LOCAL_SRC_FILES += \
258+
toys/net/ifconfig.c \
259+
toys/net/netcat.c \
260+
toys/net/netstat.c \
261+
toys/net/rfkill.c
262+
else
244263
LOCAL_SRC_FILES += \
245264
toys/other/ifconfig.c \
246265
toys/other/netcat.c \
247266
toys/other/rfkill.c \
248-
toys/other/switch_root.c \
249267
toys/pending/netstat.c
250268
endif
269+
endif
251270
else
252271
LOCAL_SRC_FILES += \
253272
toys/other/ifconfig.c \

0 commit comments

Comments
 (0)