diff options
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/androidfw/ResourceTypes.cpp | 10 | ||||
| -rw-r--r-- | libs/androidfw/include/androidfw/ResourceTypes.h | 1 | ||||
| -rw-r--r-- | libs/hwui/TessellationCache.cpp | 4 | ||||
| -rw-r--r-- | libs/usb/Android.bp | 1 | ||||
| -rw-r--r-- | libs/usb/tests/AccessoryChat/Android.bp | 1 | ||||
| -rw-r--r-- | libs/usb/tests/AccessoryChat/accessorychat/Android.bp | 30 | ||||
| -rw-r--r-- | libs/usb/tests/AccessoryChat/accessorychat/Android.mk | 35 | ||||
| -rw-r--r-- | libs/usb/tests/accessorytest/Android.bp | 28 | ||||
| -rw-r--r-- | libs/usb/tests/accessorytest/Android.mk | 25 | ||||
| -rw-r--r-- | libs/usb/tests/accessorytest/accessory.h | 2 | ||||
| -rw-r--r-- | libs/usb/tests/accessorytest/hid.c | 2 | ||||
| -rw-r--r-- | libs/usb/tests/accessorytest/usb.c | 2 |
12 files changed, 72 insertions, 69 deletions
diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp index bab8883ef64f..7a0ef2b770ce 100644 --- a/libs/androidfw/ResourceTypes.cpp +++ b/libs/androidfw/ResourceTypes.cpp @@ -59,7 +59,6 @@ namespace android { #endif #define IDMAP_MAGIC 0x504D4449 -#define IDMAP_CURRENT_VERSION 0x00000001 #define APP_PACKAGE_ID 0x7f #define SYS_PACKAGE_ID 0x01 @@ -246,11 +245,11 @@ static bool assertIdmapHeader(const void* idmap, size_t size) { } const uint32_t version = htodl(*(reinterpret_cast<const uint32_t*>(idmap) + 1)); - if (version != IDMAP_CURRENT_VERSION) { + if (version != ResTable::IDMAP_CURRENT_VERSION) { // We are strict about versions because files with this format are // auto-generated and don't need backwards compatibility. ALOGW("idmap: version mismatch in header (is 0x%08x, expected 0x%08x)", - version, IDMAP_CURRENT_VERSION); + version, ResTable::IDMAP_CURRENT_VERSION); return false; } return true; @@ -3313,13 +3312,14 @@ struct ResTable::PackageGroup clearBagCache(); const size_t numTypes = types.size(); for (size_t i = 0; i < numTypes; i++) { - const TypeList& typeList = types[i]; + TypeList& typeList = types.editItemAt(i); const size_t numInnerTypes = typeList.size(); for (size_t j = 0; j < numInnerTypes; j++) { if (typeList[j]->package->owner == owner) { delete typeList[j]; } } + typeList.clear(); } const size_t N = packages.size(); @@ -6854,7 +6854,7 @@ status_t ResTable::createIdmap(const ResTable& overlay, uint32_t* data = (uint32_t*)*outData; *data++ = htodl(IDMAP_MAGIC); - *data++ = htodl(IDMAP_CURRENT_VERSION); + *data++ = htodl(ResTable::IDMAP_CURRENT_VERSION); *data++ = htodl(targetCrc); *data++ = htodl(overlayCrc); const char* paths[] = { targetPath, overlayPath }; diff --git a/libs/androidfw/include/androidfw/ResourceTypes.h b/libs/androidfw/include/androidfw/ResourceTypes.h index 7a6e37d41b7c..66c66c251d9b 100644 --- a/libs/androidfw/include/androidfw/ResourceTypes.h +++ b/libs/androidfw/include/androidfw/ResourceTypes.h @@ -1933,6 +1933,7 @@ public: void** outData, size_t* outSize) const; static const size_t IDMAP_HEADER_SIZE_BYTES = 4 * sizeof(uint32_t) + 2 * 256; + static const uint32_t IDMAP_CURRENT_VERSION = 0x00000001; // Retrieve idmap meta-data. // diff --git a/libs/hwui/TessellationCache.cpp b/libs/hwui/TessellationCache.cpp index 91e7ac39af90..9adf0538203e 100644 --- a/libs/hwui/TessellationCache.cpp +++ b/libs/hwui/TessellationCache.cpp @@ -400,7 +400,9 @@ TessellationCache::Buffer* TessellationCache::getOrCreateBuffer( mProcessor = new TessellationProcessor(Caches::getInstance()); } mProcessor->add(task); - mCache.put(entry, buffer); + bool inserted = mCache.put(entry, buffer); + // Note to the static analyzer that this insert should always succeed. + LOG_ALWAYS_FATAL_IF(!inserted, "buffers shouldn't spontaneously appear in the cache"); } return buffer; } diff --git a/libs/usb/Android.bp b/libs/usb/Android.bp new file mode 100644 index 000000000000..b8f29043e597 --- /dev/null +++ b/libs/usb/Android.bp @@ -0,0 +1 @@ +subdirs = ["tests/*"] diff --git a/libs/usb/tests/AccessoryChat/Android.bp b/libs/usb/tests/AccessoryChat/Android.bp new file mode 100644 index 000000000000..4af6274b7ece --- /dev/null +++ b/libs/usb/tests/AccessoryChat/Android.bp @@ -0,0 +1 @@ +subdirs = ["accessorychat"] diff --git a/libs/usb/tests/AccessoryChat/accessorychat/Android.bp b/libs/usb/tests/AccessoryChat/accessorychat/Android.bp new file mode 100644 index 000000000000..5613745e966b --- /dev/null +++ b/libs/usb/tests/AccessoryChat/accessorychat/Android.bp @@ -0,0 +1,30 @@ +cc_binary { + name: "accessorychat", + host_supported: true, + + srcs: ["accessorychat.c"], + cflags: [ + "-Werror", + "-Wno-unused-parameter", + ], + + target: { + android: { + shared_libs: [ + "libusbhost", + "libcutils", + ], + }, + host: { + static_libs: [ + "libusbhost", + "libcutils", + ], + + cflags: ["-O0"], + }, + darwin: { + enabled: false, + }, + }, +} diff --git a/libs/usb/tests/AccessoryChat/accessorychat/Android.mk b/libs/usb/tests/AccessoryChat/accessorychat/Android.mk deleted file mode 100644 index 51f2111f1e0b..000000000000 --- a/libs/usb/tests/AccessoryChat/accessorychat/Android.mk +++ /dev/null @@ -1,35 +0,0 @@ -LOCAL_PATH:= $(call my-dir) - -# Build for Linux (desktop) host -ifeq ($(HOST_OS),linux) - -include $(CLEAR_VARS) -LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk - -LOCAL_MODULE_TAGS := optional - -LOCAL_SRC_FILES := accessorychat.c - -LOCAL_MODULE := accessorychat - -LOCAL_STATIC_LIBRARIES := libusbhost libcutils -LOCAL_LDLIBS += -lpthread -LOCAL_CFLAGS := -g -O0 - -include $(BUILD_HOST_EXECUTABLE) - -endif - -# Build for device -include $(CLEAR_VARS) -LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk - -LOCAL_MODULE_TAGS := optional - -LOCAL_SRC_FILES := accessorychat.c - -LOCAL_MODULE := accessorychat - -LOCAL_SHARED_LIBRARIES := libusbhost libcutils - -include $(BUILD_EXECUTABLE) diff --git a/libs/usb/tests/accessorytest/Android.bp b/libs/usb/tests/accessorytest/Android.bp new file mode 100644 index 000000000000..c6340e32e60c --- /dev/null +++ b/libs/usb/tests/accessorytest/Android.bp @@ -0,0 +1,28 @@ +cc_binary_host { + name: "accessorytest", + + srcs: [ + "accessory.c", + "audio.c", + "hid.c", + "usb.c", + ], + + static_libs: [ + "libusbhost", + "libcutils", + "libtinyalsa", + ], + cflags: [ + "-O0", + "-Wno-unused-parameter", + "-Werror", + ], + + target: { + darwin: { + // Build for Linux host only + enabled: false, + }, + }, +} diff --git a/libs/usb/tests/accessorytest/Android.mk b/libs/usb/tests/accessorytest/Android.mk deleted file mode 100644 index 6d9a9460c675..000000000000 --- a/libs/usb/tests/accessorytest/Android.mk +++ /dev/null @@ -1,25 +0,0 @@ -LOCAL_PATH:= $(call my-dir) - -# Build for Linux host only -ifeq ($(HOST_OS),linux) - -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := optional - -LOCAL_SRC_FILES := accessory.c \ - audio.c \ - hid.c \ - usb.c - -LOCAL_C_INCLUDES += external/tinyalsa/include - -LOCAL_MODULE := accessorytest - -LOCAL_STATIC_LIBRARIES := libusbhost libcutils libtinyalsa -LOCAL_LDLIBS += -lpthread -LOCAL_CFLAGS := -g -O0 - -include $(BUILD_HOST_EXECUTABLE) - -endif diff --git a/libs/usb/tests/accessorytest/accessory.h b/libs/usb/tests/accessorytest/accessory.h index 55c4550f79e0..e86986eb403f 100644 --- a/libs/usb/tests/accessorytest/accessory.h +++ b/libs/usb/tests/accessorytest/accessory.h @@ -19,7 +19,7 @@ int init_audio(unsigned int ic, unsigned int id, unsigned int oc, unsigned int od); void init_hid(); -void usb_run(int enable_accessory); +void usb_run(uintptr_t enable_accessory); struct usb_device* usb_wait_for_device(); diff --git a/libs/usb/tests/accessorytest/hid.c b/libs/usb/tests/accessorytest/hid.c index b70d678543ca..283755dbf215 100644 --- a/libs/usb/tests/accessorytest/hid.c +++ b/libs/usb/tests/accessorytest/hid.c @@ -139,7 +139,7 @@ static void open_hid(const char* name) fprintf(stderr, "opened /dev/%s\n", name); pthread_t th; - pthread_create(&th, NULL, hid_thread, (void *)fd); + pthread_create(&th, NULL, hid_thread, (void *)(uintptr_t)fd); } static void* inotify_thread(void* arg) diff --git a/libs/usb/tests/accessorytest/usb.c b/libs/usb/tests/accessorytest/usb.c index ac72b35b908e..1a161adf8ac2 100644 --- a/libs/usb/tests/accessorytest/usb.c +++ b/libs/usb/tests/accessorytest/usb.c @@ -219,7 +219,7 @@ struct usb_device* usb_wait_for_device() { return device; } -void usb_run(int enable_accessory) { +void usb_run(uintptr_t enable_accessory) { struct usb_host_context* context = usb_host_init(); usb_host_run(context, usb_device_added, usb_device_removed, NULL, (void *)enable_accessory); |