summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/androidfw/Android.mk15
-rw-r--r--libs/androidfw/Asset.cpp10
-rw-r--r--libs/androidfw/AssetManager.cpp30
-rw-r--r--libs/androidfw/BackupData.cpp36
-rw-r--r--libs/androidfw/BackupHelpers.cpp53
-rw-r--r--libs/androidfw/ObbFile.cpp8
-rw-r--r--libs/androidfw/ResourceTypes.cpp538
-rw-r--r--libs/androidfw/StreamingZipInflater.cpp6
-rw-r--r--libs/androidfw/ZipFileRO.cpp21
-rw-r--r--libs/androidfw/tests/Android.mk13
-rw-r--r--libs/common_time/Android.mk2
-rw-r--r--libs/common_time/clock_recovery.cpp4
-rw-r--r--libs/common_time/clock_recovery.h1
-rw-r--r--libs/common_time/common_clock.cpp3
-rw-r--r--libs/common_time/common_clock_service.cpp10
-rw-r--r--libs/common_time/common_time_server.cpp6
-rw-r--r--libs/common_time/common_time_server_api.cpp22
-rw-r--r--libs/common_time/main.cpp2
-rw-r--r--libs/hwui/AmbientShadow.cpp4
-rw-r--r--libs/hwui/Android.mk191
-rw-r--r--libs/hwui/AnimationContext.cpp2
-rw-r--r--libs/hwui/Animator.cpp8
-rw-r--r--libs/hwui/Caches.h10
-rw-r--r--libs/hwui/DeferredDisplayList.cpp16
-rw-r--r--libs/hwui/DeferredDisplayList.h2
-rw-r--r--libs/hwui/DisplayList.h5
-rw-r--r--libs/hwui/DisplayListLogBuffer.cpp2
-rw-r--r--libs/hwui/DisplayListOp.h234
-rw-r--r--libs/hwui/DisplayListRenderer.cpp11
-rw-r--r--libs/hwui/FontRenderer.cpp4
-rw-r--r--libs/hwui/GammaFontRenderer.h16
-rw-r--r--libs/hwui/Interpolator.cpp4
-rw-r--r--libs/hwui/Layer.h2
-rw-r--r--libs/hwui/LayerCache.cpp24
-rw-r--r--libs/hwui/LayerCache.h8
-rwxr-xr-xlibs/hwui/OpenGLRenderer.cpp29
-rw-r--r--libs/hwui/PathCache.cpp4
-rw-r--r--libs/hwui/PathTessellator.cpp8
-rw-r--r--libs/hwui/Program.h2
-rw-r--r--libs/hwui/ProgramCache.cpp2
-rw-r--r--libs/hwui/Properties.h2
-rw-r--r--libs/hwui/RenderNode.cpp10
-rw-r--r--libs/hwui/ShadowTessellator.cpp1
-rw-r--r--libs/hwui/SkiaShader.cpp4
-rw-r--r--libs/hwui/SkiaShader.h9
-rw-r--r--libs/hwui/SpotShadow.cpp10
-rw-r--r--libs/hwui/StatefulBaseRenderer.h3
-rw-r--r--libs/hwui/TessellationCache.cpp2
-rw-r--r--libs/hwui/TessellationCache.h3
-rw-r--r--libs/hwui/TextDropShadowCache.cpp3
-rw-r--r--libs/hwui/font/Font.cpp18
-rw-r--r--libs/hwui/font/FontUtil.h11
-rw-r--r--libs/hwui/renderthread/CanvasContext.cpp6
-rw-r--r--libs/hwui/renderthread/RenderProxy.cpp6
-rw-r--r--libs/hwui/renderthread/RenderTask.cpp4
-rw-r--r--libs/hwui/renderthread/RenderThread.cpp2
-rw-r--r--libs/hwui/tests/main.cpp4
-rw-r--r--libs/input/Android.mk6
-rw-r--r--libs/input/PointerController.cpp3
-rw-r--r--libs/input/SpriteController.cpp4
-rw-r--r--libs/storage/Android.mk2
-rw-r--r--libs/storage/IMountService.cpp27
-rw-r--r--libs/storage/IMountServiceListener.cpp4
-rw-r--r--libs/storage/IMountShutdownObserver.cpp4
-rw-r--r--libs/storage/IObbActionListener.cpp9
-rw-r--r--libs/usb/tests/AccessoryChat/accessorychat/Android.mk2
66 files changed, 869 insertions, 658 deletions
diff --git a/libs/androidfw/Android.mk b/libs/androidfw/Android.mk
index 20d5470..461160a 100644
--- a/libs/androidfw/Android.mk
+++ b/libs/androidfw/Android.mk
@@ -40,10 +40,12 @@ hostSources := $(commonSources)
# For the host
# =====================================================
include $(CLEAR_VARS)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_MODULE:= libandroidfw
LOCAL_MODULE_TAGS := optional
LOCAL_CFLAGS += -DSTATIC_ANDROIDFW_FOR_TOOLS
+LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
LOCAL_SRC_FILES:= $(hostSources)
LOCAL_C_INCLUDES := external/zlib
@@ -54,6 +56,7 @@ include $(BUILD_HOST_STATIC_LIBRARY)
# =====================================================
include $(CLEAR_VARS)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_MODULE:= libandroidfw
LOCAL_MODULE_TAGS := optional
@@ -63,11 +66,13 @@ LOCAL_C_INCLUDES := \
system/core/include
LOCAL_STATIC_LIBRARIES := libziparchive
LOCAL_SHARED_LIBRARIES := \
- libbinder \
- liblog \
- libcutils \
- libutils \
- libz
+ libbinder \
+ liblog \
+ libcutils \
+ libutils \
+ libz
+
+LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
include $(BUILD_SHARED_LIBRARY)
diff --git a/libs/androidfw/Asset.cpp b/libs/androidfw/Asset.cpp
index 589211f..4b3382e 100644
--- a/libs/androidfw/Asset.cpp
+++ b/libs/androidfw/Asset.cpp
@@ -45,6 +45,8 @@ using namespace android;
# define O_BINARY 0
#endif
+static const bool kIsDebug = false;
+
static Mutex gAssetLock;
static int32_t gCount = 0;
static Asset* gHead = NULL;
@@ -89,7 +91,9 @@ Asset::Asset(void)
gTail->mNext = this;
gTail = this;
}
- //ALOGI("Creating Asset %p #%d\n", this, gCount);
+ if (kIsDebug) {
+ ALOGI("Creating Asset %p #%d\n", this, gCount);
+ }
}
Asset::~Asset(void)
@@ -109,7 +113,9 @@ Asset::~Asset(void)
mPrev->mNext = mNext;
}
mNext = mPrev = NULL;
- //ALOGI("Destroying Asset in %p #%d\n", this, gCount);
+ if (kIsDebug) {
+ ALOGI("Destroying Asset in %p #%d\n", this, gCount);
+ }
}
/*
diff --git a/libs/androidfw/AssetManager.cpp b/libs/androidfw/AssetManager.cpp
index de6a33c..25cd363 100644
--- a/libs/androidfw/AssetManager.cpp
+++ b/libs/androidfw/AssetManager.cpp
@@ -64,6 +64,8 @@
using namespace android;
+static const bool kIsDebug = false;
+
/*
* Names for default app, locale, and vendor. We might want to change
* these to be an actual locale, e.g. always use en-US as the default.
@@ -152,15 +154,19 @@ AssetManager::AssetManager(CacheMode cacheMode)
mResources(NULL), mConfig(new ResTable_config),
mCacheMode(cacheMode), mCacheValid(false)
{
- int count = android_atomic_inc(&gCount)+1;
- //ALOGI("Creating AssetManager %p #%d\n", this, count);
+ int count = android_atomic_inc(&gCount) + 1;
+ if (kIsDebug) {
+ ALOGI("Creating AssetManager %p #%d\n", this, count);
+ }
memset(mConfig, 0, sizeof(ResTable_config));
}
AssetManager::~AssetManager(void)
{
int count = android_atomic_dec(&gCount);
- //ALOGI("Destroying AssetManager in %p #%d\n", this, count);
+ if (kIsDebug) {
+ ALOGI("Destroying AssetManager in %p #%d\n", this, count);
+ }
delete mConfig;
delete mResources;
@@ -296,6 +302,10 @@ bool AssetManager::addOverlayPath(const String8& packagePath, int32_t* cookie)
mAssetPaths.add(oap);
*cookie = static_cast<int32_t>(mAssetPaths.size());
+ if (mResources != NULL) {
+ appendPathToResTable(oap);
+ }
+
return true;
}
@@ -601,6 +611,11 @@ FileType AssetManager::getFileType(const char* fileName)
}
bool AssetManager::appendPathToResTable(const asset_path& ap) const {
+ // skip those ap's that correspond to system overlays
+ if (ap.isSystemOverlay) {
+ return true;
+ }
+
Asset* ass = NULL;
ResTable* sharedRes = NULL;
bool shared = true;
@@ -786,6 +801,7 @@ void AssetManager::addSystemOverlays(const char* pathOverlaysList,
oap.path = String8(buf, space - buf);
oap.type = kFileTypeRegular;
oap.idmap = String8(space + 1, newline - space - 1);
+ oap.isSystemOverlay = true;
Asset* oass = const_cast<AssetManager*>(this)->
openNonAssetInPathLocked("resources.arsc",
@@ -1864,7 +1880,9 @@ AssetManager::SharedZip::SharedZip(const String8& path, time_t modWhen)
: mPath(path), mZipFile(NULL), mModWhen(modWhen),
mResourceTableAsset(NULL), mResourceTable(NULL)
{
- //ALOGI("Creating SharedZip %p %s\n", this, (const char*)mPath);
+ if (kIsDebug) {
+ ALOGI("Creating SharedZip %p %s\n", this, (const char*)mPath);
+ }
ALOGV("+++ opening zip '%s'\n", mPath.string());
mZipFile = ZipFileRO::open(mPath.string());
if (mZipFile == NULL) {
@@ -1958,7 +1976,9 @@ bool AssetManager::SharedZip::getOverlay(size_t idx, asset_path* out) const
AssetManager::SharedZip::~SharedZip()
{
- //ALOGI("Destroying SharedZip %p %s\n", this, (const char*)mPath);
+ if (kIsDebug) {
+ ALOGI("Destroying SharedZip %p %s\n", this, (const char*)mPath);
+ }
if (mResourceTable != NULL) {
delete mResourceTable;
}
diff --git a/libs/androidfw/BackupData.cpp b/libs/androidfw/BackupData.cpp
index d16d5498..ba4a4ff 100644
--- a/libs/androidfw/BackupData.cpp
+++ b/libs/androidfw/BackupData.cpp
@@ -27,7 +27,7 @@
namespace android {
-static const bool DEBUG = false;
+static const bool kIsDebug = false;
/*
* File Format (v1):
@@ -45,12 +45,6 @@ static const bool DEBUG = false;
const static int ROUND_UP[4] = { 0, 3, 2, 1 };
static inline size_t
-round_up(size_t n)
-{
- return n + ROUND_UP[n % 4];
-}
-
-static inline size_t
padding_extra(size_t n)
{
return ROUND_UP[n % 4];
@@ -62,7 +56,7 @@ BackupDataWriter::BackupDataWriter(int fd)
m_entityCount(0)
{
m_pos = (ssize_t) lseek(fd, 0, SEEK_CUR);
- if (DEBUG) ALOGI("BackupDataWriter(%d) @ %ld", fd, (long)m_pos);
+ if (kIsDebug) ALOGI("BackupDataWriter(%d) @ %ld", fd, (long)m_pos);
}
BackupDataWriter::~BackupDataWriter()
@@ -79,7 +73,7 @@ BackupDataWriter::write_padding_for(int n)
paddingSize = padding_extra(n);
if (paddingSize > 0) {
uint32_t padding = 0xbcbcbcbc;
- if (DEBUG) ALOGI("writing %zd padding bytes for %d", paddingSize, n);
+ if (kIsDebug) ALOGI("writing %zd padding bytes for %d", paddingSize, n);
amt = write(m_fd, &padding, paddingSize);
if (amt != paddingSize) {
m_status = errno;
@@ -112,7 +106,7 @@ BackupDataWriter::WriteEntityHeader(const String8& key, size_t dataSize)
} else {
k = key;
}
- if (DEBUG) {
+ if (kIsDebug) {
ALOGD("Writing header: prefix='%s' key='%s' dataSize=%zu", m_keyPrefix.string(),
key.string(), dataSize);
}
@@ -126,7 +120,7 @@ BackupDataWriter::WriteEntityHeader(const String8& key, size_t dataSize)
header.keyLen = tolel(keyLen);
header.dataSize = tolel(dataSize);
- if (DEBUG) ALOGI("writing entity header, %zu bytes", sizeof(entity_header_v1));
+ if (kIsDebug) ALOGI("writing entity header, %zu bytes", sizeof(entity_header_v1));
amt = write(m_fd, &header, sizeof(entity_header_v1));
if (amt != sizeof(entity_header_v1)) {
m_status = errno;
@@ -134,7 +128,7 @@ BackupDataWriter::WriteEntityHeader(const String8& key, size_t dataSize)
}
m_pos += amt;
- if (DEBUG) ALOGI("writing entity header key, %zd bytes", keyLen+1);
+ if (kIsDebug) ALOGI("writing entity header key, %zd bytes", keyLen+1);
amt = write(m_fd, k.string(), keyLen+1);
if (amt != keyLen+1) {
m_status = errno;
@@ -152,10 +146,10 @@ BackupDataWriter::WriteEntityHeader(const String8& key, size_t dataSize)
status_t
BackupDataWriter::WriteEntityData(const void* data, size_t size)
{
- if (DEBUG) ALOGD("Writing data: size=%lu", (unsigned long) size);
+ if (kIsDebug) ALOGD("Writing data: size=%lu", (unsigned long) size);
if (m_status != NO_ERROR) {
- if (DEBUG) {
+ if (kIsDebug) {
ALOGD("Not writing data - stream in error state %d (%s)", m_status, strerror(m_status));
}
return m_status;
@@ -167,7 +161,7 @@ BackupDataWriter::WriteEntityData(const void* data, size_t size)
ssize_t amt = write(m_fd, data, size);
if (amt != (ssize_t)size) {
m_status = errno;
- if (DEBUG) ALOGD("write returned error %d (%s)", m_status, strerror(m_status));
+ if (kIsDebug) ALOGD("write returned error %d (%s)", m_status, strerror(m_status));
return m_status;
}
m_pos += amt;
@@ -189,7 +183,7 @@ BackupDataReader::BackupDataReader(int fd)
{
memset(&m_header, 0, sizeof(m_header));
m_pos = (ssize_t) lseek(fd, 0, SEEK_CUR);
- if (DEBUG) ALOGI("BackupDataReader(%d) @ %ld", fd, (long)m_pos);
+ if (kIsDebug) ALOGI("BackupDataReader(%d) @ %ld", fd, (long)m_pos);
}
BackupDataReader::~BackupDataReader()
@@ -342,15 +336,19 @@ BackupDataReader::ReadEntityData(void* data, size_t size)
return -1;
}
int remaining = m_dataEndPos - m_pos;
- //ALOGD("ReadEntityData size=%d m_pos=0x%x m_dataEndPos=0x%x remaining=%d\n",
- // size, m_pos, m_dataEndPos, remaining);
+ if (kIsDebug) {
+ ALOGD("ReadEntityData size=%zu m_pos=0x%zx m_dataEndPos=0x%zx remaining=%d\n",
+ size, m_pos, m_dataEndPos, remaining);
+ }
if (remaining <= 0) {
return 0;
}
if (((int)size) > remaining) {
size = remaining;
}
- //ALOGD(" reading %d bytes", size);
+ if (kIsDebug) {
+ ALOGD(" reading %zu bytes", size);
+ }
int amt = read(m_fd, data, size);
if (amt < 0) {
m_status = errno;
diff --git a/libs/androidfw/BackupHelpers.cpp b/libs/androidfw/BackupHelpers.cpp
index 52dce9f..3f82830 100644
--- a/libs/androidfw/BackupHelpers.cpp
+++ b/libs/androidfw/BackupHelpers.cpp
@@ -68,14 +68,11 @@ struct file_metadata_v1 {
const static int CURRENT_METADATA_VERSION = 1;
-#if 1
-#define LOGP(f, x...)
-#else
+static const bool kIsDebug = false;
#if TEST_BACKUP_HELPERS
-#define LOGP(f, x...) printf(f "\n", x)
+#define LOGP(f, x...) if (kIsDebug) printf(f "\n", x)
#else
-#define LOGP(x...) ALOGD(x)
-#endif
+#define LOGP(x...) if (kIsDebug) ALOGD(x)
#endif
const static int ROUND_UP[4] = { 0, 3, 2, 1 };
@@ -205,13 +202,6 @@ write_snapshot_file(int fd, const KeyedVector<String8,FileRec>& snapshot)
}
static int
-write_delete_file(BackupDataWriter* dataStream, const String8& key)
-{
- LOGP("write_delete_file %s\n", key.string());
- return dataStream->WriteEntityHeader(key, -1);
-}
-
-static int
write_update_file(BackupDataWriter* dataStream, int fd, int mode, const String8& key,
char const* realFilename)
{
@@ -225,8 +215,6 @@ write_update_file(BackupDataWriter* dataStream, int fd, int mode, const String8&
file_metadata_v1 metadata;
char* buf = (char*)malloc(bufsize);
- int crc = crc32(0L, Z_NULL, 0);
-
fileSize = lseek(fd, 0, SEEK_END);
lseek(fd, 0, SEEK_SET);
@@ -442,18 +430,6 @@ back_up_files(int oldSnapshotFD, BackupDataWriter* dataStream, int newSnapshotFD
return 0;
}
-// Utility function, equivalent to stpcpy(): perform a strcpy, but instead of
-// returning the initial dest, return a pointer to the trailing NUL.
-static char* strcpy_ptr(char* dest, const char* str) {
- if (dest && str) {
- while ((*dest = *str) != 0) {
- dest++;
- str++;
- }
- }
- return dest;
-}
-
static void calc_tar_checksum(char* buf) {
// [ 148 : 8 ] checksum -- to be calculated with this field as space chars
memset(buf + 148, ' ', 8);
@@ -579,7 +555,7 @@ int write_tarfile(const String8& packageName, const String8& domain,
snprintf(buf + 124, 12, "%011llo", (isdir) ? 0LL : s.st_size);
// [ 136 : 12 ] last mod time as a UTC time_t
- snprintf(buf + 136, 12, "%0lo", s.st_mtime);
+ snprintf(buf + 136, 12, "%0lo", (unsigned long)s.st_mtime);
// [ 156 : 1 ] link/file type
uint8_t type;
@@ -635,7 +611,6 @@ int write_tarfile(const String8& packageName, const String8& domain,
// construct the pax extended header data block
memset(paxData, 0, BUFSIZE - (paxData - buf));
- int len;
// size header -- calc len in digits by actually rendering the number
// to a string - brute force but simple
@@ -1200,7 +1175,6 @@ test_read_header_and_entity(BackupDataReader& reader, const char* str)
size_t bufSize = strlen(str)+1;
char* buf = (char*)malloc(bufSize);
String8 string;
- int cookie = 0x11111111;
size_t actualSize;
bool done;
int type;
@@ -1333,23 +1307,12 @@ get_mod_time(const char* filename, struct timeval times[2])
fprintf(stderr, "stat '%s' failed: %s\n", filename, strerror(errno));
return errno;
}
- times[0].tv_sec = st.st_atime;
- times[1].tv_sec = st.st_mtime;
- // If st_atime is a macro then struct stat64 uses struct timespec
- // to store the access and modif time values and typically
- // st_*time_nsec is not defined. In glibc, this is controlled by
- // __USE_MISC.
-#ifdef __USE_MISC
-#if !defined(st_atime) || defined(st_atime_nsec)
-#error "Check if this __USE_MISC conditional is still needed."
-#endif
+ times[0].tv_sec = st.st_atim.tv_sec;
times[0].tv_usec = st.st_atim.tv_nsec / 1000;
+
+ times[1].tv_sec = st.st_mtim.tv_sec;
times[1].tv_usec = st.st_mtim.tv_nsec / 1000;
-#else
- times[0].tv_usec = st.st_atime_nsec / 1000;
- times[1].tv_usec = st.st_mtime_nsec / 1000;
-#endif
return 0;
}
@@ -1490,7 +1453,6 @@ int
backup_helper_test_null_base()
{
int err;
- int oldSnapshotFD;
int dataStreamFD;
int newSnapshotFD;
@@ -1539,7 +1501,6 @@ int
backup_helper_test_missing_file()
{
int err;
- int oldSnapshotFD;
int dataStreamFD;
int newSnapshotFD;
diff --git a/libs/androidfw/ObbFile.cpp b/libs/androidfw/ObbFile.cpp
index ec59f06..195fa9a 100644
--- a/libs/androidfw/ObbFile.cpp
+++ b/libs/androidfw/ObbFile.cpp
@@ -122,7 +122,7 @@ bool ObbFile::parseObbFile(int fd)
if (fileLength < 0) {
ALOGW("error seeking in ObbFile: %s\n", strerror(errno));
} else {
- ALOGW("file is only %lld (less than %d minimum)\n", fileLength, kFooterMinSize);
+ ALOGW("file is only %lld (less than %d minimum)\n", (long long int)fileLength, kFooterMinSize);
}
return false;
}
@@ -150,8 +150,8 @@ bool ObbFile::parseObbFile(int fd)
footerSize = get4LE((unsigned char*)footer);
if (footerSize > (size_t)fileLength - kFooterTagSize
|| footerSize > kMaxBufSize) {
- ALOGW("claimed footer size is too large (0x%08zx; file size is 0x%08llx)\n",
- footerSize, fileLength);
+ ALOGW("claimed footer size is too large (0x%08zx; file size is 0x%08lld)\n",
+ footerSize, (long long int)fileLength);
return false;
}
@@ -164,7 +164,7 @@ bool ObbFile::parseObbFile(int fd)
off64_t fileOffset = fileLength - footerSize - kFooterTagSize;
if (lseek64(fd, fileOffset, SEEK_SET) != fileOffset) {
- ALOGW("seek %lld failed: %s\n", fileOffset, strerror(errno));
+ ALOGW("seek %lld failed: %s\n", (long long int)fileOffset, strerror(errno));
return false;
}
diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp
index 6dfb4dc..a951ffb 100644
--- a/libs/androidfw/ResourceTypes.cpp
+++ b/libs/androidfw/ResourceTypes.cpp
@@ -27,6 +27,10 @@
#include <utils/String16.h>
#include <utils/String8.h>
+#ifdef HAVE_ANDROID_OS
+#include <binder/TextOutput.h>
+#endif
+
#include <stdlib.h>
#include <string.h>
#include <memory.h>
@@ -38,32 +42,15 @@
#define INT32_MAX ((int32_t)(2147483647))
#endif
-#define STRING_POOL_NOISY(x) //x
-#define XML_NOISY(x) //x
-#define TABLE_NOISY(x) //x
-#define TABLE_GETENTRY(x) //x
-#define TABLE_SUPER_NOISY(x) //x
-#define LOAD_TABLE_NOISY(x) //x
-#define TABLE_THEME(x) //x
-#define LIB_NOISY(x) //x
-
namespace android {
#ifdef HAVE_WINSOCK
#undef nhtol
#undef htonl
-
-#ifdef HAVE_LITTLE_ENDIAN
#define ntohl(x) ( ((x) << 24) | (((x) >> 24) & 255) | (((x) << 8) & 0xff0000) | (((x) >> 8) & 0xff00) )
#define htonl(x) ntohl(x)
#define ntohs(x) ( (((x) << 8) & 0xff00) | (((x) >> 8) & 255) )
#define htons(x) ntohs(x)
-#else
-#define ntohl(x) (x)
-#define htonl(x) (x)
-#define ntohs(x) (x)
-#define htons(x) (x)
-#endif
#endif
#define IDMAP_MAGIC 0x504D4449
@@ -72,6 +59,19 @@ namespace android {
#define APP_PACKAGE_ID 0x7f
#define SYS_PACKAGE_ID 0x01
+static const bool kDebugStringPoolNoisy = false;
+static const bool kDebugXMLNoisy = false;
+static const bool kDebugTableNoisy = false;
+static const bool kDebugTableGetEntry = false;
+static const bool kDebugTableSuperNoisy = false;
+static const bool kDebugLoadTableNoisy = false;
+static const bool kDebugLoadTableSuperNoisy = false;
+static const bool kDebugTableTheme = false;
+static const bool kDebugResXMLTree = false;
+static const bool kDebugLibNoisy = false;
+
+// TODO: This code uses 0xFFFFFFFF converted to bag_set* as a sentinel value. This is bad practice.
+
// Standard C isspace() is only required to look at the low byte of its input, so
// produces incorrect results for UTF-16 characters. For safety's sake, assume that
// any high-byte UTF-16 code point is not whitespace.
@@ -719,12 +719,14 @@ const char16_t* ResStringPool::stringAt(size_t idx, size_t* u16len) const
if (mCache == NULL) {
#ifndef HAVE_ANDROID_OS
- STRING_POOL_NOISY(ALOGI("CREATING STRING CACHE OF %d bytes",
- mHeader->stringCount*sizeof(char16_t**)));
+ if (kDebugStringPoolNoisy) {
+ ALOGI("CREATING STRING CACHE OF %zu bytes",
+ mHeader->stringCount*sizeof(char16_t**));
+ }
#else
// We do not want to be in this case when actually running Android.
- ALOGW("CREATING STRING CACHE OF %d bytes",
- mHeader->stringCount*sizeof(char16_t**));
+ ALOGW("CREATING STRING CACHE OF %zu bytes",
+ static_cast<size_t>(mHeader->stringCount*sizeof(char16_t**)));
#endif
mCache = (char16_t**)calloc(mHeader->stringCount, sizeof(char16_t**));
if (mCache == NULL) {
@@ -753,7 +755,9 @@ const char16_t* ResStringPool::stringAt(size_t idx, size_t* u16len) const
return NULL;
}
- STRING_POOL_NOISY(ALOGI("Caching UTF8 string: %s", u8str));
+ if (kDebugStringPoolNoisy) {
+ ALOGI("Caching UTF8 string: %s", u8str);
+ }
utf8_to_utf16(u8str, u8len, u16str);
mCache[idx] = u16str;
return u16str;
@@ -843,7 +847,9 @@ ssize_t ResStringPool::indexOfString(const char16_t* str, size_t strLen) const
size_t len;
if ((mHeader->flags&ResStringPool_header::UTF8_FLAG) != 0) {
- STRING_POOL_NOISY(ALOGI("indexOfString UTF-8: %s", String8(str, strLen).string()));
+ if (kDebugStringPoolNoisy) {
+ ALOGI("indexOfString UTF-8: %s", String8(str, strLen).string());
+ }
// The string pool contains UTF 8 strings; we don't want to cause
// temporary UTF-16 strings to be created as we search.
@@ -869,10 +875,14 @@ ssize_t ResStringPool::indexOfString(const char16_t* str, size_t strLen) const
} else {
c = -1;
}
- STRING_POOL_NOISY(ALOGI("Looking at %s, cmp=%d, l/mid/h=%d/%d/%d\n",
- (const char*)s, c, (int)l, (int)mid, (int)h));
+ if (kDebugStringPoolNoisy) {
+ ALOGI("Looking at %s, cmp=%d, l/mid/h=%d/%d/%d\n",
+ (const char*)s, c, (int)l, (int)mid, (int)h);
+ }
if (c == 0) {
- STRING_POOL_NOISY(ALOGI("MATCH!"));
+ if (kDebugStringPoolNoisy) {
+ ALOGI("MATCH!");
+ }
free(convBuffer);
return mid;
} else if (c < 0) {
@@ -891,18 +901,22 @@ ssize_t ResStringPool::indexOfString(const char16_t* str, size_t strLen) const
const size_t str8Len = str8.size();
for (int i=mHeader->stringCount-1; i>=0; i--) {
const char* s = string8At(i, &len);
- STRING_POOL_NOISY(ALOGI("Looking at %s, i=%d\n",
- String8(s).string(),
- i));
+ if (kDebugStringPoolNoisy) {
+ ALOGI("Looking at %s, i=%d\n", String8(s).string(), i);
+ }
if (s && str8Len == len && memcmp(s, str8.string(), str8Len) == 0) {
- STRING_POOL_NOISY(ALOGI("MATCH!"));
+ if (kDebugStringPoolNoisy) {
+ ALOGI("MATCH!");
+ }
return i;
}
}
}
} else {
- STRING_POOL_NOISY(ALOGI("indexOfString UTF-16: %s", String8(str, strLen).string()));
+ if (kDebugStringPoolNoisy) {
+ ALOGI("indexOfString UTF-16: %s", String8(str, strLen).string());
+ }
if (mHeader->flags&ResStringPool_header::SORTED_FLAG) {
// Do a binary search for the string...
@@ -914,11 +928,14 @@ ssize_t ResStringPool::indexOfString(const char16_t* str, size_t strLen) const
mid = l + (h - l)/2;
const char16_t* s = stringAt(mid, &len);
int c = s ? strzcmp16(s, len, str, strLen) : -1;
- STRING_POOL_NOISY(ALOGI("Looking at %s, cmp=%d, l/mid/h=%d/%d/%d\n",
- String8(s).string(),
- c, (int)l, (int)mid, (int)h));
+ if (kDebugStringPoolNoisy) {
+ ALOGI("Looking at %s, cmp=%d, l/mid/h=%d/%d/%d\n",
+ String8(s).string(), c, (int)l, (int)mid, (int)h);
+ }
if (c == 0) {
- STRING_POOL_NOISY(ALOGI("MATCH!"));
+ if (kDebugStringPoolNoisy) {
+ ALOGI("MATCH!");
+ }
return mid;
} else if (c < 0) {
l = mid + 1;
@@ -933,11 +950,13 @@ ssize_t ResStringPool::indexOfString(const char16_t* str, size_t strLen) const
// block, start searching at the back.
for (int i=mHeader->stringCount-1; i>=0; i--) {
const char16_t* s = stringAt(i, &len);
- STRING_POOL_NOISY(ALOGI("Looking at %s, i=%d\n",
- String8(s).string(),
- i));
+ if (kDebugStringPoolNoisy) {
+ ALOGI("Looking at %s, i=%d\n", String8(s).string(), i);
+ }
if (s && strLen == len && strzcmp16(s, len, str, strLen) == 0) {
- STRING_POOL_NOISY(ALOGI("MATCH!"));
+ if (kDebugStringPoolNoisy) {
+ ALOGI("MATCH!");
+ }
return i;
}
}
@@ -1138,7 +1157,9 @@ const char16_t* ResXMLParser::getAttributeNamespace(size_t idx, size_t* outLen)
{
int32_t id = getAttributeNamespaceID(idx);
//printf("attribute namespace=%d idx=%d event=%p\n", id, idx, mEventCode);
- //XML_NOISY(printf("getAttributeNamespace 0x%x=0x%x\n", idx, id));
+ if (kDebugXMLNoisy) {
+ printf("getAttributeNamespace 0x%zx=0x%x\n", idx, id);
+ }
return id >= 0 ? mTree.mStrings.stringAt(id, outLen) : NULL;
}
@@ -1146,7 +1167,9 @@ const char* ResXMLParser::getAttributeNamespace8(size_t idx, size_t* outLen) con
{
int32_t id = getAttributeNamespaceID(idx);
//printf("attribute namespace=%d idx=%d event=%p\n", id, idx, mEventCode);
- //XML_NOISY(printf("getAttributeNamespace 0x%x=0x%x\n", idx, id));
+ if (kDebugXMLNoisy) {
+ printf("getAttributeNamespace 0x%zx=0x%x\n", idx, id);
+ }
return id >= 0 ? mTree.mStrings.string8At(id, outLen) : NULL;
}
@@ -1169,7 +1192,9 @@ const char16_t* ResXMLParser::getAttributeName(size_t idx, size_t* outLen) const
{
int32_t id = getAttributeNameID(idx);
//printf("attribute name=%d idx=%d event=%p\n", id, idx, mEventCode);
- //XML_NOISY(printf("getAttributeName 0x%x=0x%x\n", idx, id));
+ if (kDebugXMLNoisy) {
+ printf("getAttributeName 0x%zx=0x%x\n", idx, id);
+ }
return id >= 0 ? mTree.mStrings.stringAt(id, outLen) : NULL;
}
@@ -1177,7 +1202,9 @@ const char* ResXMLParser::getAttributeName8(size_t idx, size_t* outLen) const
{
int32_t id = getAttributeNameID(idx);
//printf("attribute name=%d idx=%d event=%p\n", id, idx, mEventCode);
- //XML_NOISY(printf("getAttributeName 0x%x=0x%x\n", idx, id));
+ if (kDebugXMLNoisy) {
+ printf("getAttributeName 0x%zx=0x%x\n", idx, id);
+ }
return id >= 0 ? mTree.mStrings.string8At(id, outLen) : NULL;
}
@@ -1212,7 +1239,9 @@ int32_t ResXMLParser::getAttributeValueStringID(size_t idx) const
const char16_t* ResXMLParser::getAttributeStringValue(size_t idx, size_t* outLen) const
{
int32_t id = getAttributeValueStringID(idx);
- //XML_NOISY(printf("getAttributeValue 0x%x=0x%x\n", idx, id));
+ if (kDebugXMLNoisy) {
+ printf("getAttributeValue 0x%zx=0x%x\n", idx, id);
+ }
return id >= 0 ? mTree.mStrings.stringAt(id, outLen) : NULL;
}
@@ -1303,54 +1332,69 @@ ssize_t ResXMLParser::indexOfAttribute(const char16_t* ns, size_t nsLen,
ns8 = String8(ns, nsLen);
}
attr8 = String8(attr, attrLen);
- STRING_POOL_NOISY(ALOGI("indexOfAttribute UTF8 %s (%d) / %s (%d)", ns8.string(), nsLen,
- attr8.string(), attrLen));
+ if (kDebugStringPoolNoisy) {
+ ALOGI("indexOfAttribute UTF8 %s (%zu) / %s (%zu)", ns8.string(), nsLen,
+ attr8.string(), attrLen);
+ }
for (size_t i=0; i<N; i++) {
size_t curNsLen = 0, curAttrLen = 0;
const char* curNs = getAttributeNamespace8(i, &curNsLen);
const char* curAttr = getAttributeName8(i, &curAttrLen);
- STRING_POOL_NOISY(ALOGI(" curNs=%s (%d), curAttr=%s (%d)", curNs, curNsLen,
- curAttr, curAttrLen));
+ if (kDebugStringPoolNoisy) {
+ ALOGI(" curNs=%s (%zu), curAttr=%s (%zu)", curNs, curNsLen, curAttr, curAttrLen);
+ }
if (curAttr != NULL && curNsLen == nsLen && curAttrLen == attrLen
&& memcmp(attr8.string(), curAttr, attrLen) == 0) {
if (ns == NULL) {
if (curNs == NULL) {
- STRING_POOL_NOISY(ALOGI(" FOUND!"));
+ if (kDebugStringPoolNoisy) {
+ ALOGI(" FOUND!");
+ }
return i;
}
} else if (curNs != NULL) {
//printf(" --> ns=%s, curNs=%s\n",
// String8(ns).string(), String8(curNs).string());
if (memcmp(ns8.string(), curNs, nsLen) == 0) {
- STRING_POOL_NOISY(ALOGI(" FOUND!"));
+ if (kDebugStringPoolNoisy) {
+ ALOGI(" FOUND!");
+ }
return i;
}
}
}
}
} else {
- STRING_POOL_NOISY(ALOGI("indexOfAttribute UTF16 %s (%d) / %s (%d)",
- String8(ns, nsLen).string(), nsLen,
- String8(attr, attrLen).string(), attrLen));
+ if (kDebugStringPoolNoisy) {
+ ALOGI("indexOfAttribute UTF16 %s (%zu) / %s (%zu)",
+ String8(ns, nsLen).string(), nsLen,
+ String8(attr, attrLen).string(), attrLen);
+ }
for (size_t i=0; i<N; i++) {
size_t curNsLen = 0, curAttrLen = 0;
const char16_t* curNs = getAttributeNamespace(i, &curNsLen);
const char16_t* curAttr = getAttributeName(i, &curAttrLen);
- STRING_POOL_NOISY(ALOGI(" curNs=%s (%d), curAttr=%s (%d)",
- String8(curNs, curNsLen).string(), curNsLen,
- String8(curAttr, curAttrLen).string(), curAttrLen));
+ if (kDebugStringPoolNoisy) {
+ ALOGI(" curNs=%s (%zu), curAttr=%s (%zu)",
+ String8(curNs, curNsLen).string(), curNsLen,
+ String8(curAttr, curAttrLen).string(), curAttrLen);
+ }
if (curAttr != NULL && curNsLen == nsLen && curAttrLen == attrLen
&& (memcmp(attr, curAttr, attrLen*sizeof(char16_t)) == 0)) {
if (ns == NULL) {
if (curNs == NULL) {
- STRING_POOL_NOISY(ALOGI(" FOUND!"));
+ if (kDebugStringPoolNoisy) {
+ ALOGI(" FOUND!");
+ }
return i;
}
} else if (curNs != NULL) {
//printf(" --> ns=%s, curNs=%s\n",
// String8(ns).string(), String8(curNs).string());
if (memcmp(ns, curNs, nsLen*sizeof(char16_t)) == 0) {
- STRING_POOL_NOISY(ALOGI(" FOUND!"));
+ if (kDebugStringPoolNoisy) {
+ ALOGI(" FOUND!");
+ }
return i;
}
}
@@ -1398,7 +1442,9 @@ ResXMLParser::event_code_t ResXMLParser::nextNode()
do {
const ResXMLTree_node* next = (const ResXMLTree_node*)
(((const uint8_t*)mCurNode) + dtohl(mCurNode->header.size));
- //ALOGW("Next node: prev=%p, next=%p\n", mCurNode, next);
+ if (kDebugXMLNoisy) {
+ ALOGI("Next node: prev=%p, next=%p\n", mCurNode, next);
+ }
if (((const uint8_t*)next) >= mTree.mDataEnd) {
mCurNode = NULL;
@@ -1475,7 +1521,9 @@ ResXMLTree::ResXMLTree(const DynamicRefTable* dynamicRefTable)
, mDynamicRefTable(dynamicRefTable)
, mError(NO_INIT), mOwnedData(NULL)
{
- //ALOGI("Creating ResXMLTree %p #%d\n", this, android_atomic_inc(&gCount)+1);
+ if (kDebugResXMLTree) {
+ ALOGI("Creating ResXMLTree %p #%d\n", this, android_atomic_inc(&gCount)+1);
+ }
restart();
}
@@ -1484,13 +1532,17 @@ ResXMLTree::ResXMLTree()
, mDynamicRefTable(NULL)
, mError(NO_INIT), mOwnedData(NULL)
{
- //ALOGI("Creating ResXMLTree %p #%d\n", this, android_atomic_inc(&gCount)+1);
+ if (kDebugResXMLTree) {
+ ALOGI("Creating ResXMLTree %p #%d\n", this, android_atomic_inc(&gCount)+1);
+ }
restart();
}
ResXMLTree::~ResXMLTree()
{
- //ALOGI("Destroying ResXMLTree in %p #%d\n", this, android_atomic_dec(&gCount)-1);
+ if (kDebugResXMLTree) {
+ ALOGI("Destroying ResXMLTree in %p #%d\n", this, android_atomic_dec(&gCount)-1);
+ }
uninit();
}
@@ -1543,8 +1595,10 @@ status_t ResXMLTree::setTo(const void* data, size_t size, bool copyData)
}
const uint16_t type = dtohs(chunk->type);
const size_t size = dtohl(chunk->size);
- XML_NOISY(printf("Scanning @ %p: type=0x%x, size=0x%x\n",
- (void*)(((uint32_t)chunk)-((uint32_t)mHeader)), type, size));
+ if (kDebugXMLNoisy) {
+ printf("Scanning @ %p: type=0x%x, size=0x%zx\n",
+ (void*)(((uintptr_t)chunk)-((uintptr_t)mHeader)), type, size);
+ }
if (type == RES_STRING_POOL_TYPE) {
mStrings.setTo(chunk, size);
} else if (type == RES_XML_RESOURCE_MAP_TYPE) {
@@ -1567,7 +1621,9 @@ status_t ResXMLTree::setTo(const void* data, size_t size, bool copyData)
mRootCode = mEventCode;
break;
} else {
- XML_NOISY(printf("Skipping unknown chunk!\n"));
+ if (kDebugXMLNoisy) {
+ printf("Skipping unknown chunk!\n");
+ }
}
lastChunk = chunk;
chunk = (const ResChunk_header*)
@@ -2151,9 +2207,11 @@ bool ResTable_config::isBetterThan(const ResTable_config& o,
myDelta += requested->screenHeightDp - screenHeightDp;
otherDelta += requested->screenHeightDp - o.screenHeightDp;
}
- //ALOGI("Comparing this %dx%d to other %dx%d in %dx%d: myDelta=%d otherDelta=%d",
- // screenWidthDp, screenHeightDp, o.screenWidthDp, o.screenHeightDp,
- // requested->screenWidthDp, requested->screenHeightDp, myDelta, otherDelta);
+ if (kDebugTableSuperNoisy) {
+ ALOGI("Comparing this %dx%d to other %dx%d in %dx%d: myDelta=%d otherDelta=%d",
+ screenWidthDp, screenHeightDp, o.screenWidthDp, o.screenHeightDp,
+ requested->screenWidthDp, requested->screenHeightDp, myDelta, otherDelta);
+ }
if (myDelta != otherDelta) {
return myDelta < otherDelta;
}
@@ -2408,11 +2466,17 @@ bool ResTable_config::match(const ResTable_config& settings) const {
}
if (screenSizeDp != 0) {
if (screenWidthDp != 0 && screenWidthDp > settings.screenWidthDp) {
- //ALOGI("Filtering out width %d in requested %d", screenWidthDp, settings.screenWidthDp);
+ if (kDebugTableSuperNoisy) {
+ ALOGI("Filtering out width %d in requested %d", screenWidthDp,
+ settings.screenWidthDp);
+ }
return false;
}
if (screenHeightDp != 0 && screenHeightDp > settings.screenHeightDp) {
- //ALOGI("Filtering out height %d in requested %d", screenHeightDp, settings.screenHeightDp);
+ if (kDebugTableSuperNoisy) {
+ ALOGI("Filtering out height %d in requested %d", screenHeightDp,
+ settings.screenHeightDp);
+ }
return false;
}
}
@@ -2432,9 +2496,13 @@ bool ResTable_config::match(const ResTable_config& settings) const {
// For compatibility, we count a request for KEYSHIDDEN_NO as also
// matching the more recent KEYSHIDDEN_SOFT. Basically
// KEYSHIDDEN_NO means there is some kind of keyboard available.
- //ALOGI("Matching keysHidden: have=%d, config=%d\n", keysHidden, setKeysHidden);
+ if (kDebugTableSuperNoisy) {
+ ALOGI("Matching keysHidden: have=%d, config=%d\n", keysHidden, setKeysHidden);
+ }
if (keysHidden != KEYSHIDDEN_NO || setKeysHidden != KEYSHIDDEN_SOFT) {
- //ALOGI("No match!");
+ if (kDebugTableSuperNoisy) {
+ ALOGI("No match!");
+ }
return false;
}
}
@@ -2939,17 +3007,25 @@ struct ResTable::PackageGroup
void clearBagCache() {
if (bags) {
- TABLE_NOISY(printf("bags=%p\n", bags));
+ if (kDebugTableNoisy) {
+ printf("bags=%p\n", bags);
+ }
for (size_t i = 0; i < bags->size(); i++) {
- TABLE_NOISY(printf("type=%d\n", i));
+ if (kDebugTableNoisy) {
+ printf("type=%zu\n", i);
+ }
const TypeList& typeList = types[i];
if (!typeList.isEmpty()) {
bag_set** typeBags = bags->get(i);
- TABLE_NOISY(printf("typeBags=%p\n", typeBags));
+ if (kDebugTableNoisy) {
+ printf("typeBags=%p\n", typeBags);
+ }
if (typeBags) {
const size_t N = typeList[0]->entryCount;
- TABLE_NOISY(printf("type->entryCount=%x\n", N));
- for (size_t j=0; j<N; j++) {
+ if (kDebugTableNoisy) {
+ printf("type->entryCount=%zu\n", N);
+ }
+ for (size_t j = 0; j < N; j++) {
if (typeBags[j] && typeBags[j] != (bag_set*)0xFFFFFFFF)
free(typeBags[j]);
}
@@ -3057,7 +3133,9 @@ status_t ResTable::Theme::applyStyle(uint32_t resID, bool force)
uint32_t bagTypeSpecFlags = 0;
mTable.lock();
const ssize_t N = mTable.getBagLocked(resID, &bag, &bagTypeSpecFlags);
- TABLE_NOISY(ALOGV("Applying style 0x%08x to theme %p, count=%d", resID, this, N));
+ if (kDebugTableNoisy) {
+ ALOGV("Applying style 0x%08x to theme %p, count=%zu", resID, this, N);
+ }
if (N < 0) {
mTable.unlock();
return N;
@@ -3088,7 +3166,6 @@ status_t ResTable::Theme::applyStyle(uint32_t resID, bool force)
curPackageIndex = pidx;
curPI = mPackages[pidx];
if (curPI == NULL) {
- PackageGroup* const grp = mTable.mPackageGroups[pidx];
curPI = (package_info*)malloc(sizeof(package_info));
memset(curPI, 0, sizeof(*curPI));
mPackages[pidx] = curPI;
@@ -3120,9 +3197,11 @@ status_t ResTable::Theme::applyStyle(uint32_t resID, bool force)
continue;
}
theme_entry* curEntry = curEntries + e;
- TABLE_NOISY(ALOGV("Attr 0x%08x: type=0x%x, data=0x%08x; curType=0x%x",
- attrRes, bag->map.value.dataType, bag->map.value.data,
- curEntry->value.dataType));
+ if (kDebugTableNoisy) {
+ ALOGV("Attr 0x%08x: type=0x%x, data=0x%08x; curType=0x%x",
+ attrRes, bag->map.value.dataType, bag->map.value.data,
+ curEntry->value.dataType);
+ }
if (force || curEntry->value.dataType == Res_value::TYPE_NULL) {
curEntry->stringBlock = bag->stringBlock;
curEntry->typeSpecFlags |= bagTypeSpecFlags;
@@ -3134,17 +3213,21 @@ status_t ResTable::Theme::applyStyle(uint32_t resID, bool force)
mTable.unlock();
- //ALOGI("Applying style 0x%08x (force=%d) theme %p...\n", resID, force, this);
- //dumpToLog();
+ if (kDebugTableTheme) {
+ ALOGI("Applying style 0x%08x (force=%d) theme %p...\n", resID, force, this);
+ dumpToLog();
+ }
return NO_ERROR;
}
status_t ResTable::Theme::setTo(const Theme& other)
{
- //ALOGI("Setting theme %p from theme %p...\n", this, &other);
- //dumpToLog();
- //other.dumpToLog();
+ if (kDebugTableTheme) {
+ ALOGI("Setting theme %p from theme %p...\n", this, &other);
+ dumpToLog();
+ other.dumpToLog();
+ }
if (&mTable == &other.mTable) {
for (size_t i=0; i<Res_MAXPACKAGE; i++) {
@@ -3173,8 +3256,10 @@ status_t ResTable::Theme::setTo(const Theme& other)
}
}
- //ALOGI("Final theme:");
- //dumpToLog();
+ if (kDebugTableTheme) {
+ ALOGI("Final theme:");
+ dumpToLog();
+ }
return NO_ERROR;
}
@@ -3191,23 +3276,33 @@ ssize_t ResTable::Theme::getAttribute(uint32_t resID, Res_value* outValue,
const uint32_t t = Res_GETTYPE(resID);
const uint32_t e = Res_GETENTRY(resID);
- TABLE_THEME(ALOGI("Looking up attr 0x%08x in theme %p", resID, this));
+ if (kDebugTableTheme) {
+ ALOGI("Looking up attr 0x%08x in theme %p", resID, this);
+ }
if (p >= 0) {
const package_info* const pi = mPackages[p];
- TABLE_THEME(ALOGI("Found package: %p", pi));
+ if (kDebugTableTheme) {
+ ALOGI("Found package: %p", pi);
+ }
if (pi != NULL) {
- TABLE_THEME(ALOGI("Desired type index is %ld in avail %d", t, Res_MAXTYPE + 1));
+ if (kDebugTableTheme) {
+ ALOGI("Desired type index is %zd in avail %zu", t, Res_MAXTYPE + 1);
+ }
if (t <= Res_MAXTYPE) {
const type_info& ti = pi->types[t];
- TABLE_THEME(ALOGI("Desired entry index is %ld in avail %d", e, ti.numEntries));
+ if (kDebugTableTheme) {
+ ALOGI("Desired entry index is %u in avail %zu", e, ti.numEntries);
+ }
if (e < ti.numEntries) {
const theme_entry& te = ti.entries[e];
if (outTypeSpecFlags != NULL) {
*outTypeSpecFlags |= te.typeSpecFlags;
}
- TABLE_THEME(ALOGI("Theme value: type=0x%x, data=0x%08x",
- te.value.dataType, te.value.data));
+ if (kDebugTableTheme) {
+ ALOGI("Theme value: type=0x%x, data=0x%08x",
+ te.value.dataType, te.value.data);
+ }
const uint8_t type = te.value.dataType;
if (type == Res_value::TYPE_ATTRIBUTE) {
if (cnt > 0) {
@@ -3241,8 +3336,10 @@ ssize_t ResTable::Theme::resolveAttributeReference(Res_value* inOutValue,
if (inOutValue->dataType == Res_value::TYPE_ATTRIBUTE) {
uint32_t newTypeSpecFlags;
blockIndex = getAttribute(inOutValue->data, inOutValue, &newTypeSpecFlags);
- TABLE_THEME(ALOGI("Resolving attr reference: blockIndex=%d, type=0x%x, data=%p\n",
- (int)blockIndex, (int)inOutValue->dataType, (void*)inOutValue->data));
+ if (kDebugTableTheme) {
+ ALOGI("Resolving attr reference: blockIndex=%d, type=0x%x, data=0x%x\n",
+ (int)blockIndex, (int)inOutValue->dataType, inOutValue->data);
+ }
if (inoutTypeSpecFlags != NULL) *inoutTypeSpecFlags |= newTypeSpecFlags;
//printf("Retrieved attribute new type=0x%x\n", inOutValue->dataType);
if (blockIndex < 0) {
@@ -3281,7 +3378,9 @@ ResTable::ResTable()
{
memset(&mParams, 0, sizeof(mParams));
memset(mPackageMap, 0, sizeof(mPackageMap));
- //ALOGI("Creating ResTable %p\n", this);
+ if (kDebugTableSuperNoisy) {
+ ALOGI("Creating ResTable %p\n", this);
+ }
}
ResTable::ResTable(const void* data, size_t size, const int32_t cookie, bool copyData)
@@ -3291,12 +3390,16 @@ ResTable::ResTable(const void* data, size_t size, const int32_t cookie, bool cop
memset(mPackageMap, 0, sizeof(mPackageMap));
addInternal(data, size, NULL, 0, cookie, copyData);
LOG_FATAL_IF(mError != NO_ERROR, "Error parsing resource table");
- //ALOGI("Creating ResTable %p\n", this);
+ if (kDebugTableSuperNoisy) {
+ ALOGI("Creating ResTable %p\n", this);
+ }
}
ResTable::~ResTable()
{
- //ALOGI("Destroying ResTable in %p\n", this);
+ if (kDebugTableSuperNoisy) {
+ ALOGI("Destroying ResTable in %p\n", this);
+ }
uninit();
}
@@ -3425,9 +3528,10 @@ status_t ResTable::addInternal(const void* data, size_t dataSize, const void* id
const bool notDeviceEndian = htods(0xf0) != 0xf0;
- LOAD_TABLE_NOISY(
- ALOGV("Adding resources to ResTable: data=%p, size=0x%x, cookie=%d, copy=%d "
- "idmap=%p\n", data, dataSize, cookie, copyData, idmap));
+ if (kDebugLoadTableNoisy) {
+ ALOGV("Adding resources to ResTable: data=%p, size=%zu, cookie=%d, copy=%d "
+ "idmap=%p\n", data, dataSize, cookie, copyData, idmapData);
+ }
if (copyData || notDeviceEndian) {
header->ownedData = malloc(dataSize);
@@ -3440,9 +3544,13 @@ status_t ResTable::addInternal(const void* data, size_t dataSize, const void* id
header->header = (const ResTable_header*)data;
header->size = dtohl(header->header->header.size);
- //ALOGI("Got size 0x%x, again size 0x%x, raw size 0x%x\n", header->size,
- // dtohl(header->header->header.size), header->header->header.size);
- LOAD_TABLE_NOISY(ALOGV("Loading ResTable @%p:\n", header->header));
+ if (kDebugLoadTableSuperNoisy) {
+ ALOGI("Got size %zu, again size 0x%x, raw size 0x%x\n", header->size,
+ dtohl(header->header->header.size), header->header->header.size);
+ }
+ if (kDebugLoadTableNoisy) {
+ ALOGV("Loading ResTable @%p:\n", header->header);
+ }
if (dtohs(header->header->header.headerSize) > header->size
|| header->size > dataSize) {
ALOGW("Bad resource table: header size 0x%x or total size 0x%x is larger than data size 0x%x\n",
@@ -3470,9 +3578,11 @@ status_t ResTable::addInternal(const void* data, size_t dataSize, const void* id
if (err != NO_ERROR) {
return (mError=err);
}
- TABLE_NOISY(ALOGV("Chunk: type=0x%x, headerSize=0x%x, size=0x%x, pos=%p\n",
- dtohs(chunk->type), dtohs(chunk->headerSize), dtohl(chunk->size),
- (void*)(((const uint8_t*)chunk) - ((const uint8_t*)header->header))));
+ if (kDebugTableNoisy) {
+ ALOGV("Chunk: type=0x%x, headerSize=0x%x, size=0x%x, pos=%p\n",
+ dtohs(chunk->type), dtohs(chunk->headerSize), dtohl(chunk->size),
+ (void*)(((const uint8_t*)chunk) - ((const uint8_t*)header->header)));
+ }
const size_t csize = dtohl(chunk->size);
const uint16_t ctype = dtohs(chunk->type);
if (ctype == RES_STRING_POOL_TYPE) {
@@ -3516,7 +3626,9 @@ status_t ResTable::addInternal(const void* data, size_t dataSize, const void* id
ALOGW("No string values found in resource table!");
}
- TABLE_NOISY(ALOGV("Returning from add with mError=%d\n", mError));
+ if (kDebugTableNoisy) {
+ ALOGV("Returning from add with mError=%d\n", mError);
+ }
return mError;
}
@@ -3682,15 +3794,16 @@ ssize_t ResTable::getResource(uint32_t resID, Res_value* outValue, bool mayBeBag
return BAD_VALUE;
}
- TABLE_NOISY(size_t len;
- printf("Found value: pkg=%d, type=%d, str=%s, int=%d\n",
- entry.package->header->index,
- outValue->dataType,
- outValue->dataType == Res_value::TYPE_STRING
- ? String8(entry.package->header->values.stringAt(
- outValue->data, &len)).string()
- : "",
- outValue->data));
+ if (kDebugTableNoisy) {
+ size_t len;
+ printf("Found value: pkg=%zu, type=%d, str=%s, int=%d\n",
+ entry.package->header->index,
+ outValue->dataType,
+ outValue->dataType == Res_value::TYPE_STRING ?
+ String8(entry.package->header->values.stringAt(outValue->data, &len)).string() :
+ "",
+ outValue->data);
+ }
if (outSpecFlags != NULL) {
*outSpecFlags = entry.specFlags;
@@ -3711,15 +3824,16 @@ ssize_t ResTable::resolveReference(Res_value* value, ssize_t blockIndex,
while (blockIndex >= 0 && value->dataType == Res_value::TYPE_REFERENCE
&& value->data != 0 && count < 20) {
if (outLastRef) *outLastRef = value->data;
- uint32_t lastRef = value->data;
uint32_t newFlags = 0;
const ssize_t newIndex = getResource(value->data, value, true, 0, &newFlags,
outConfig);
if (newIndex == BAD_INDEX) {
return BAD_INDEX;
}
- TABLE_THEME(ALOGI("Resolving reference %p: newIndex=%d, type=0x%x, data=%p\n",
- (void*)lastRef, (int)newIndex, (int)value->dataType, (void*)value->data));
+ if (kDebugTableTheme) {
+ ALOGI("Resolving reference 0x%x: newIndex=%d, type=0x%x, data=0x%x\n",
+ value->data, (int)newIndex, (int)value->dataType, value->data);
+ }
//printf("Getting reference 0x%08x: newIndex=%d\n", value->data, newIndex);
if (inoutTypeSpecFlags != NULL) *inoutTypeSpecFlags |= newFlags;
if (newIndex < 0) {
@@ -3826,7 +3940,9 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag,
*outTypeSpecFlags = set->typeSpecFlags;
}
*outBag = (bag_entry*)(set+1);
- //ALOGI("Found existing bag for: %p\n", (void*)resID);
+ if (kDebugTableSuperNoisy) {
+ ALOGI("Found existing bag for: 0x%x\n", resID);
+ }
return set->numAttrs;
}
ALOGW("Attempt to retrieve bag 0x%08x which is invalid or in a cycle.",
@@ -3852,7 +3968,9 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag,
// Mark that we are currently working on this one.
typeSet[e] = (bag_set*)0xFFFFFFFF;
- TABLE_NOISY(ALOGI("Building bag: %p\n", (void*)resID));
+ if (kDebugTableNoisy) {
+ ALOGI("Building bag: %x\n", resID);
+ }
// Now collect all bag attributes
Entry entry;
@@ -3869,13 +3987,13 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag,
size_t N = count;
- TABLE_NOISY(ALOGI("Found map: size=%p parent=%p count=%d\n",
- entrySize, parent, count));
+ if (kDebugTableNoisy) {
+ ALOGI("Found map: size=%x parent=%x count=%d\n", entrySize, parent, count);
// If this map inherits from another, we need to start
// with its parent's values. Otherwise start out empty.
- TABLE_NOISY(printf("Creating new bag, entrySize=0x%08x, parent=0x%08x\n",
- entrySize, parent));
+ ALOGI("Creating new bag, entrySize=0x%08x, parent=0x%08x\n", entrySize, parent);
+ }
// This is what we are building.
bag_set* set = NULL;
@@ -3904,9 +4022,13 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag,
if (NP > 0) {
memcpy(set+1, parentBag, NP*sizeof(bag_entry));
set->numAttrs = NP;
- TABLE_NOISY(ALOGI("Initialized new bag with %d inherited attributes.\n", NP));
+ if (kDebugTableNoisy) {
+ ALOGI("Initialized new bag with %zd inherited attributes.\n", NP);
+ }
} else {
- TABLE_NOISY(ALOGI("Initialized new bag with no inherited attributes.\n"));
+ if (kDebugTableNoisy) {
+ ALOGI("Initialized new bag with no inherited attributes.\n");
+ }
set->numAttrs = 0;
}
set->availAttrs = NT;
@@ -3930,10 +4052,13 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag,
bag_entry* entries = (bag_entry*)(set+1);
size_t curEntry = 0;
uint32_t pos = 0;
- TABLE_NOISY(ALOGI("Starting with set %p, entries=%p, avail=%d\n",
- set, entries, set->availAttrs));
+ if (kDebugTableNoisy) {
+ ALOGI("Starting with set %p, entries=%p, avail=%zu\n", set, entries, set->availAttrs);
+ }
while (pos < count) {
- TABLE_NOISY(printf("Now at %p\n", (void*)curOff));
+ if (kDebugTableNoisy) {
+ ALOGI("Now at %p\n", (void*)curOff);
+ }
if (curOff > (dtohl(entry.type->header.size)-sizeof(ResTable_map))) {
ALOGW("ResTable_map at %d is beyond type chunk data %d",
@@ -3958,8 +4083,10 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag,
uint32_t oldName = 0;
while ((isInside=(curEntry < set->numAttrs))
&& (oldName=entries[curEntry].map.name.ident) < newName) {
- TABLE_NOISY(printf("#%d: Keeping existing attribute: 0x%08x\n",
- curEntry, entries[curEntry].map.name.ident));
+ if (kDebugTableNoisy) {
+ ALOGI("#%zu: Keeping existing attribute: 0x%08x\n",
+ curEntry, entries[curEntry].map.name.ident);
+ }
curEntry++;
}
@@ -3976,8 +4103,10 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag,
}
set->availAttrs = newAvail;
entries = (bag_entry*)(set+1);
- TABLE_NOISY(printf("Reallocated set %p, entries=%p, avail=%d\n",
- set, entries, set->availAttrs));
+ if (kDebugTableNoisy) {
+ ALOGI("Reallocated set %p, entries=%p, avail=%zu\n",
+ set, entries, set->availAttrs);
+ }
}
if (isInside) {
// Going in the middle, need to make space.
@@ -3985,11 +4114,13 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag,
sizeof(bag_entry)*(set->numAttrs-curEntry));
set->numAttrs++;
}
- TABLE_NOISY(printf("#%d: Inserting new attribute: 0x%08x\n",
- curEntry, newName));
+ if (kDebugTableNoisy) {
+ ALOGI("#%zu: Inserting new attribute: 0x%08x\n", curEntry, newName);
+ }
} else {
- TABLE_NOISY(printf("#%d: Replacing existing attribute: 0x%08x\n",
- curEntry, oldName));
+ if (kDebugTableNoisy) {
+ ALOGI("#%zu: Replacing existing attribute: 0x%08x\n", curEntry, oldName);
+ }
}
bag_entry* cur = entries+curEntry;
@@ -4003,9 +4134,11 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag,
return UNKNOWN_ERROR;
}
- TABLE_NOISY(printf("Setting entry #%d %p: block=%d, name=0x%08x, type=%d, data=0x%08x\n",
- curEntry, cur, cur->stringBlock, cur->map.name.ident,
- cur->map.value.dataType, cur->map.value.data));
+ if (kDebugTableNoisy) {
+ ALOGI("Setting entry #%zu %p: block=%zd, name=0x%08d, type=%d, data=0x%08x\n",
+ curEntry, cur, cur->stringBlock, cur->map.name.ident,
+ cur->map.value.dataType, cur->map.value.data);
+ }
// On to the next!
curEntry++;
@@ -4025,7 +4158,9 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag,
*outTypeSpecFlags = set->typeSpecFlags;
}
*outBag = (bag_entry*)(set+1);
- TABLE_NOISY(ALOGI("Returning %d attrs\n", set->numAttrs));
+ if (kDebugTableNoisy) {
+ ALOGI("Returning %zu attrs\n", set->numAttrs);
+ }
return set->numAttrs;
}
return BAD_INDEX;
@@ -4034,10 +4169,14 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag,
void ResTable::setParameters(const ResTable_config* params)
{
mLock.lock();
- TABLE_GETENTRY(ALOGI("Setting parameters: %s\n", params->toString().string()));
+ if (kDebugTableGetEntry) {
+ ALOGI("Setting parameters: %s\n", params->toString().string());
+ }
mParams = *params;
for (size_t i=0; i<mPackageGroups.size(); i++) {
- TABLE_NOISY(ALOGI("CLEARING BAGS FOR GROUP %d!", i));
+ if (kDebugTableNoisy) {
+ ALOGI("CLEARING BAGS FOR GROUP %zu!", i);
+ }
mPackageGroups[i]->clearBagCache();
}
mLock.unlock();
@@ -4075,7 +4214,9 @@ uint32_t ResTable::identifierForName(const char16_t* name, size_t nameLen,
size_t packageLen,
uint32_t* outTypeSpecFlags) const
{
- TABLE_SUPER_NOISY(printf("Identifier for name: error=%d\n", mError));
+ if (kDebugTableSuperNoisy) {
+ printf("Identifier for name: error=%d\n", mError);
+ }
// Check for internal resource identifier as the very first thing, so
// that we will always find them even when there are no resources.
@@ -4168,10 +4309,12 @@ nope:
}
nameLen = nameEnd-name;
- TABLE_NOISY(printf("Looking for identifier: type=%s, name=%s, package=%s\n",
- String8(type, typeLen).string(),
- String8(name, nameLen).string(),
- String8(package, packageLen).string()));
+ if (kDebugTableNoisy) {
+ printf("Looking for identifier: type=%s, name=%s, package=%s\n",
+ String8(type, typeLen).string(),
+ String8(name, nameLen).string(),
+ String8(package, packageLen).string());
+ }
const size_t NG = mPackageGroups.size();
for (size_t ig=0; ig<NG; ig++) {
@@ -4179,7 +4322,9 @@ nope:
if (strzcmp16(package, packageLen,
group->name.string(), group->name.size())) {
- TABLE_NOISY(printf("Skipping package group: %s\n", String8(group->name).string()));
+ if (kDebugTableNoisy) {
+ printf("Skipping package group: %s\n", String8(group->name).string());
+ }
continue;
}
@@ -4194,8 +4339,10 @@ nope:
const TypeList& typeList = group->types[ti];
if (typeList.isEmpty()) {
- TABLE_NOISY(printf("Expected type structure not found in package %s for index %d\n",
- String8(group->name).string(), ti));
+ if (kDebugTableNoisy) {
+ ALOGI("Expected type structure not found in package %s for index %zd\n",
+ String8(group->name).string(), ti);
+ }
continue;
}
@@ -4701,9 +4848,11 @@ bool ResTable::stringToValue(Res_value* outValue, String16* outString,
rid = Res_MAKEID(
accessor->getRemappedPackage(Res_GETPACKAGE(rid)),
Res_GETTYPE(rid), Res_GETENTRY(rid));
- TABLE_NOISY(printf("Incl %s:%s/%s: 0x%08x\n",
- String8(package).string(), String8(type).string(),
- String8(name).string(), rid));
+ if (kDebugTableNoisy) {
+ ALOGI("Incl %s:%s/%s: 0x%08x\n",
+ String8(package).string(), String8(type).string(),
+ String8(name).string(), rid);
+ }
}
uint32_t packageId = Res_GETPACKAGE(rid) + 1;
@@ -4718,9 +4867,11 @@ bool ResTable::stringToValue(Res_value* outValue, String16* outString,
uint32_t rid = accessor->getCustomResourceWithCreation(package, type, name,
createIfNotFound);
if (rid != 0) {
- TABLE_NOISY(printf("Pckg %s:%s/%s: 0x%08x\n",
- String8(package).string(), String8(type).string(),
- String8(name).string(), rid));
+ if (kDebugTableNoisy) {
+ ALOGI("Pckg %s:%s/%s: 0x%08x\n",
+ String8(package).string(), String8(type).string(),
+ String8(name).string(), rid);
+ }
uint32_t packageId = Res_GETPACKAGE(rid) + 1;
if (packageId == 0x00) {
outValue->data = rid;
@@ -5523,8 +5674,6 @@ status_t ResTable::getEntry(
}
// Check if there is the desired entry in this type.
- const uint8_t* const end = reinterpret_cast<const uint8_t*>(thisType)
- + dtohl(thisType->header.size);
const uint32_t* const eindex = reinterpret_cast<const uint32_t*>(
reinterpret_cast<const uint8_t*>(thisType) + dtohs(thisType->header.headerSize));
@@ -5713,9 +5862,11 @@ status_t ResTable::parsePackage(const ResTable_package* const pkg,
const uint8_t* endPos = ((const uint8_t*)pkg) + dtohs(pkg->header.size);
while (((const uint8_t*)chunk) <= (endPos-sizeof(ResChunk_header)) &&
((const uint8_t*)chunk) <= (endPos-dtohl(chunk->size))) {
- TABLE_NOISY(ALOGV("PackageChunk: type=0x%x, headerSize=0x%x, size=0x%x, pos=%p\n",
- dtohs(chunk->type), dtohs(chunk->headerSize), dtohl(chunk->size),
- (void*)(((const uint8_t*)chunk) - ((const uint8_t*)header->header))));
+ if (kDebugTableNoisy) {
+ ALOGV("PackageChunk: type=0x%x, headerSize=0x%x, size=0x%x, pos=%p\n",
+ dtohs(chunk->type), dtohs(chunk->headerSize), dtohl(chunk->size),
+ (void*)(((const uint8_t*)chunk) - ((const uint8_t*)header->header)));
+ }
const size_t csize = dtohl(chunk->size);
const uint16_t ctype = dtohs(chunk->type);
if (ctype == RES_TABLE_TYPE_SPEC_TYPE) {
@@ -5729,11 +5880,13 @@ status_t ResTable::parsePackage(const ResTable_package* const pkg,
const size_t typeSpecSize = dtohl(typeSpec->header.size);
const size_t newEntryCount = dtohl(typeSpec->entryCount);
- LOAD_TABLE_NOISY(printf("TypeSpec off %p: type=0x%x, headerSize=0x%x, size=%p\n",
- (void*)(base-(const uint8_t*)chunk),
- dtohs(typeSpec->header.type),
- dtohs(typeSpec->header.headerSize),
- (void*)typeSpecSize));
+ if (kDebugLoadTableNoisy) {
+ ALOGI("TypeSpec off %p: type=0x%x, headerSize=0x%x, size=%p\n",
+ (void*)(base-(const uint8_t*)chunk),
+ dtohs(typeSpec->header.type),
+ dtohs(typeSpec->header.headerSize),
+ (void*)typeSpecSize);
+ }
// look for block overrun or int overflow when multiplying by 4
if ((dtohl(typeSpec->entryCount) > (INT32_MAX/sizeof(uint32_t))
|| dtohs(typeSpec->header.headerSize)+(sizeof(uint32_t)*newEntryCount)
@@ -5791,13 +5944,14 @@ status_t ResTable::parsePackage(const ResTable_package* const pkg,
const uint32_t typeSize = dtohl(type->header.size);
const size_t newEntryCount = dtohl(type->entryCount);
- LOAD_TABLE_NOISY(printf("Type off %p: type=0x%x, headerSize=0x%x, size=%p\n",
- (void*)(base-(const uint8_t*)chunk),
- dtohs(type->header.type),
- dtohs(type->header.headerSize),
- (void*)typeSize));
- if (dtohs(type->header.headerSize)+(sizeof(uint32_t)*newEntryCount)
- > typeSize) {
+ if (kDebugLoadTableNoisy) {
+ printf("Type off %p: type=0x%x, headerSize=0x%x, size=%u\n",
+ (void*)(base-(const uint8_t*)chunk),
+ dtohs(type->header.type),
+ dtohs(type->header.headerSize),
+ typeSize);
+ }
+ if (dtohs(type->header.headerSize)+(sizeof(uint32_t)*newEntryCount) > typeSize) {
ALOGW("ResTable_type entry index to %p extends beyond chunk end 0x%x.",
(void*)(dtohs(type->header.headerSize) + (sizeof(uint32_t)*newEntryCount)),
typeSize);
@@ -5843,11 +5997,12 @@ status_t ResTable::parsePackage(const ResTable_package* const pkg,
t->configs.add(type);
- TABLE_GETENTRY(
+ if (kDebugTableGetEntry) {
ResTable_config thisConfig;
thisConfig.copyFromDtoH(type->config);
- ALOGI("Adding config to type %d: %s\n",
- type->id, thisConfig.toString().string()));
+ ALOGI("Adding config to type %d: %s\n", type->id,
+ thisConfig.toString().string());
+ }
} else {
ALOGV("Skipping empty ResTable_type for type %d", type->id);
}
@@ -5908,8 +6063,10 @@ status_t DynamicRefTable::load(const ResTable_lib_header* const header)
uint32_t packageId = dtohl(entry->packageId);
char16_t tmpName[sizeof(entry->packageName) / sizeof(char16_t)];
strcpy16_dtoh(tmpName, entry->packageName, sizeof(entry->packageName) / sizeof(char16_t));
- LIB_NOISY(ALOGV("Found lib entry %s with id %d\n", String8(tmpName).string(),
- dtohl(entry->packageId)));
+ if (kDebugLibNoisy) {
+ ALOGV("Found lib entry %s with id %d\n", String8(tmpName).string(),
+ dtohl(entry->packageId));
+ }
if (packageId >= 256) {
ALOGE("Bad package id 0x%08x", packageId);
return UNKNOWN_ERROR;
@@ -6092,20 +6249,20 @@ status_t ResTable::createIdmap(const ResTable& overlay,
if (Res_GETTYPE(overlayResID) + 1 != static_cast<size_t>(typeMap.overlayTypeId)) {
ALOGE("idmap: can't mix type ids in entry map. Resource 0x%08x maps to 0x%08x"
- " but entries should map to resources of type %02x",
+ " but entries should map to resources of type %02zx",
resID, overlayResID, typeMap.overlayTypeId);
return BAD_TYPE;
}
if (typeMap.entryOffset + typeMap.entryMap.size() < entryIndex) {
- // Resize to accomodate this entry and the 0's in between.
- if (typeMap.entryMap.resize((entryIndex - typeMap.entryOffset) + 1) < 0) {
+ // pad with 0xffffffff's (indicating non-existing entries) before adding this entry
+ size_t index = typeMap.entryMap.size();
+ size_t numItems = entryIndex - (typeMap.entryOffset + index);
+ if (typeMap.entryMap.insertAt(0xffffffff, index, numItems) < 0) {
return NO_MEMORY;
}
- typeMap.entryMap.editTop() = Res_GETENTRY(overlayResID);
- } else {
- typeMap.entryMap.add(Res_GETENTRY(overlayResID));
}
+ typeMap.entryMap.add(Res_GETENTRY(overlayResID));
}
if (!typeMap.entryMap.isEmpty()) {
@@ -6428,9 +6585,6 @@ void ResTable::print(bool inclValues) const
continue;
}
for (size_t entryIndex=0; entryIndex<entryCount; entryIndex++) {
-
- const uint8_t* const end = ((const uint8_t*)type)
- + dtohl(type->header.size);
const uint32_t* const eindex = (const uint32_t*)
(((const uint8_t*)type) + dtohs(type->header.headerSize));
diff --git a/libs/androidfw/StreamingZipInflater.cpp b/libs/androidfw/StreamingZipInflater.cpp
index 1dfec23..b39b5f0 100644
--- a/libs/androidfw/StreamingZipInflater.cpp
+++ b/libs/androidfw/StreamingZipInflater.cpp
@@ -41,6 +41,8 @@
_rc; })
#endif
+static const bool kIsDebug = false;
+
static inline size_t min_of(size_t a, size_t b) { return (a < b) ? a : b; }
using namespace android;
@@ -209,7 +211,9 @@ int StreamingZipInflater::readNextChunk() {
size_t toRead = min_of(mInBufSize, mInTotalSize - mInNextChunkOffset);
if (toRead > 0) {
ssize_t didRead = TEMP_FAILURE_RETRY(::read(mFd, mInBuf, toRead));
- //ALOGV("Reading input chunk, size %08x didread %08x", toRead, didRead);
+ if (kIsDebug) {
+ ALOGV("Reading input chunk, size %08zx didread %08zx", toRead, didRead);
+ }
if (didRead < 0) {
ALOGE("Error reading asset data: %s", strerror(errno));
return didRead;
diff --git a/libs/androidfw/ZipFileRO.cpp b/libs/androidfw/ZipFileRO.cpp
index 1ab18ad..ef0d072 100644
--- a/libs/androidfw/ZipFileRO.cpp
+++ b/libs/androidfw/ZipFileRO.cpp
@@ -34,14 +34,6 @@
#include <assert.h>
#include <unistd.h>
-/*
- * We must open binary files using open(path, ... | O_BINARY) under Windows.
- * Otherwise strange read errors will happen.
- */
-#ifndef O_BINARY
-# define O_BINARY 0
-#endif
-
using namespace android;
class _ZipEntryRO {
@@ -50,7 +42,10 @@ public:
ZipEntryName name;
void *cookie;
- _ZipEntryRO() : cookie(NULL) {
+ _ZipEntryRO() : cookie(NULL) {}
+
+ ~_ZipEntryRO() {
+ EndIteration(cookie);
}
private:
@@ -83,15 +78,15 @@ ZipFileRO::~ZipFileRO() {
ZipEntryRO ZipFileRO::findEntryByName(const char* entryName) const
{
_ZipEntryRO* data = new _ZipEntryRO;
- const int32_t error = FindEntry(mHandle, entryName, &(data->entry));
+
+ data->name = ZipEntryName(entryName);
+
+ const int32_t error = FindEntry(mHandle, data->name, &(data->entry));
if (error) {
delete data;
return NULL;
}
- data->name.name = entryName;
- data->name.name_length = strlen(entryName);
-
return (ZipEntryRO) data;
}
diff --git a/libs/androidfw/tests/Android.mk b/libs/androidfw/tests/Android.mk
index c1014be..58b78b5 100644
--- a/libs/androidfw/tests/Android.mk
+++ b/libs/androidfw/tests/Android.mk
@@ -38,12 +38,17 @@ testFiles := \
include $(CLEAR_VARS)
LOCAL_MODULE := libandroidfw_tests
+
+LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
+# gtest is broken.
+LOCAL_CFLAGS += -Wno-unnamed-type-template-args
+
LOCAL_SRC_FILES := $(testFiles)
LOCAL_STATIC_LIBRARIES := \
libandroidfw \
libutils \
libcutils \
- liblog
+ liblog
include $(BUILD_HOST_NATIVE_TEST)
@@ -55,6 +60,11 @@ ifneq ($(SDK_ONLY),true)
include $(CLEAR_VARS)
LOCAL_MODULE := libandroidfw_tests
+
+LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
+# gtest is broken.
+LOCAL_CFLAGS += -Wno-unnamed-type-template-args
+
LOCAL_SRC_FILES := $(testFiles) \
BackupData_test.cpp \
ObbFile_test.cpp
@@ -63,7 +73,6 @@ LOCAL_SHARED_LIBRARIES := \
libcutils \
libutils \
libui \
- libstlport
include $(BUILD_NATIVE_TEST)
endif # Not SDK_ONLY
diff --git a/libs/common_time/Android.mk b/libs/common_time/Android.mk
index 75eb528..1fec504 100644
--- a/libs/common_time/Android.mk
+++ b/libs/common_time/Android.mk
@@ -33,4 +33,6 @@ LOCAL_SHARED_LIBRARIES := \
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := common_time
+LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
+
include $(BUILD_EXECUTABLE)
diff --git a/libs/common_time/clock_recovery.cpp b/libs/common_time/clock_recovery.cpp
index 3a7c70c..392caa0 100644
--- a/libs/common_time/clock_recovery.cpp
+++ b/libs/common_time/clock_recovery.cpp
@@ -22,6 +22,7 @@
#define __STDC_LIMIT_MACROS
#define LOG_TAG "common_time"
#include <utils/Log.h>
+#include <inttypes.h>
#include <stdint.h>
#include <common_time/local_clock.h>
@@ -280,7 +281,7 @@ bool ClockRecoveryLoop::pushDisciplineEvent(int64_t local_time,
// system.
setTargetCorrection_l(tgt_correction);
- LOG_TS("clock_loop %lld %f %f %f %d\n", raw_delta, delta_f, CO, CObias, tgt_correction);
+ LOG_TS("clock_loop %" PRId64 " %f %f %f %d\n", raw_delta, delta_f, CO, CObias, tgt_correction);
#ifdef TIME_SERVICE_DEBUG
diag_thread_->pushDisciplineEvent(
@@ -335,7 +336,6 @@ void ClockRecoveryLoop::setTargetCorrection_l(int32_t tgt) {
// 300mSec.
if (tgt_correction_ != tgt) {
int64_t now = local_clock_->getLocalTime();
- status_t res;
tgt_correction_ = tgt;
diff --git a/libs/common_time/clock_recovery.h b/libs/common_time/clock_recovery.h
index b6c87ff..278a75e 100644
--- a/libs/common_time/clock_recovery.h
+++ b/libs/common_time/clock_recovery.h
@@ -111,7 +111,6 @@ class ClockRecoveryLoop {
bool last_error_est_valid_;
int32_t last_error_est_usec_;
float last_delta_f_;
- int32_t integrated_error_;
int32_t tgt_correction_;
int32_t cur_correction_;
LinearTransform time_to_cur_slew_;
diff --git a/libs/common_time/common_clock.cpp b/libs/common_time/common_clock.cpp
index c9eb388..ee326e1 100644
--- a/libs/common_time/common_clock.cpp
+++ b/libs/common_time/common_clock.cpp
@@ -19,6 +19,7 @@
#define LOG_TAG "common_time"
#include <utils/Log.h>
+#include <inttypes.h>
#include <stdint.h>
#include <utils/Errors.h>
@@ -50,7 +51,7 @@ bool CommonClock::init(uint64_t local_freq) {
LinearTransform::reduce(&numer, &denom);
if ((numer > UINT32_MAX) || (denom > UINT32_MAX)) {
- ALOGE("Overflow in CommonClock::init while trying to reduce %lld/%lld",
+ ALOGE("Overflow in CommonClock::init while trying to reduce %" PRIu64 "/%" PRIu64,
kCommonFreq, local_freq);
return false;
}
diff --git a/libs/common_time/common_clock_service.cpp b/libs/common_time/common_clock_service.cpp
index 9ca6f35..592ab1d 100644
--- a/libs/common_time/common_clock_service.cpp
+++ b/libs/common_time/common_clock_service.cpp
@@ -99,14 +99,14 @@ status_t CommonClockService::registerListener(
Mutex::Autolock lock(mCallbackLock);
// check whether this is a duplicate
for (size_t i = 0; i < mListeners.size(); i++) {
- if (mListeners[i]->asBinder() == listener->asBinder())
+ if (IInterface::asBinder(mListeners[i]) == IInterface::asBinder(listener))
return ALREADY_EXISTS;
}
}
mListeners.add(listener);
mTimeServer.reevaluateAutoDisableState(0 != mListeners.size());
- return listener->asBinder()->linkToDeath(this);
+ return IInterface::asBinder(listener)->linkToDeath(this);
}
status_t CommonClockService::unregisterListener(
@@ -117,8 +117,8 @@ status_t CommonClockService::unregisterListener(
{ // scoping for autolock pattern
Mutex::Autolock lock(mCallbackLock);
for (size_t i = 0; i < mListeners.size(); i++) {
- if (mListeners[i]->asBinder() == listener->asBinder()) {
- mListeners[i]->asBinder()->unlinkToDeath(this);
+ if (IInterface::asBinder(mListeners[i]) == IInterface::asBinder(listener)) {
+ IInterface::asBinder(mListeners[i])->unlinkToDeath(this);
mListeners.removeAt(i);
ret_val = OK;
break;
@@ -136,7 +136,7 @@ void CommonClockService::binderDied(const wp<IBinder>& who) {
{ // scoping for autolock pattern
Mutex::Autolock lock(mCallbackLock);
for (size_t i = 0; i < mListeners.size(); i++) {
- if (mListeners[i]->asBinder() == who) {
+ if (IInterface::asBinder(mListeners[i]) == who) {
mListeners.removeAt(i);
break;
}
diff --git a/libs/common_time/common_time_server.cpp b/libs/common_time/common_time_server.cpp
index 3e11987..01372e0 100644
--- a/libs/common_time/common_time_server.cpp
+++ b/libs/common_time/common_time_server.cpp
@@ -25,6 +25,7 @@
#include <arpa/inet.h>
#include <assert.h>
#include <fcntl.h>
+#include <inttypes.h>
#include <linux/if_ether.h>
#include <net/if.h>
#include <net/if_arp.h>
@@ -969,13 +970,14 @@ bool CommonTimeServer::handleSyncResponse(
// if the RTT of the packet is significantly larger than the panic
// threshold, we should simply discard it. Its better to do nothing
// than to take cues from a packet like that.
- int rttCommon = mCommonClock.localDurationToCommonDuration(rtt);
+ int64_t rttCommon = mCommonClock.localDurationToCommonDuration(rtt);
if (rttCommon > (static_cast<int64_t>(mPanicThresholdUsec) *
kRTTDiscardPanicThreshMultiplier)) {
- ALOGV("Dropping sync response with RTT of %lld uSec", rttCommon);
+ ALOGV("Dropping sync response with RTT of %" PRId64 " uSec", rttCommon);
mClient_ExpiredSyncRespsRXedFromCurMaster++;
if (shouldPanicNotGettingGoodData())
return becomeInitial("RX panic, no good data");
+ return true;
} else {
result = mClockRecovery.pushDisciplineEvent(avgLocal, avgCommon, rttCommon);
mClient_LastGoodSyncRX = clientRxLocalTime;
diff --git a/libs/common_time/common_time_server_api.cpp b/libs/common_time/common_time_server_api.cpp
index e157071..e0f35a9 100644
--- a/libs/common_time/common_time_server_api.cpp
+++ b/libs/common_time/common_time_server_api.cpp
@@ -27,6 +27,8 @@
#include "common_time_server.h"
+#include <inttypes.h>
+
namespace android {
//
@@ -286,7 +288,7 @@ void CommonTimeServer::reevaluateAutoDisableState(bool commonClockHasClients) {
#define checked_percentage(a, b) ((0 == b) ? 0.0f : ((100.0f * a) / b))
status_t CommonTimeServer::dumpClockInterface(int fd,
- const Vector<String16>& args,
+ const Vector<String16>& /* args */,
size_t activeClients) {
AutoMutex _lock(&mLock);
const size_t SIZE = 256;
@@ -308,15 +310,15 @@ status_t CommonTimeServer::dumpClockInterface(int fd,
synced = (OK == mCommonClock.localToCommon(localTime, &commonTime));
sockaddrToString(mMasterEP, mMasterEPValid, maStr, sizeof(maStr));
- dump_printf("Common Clock Service Status\nLocal time : %lld\n",
+ dump_printf("Common Clock Service Status\nLocal time : %" PRId64 "\n",
localTime);
if (synced)
- dump_printf("Common time : %lld\n", commonTime);
+ dump_printf("Common time : %" PRId64 "\n", commonTime);
else
dump_printf("Common time : %s\n", "not synced");
- dump_printf("Timeline ID : %016llx\n", mTimelineID);
+ dump_printf("Timeline ID : %016" PRIu64 "\n", mTimelineID);
dump_printf("State : %s\n", stateToString(mState));
dump_printf("Master Addr : %s\n", maStr);
@@ -349,10 +351,10 @@ status_t CommonTimeServer::dumpClockInterface(int fd,
int64_t localDelta, usecDelta;
localDelta = localTime - mClient_LastGoodSyncRX;
usecDelta = mCommonClock.localDurationToCommonDuration(localDelta);
- dump_printf("Last Good RX : %lld uSec ago\n", usecDelta);
+ dump_printf("Last Good RX : %" PRId64 " uSec ago\n", usecDelta);
}
- dump_printf("Active Clients : %u\n", activeClients);
+ dump_printf("Active Clients : %zu\n", activeClients);
mClient_PacketRTTLog.dumpLog(fd, mCommonClock);
mStateChangeLog.dumpLog(fd);
mElectionLog.dumpLog(fd);
@@ -363,7 +365,7 @@ status_t CommonTimeServer::dumpClockInterface(int fd,
}
status_t CommonTimeServer::dumpConfigInterface(int fd,
- const Vector<String16>& args) {
+ const Vector<String16>& /* args */) {
AutoMutex _lock(&mLock);
const size_t SIZE = 256;
char buffer[SIZE];
@@ -383,7 +385,7 @@ status_t CommonTimeServer::dumpConfigInterface(int fd,
"Bound Interface : %s\n",
mBindIfaceValid ? mBindIface.string() : "<unbound>");
dump_printf("Master Election Endpoint : %s\n", meStr);
- dump_printf("Master Election Group ID : %016llx\n", mSyncGroupID);
+ dump_printf("Master Election Group ID : %016" PRIu64 "\n", mSyncGroupID);
dump_printf("Master Announce Interval : %d mSec\n",
mMasterAnnounceIntervalMs);
dump_printf("Client Sync Interval : %d mSec\n",
@@ -419,12 +421,12 @@ void CommonTimeServer::PacketRTTLog::dumpLog(int fd, const CommonClock& cclk) {
if (rxTimes[i]) {
int64_t delta = rxTimes[i] - txTimes[i];
int64_t deltaUsec = cclk.localDurationToCommonDuration(delta);
- dump_printf("pkt[%2d] : localTX %12lld localRX %12lld "
+ dump_printf("pkt[%2d] : localTX %12" PRId64 " localRX %12" PRId64 " "
"(%.3f msec RTT)\n",
ndx, txTimes[i], rxTimes[i],
static_cast<float>(deltaUsec) / 1000.0);
} else {
- dump_printf("pkt[%2d] : localTX %12lld localRX never\n",
+ dump_printf("pkt[%2d] : localTX %12" PRId64 " localRX never\n",
ndx, txTimes[i]);
}
i = (i + 1) % RTT_LOG_SIZE;
diff --git a/libs/common_time/main.cpp b/libs/common_time/main.cpp
index 49eb30a..ac52c85 100644
--- a/libs/common_time/main.cpp
+++ b/libs/common_time/main.cpp
@@ -27,7 +27,7 @@
#include "common_time_server.h"
-int main(int argc, char *argv[]) {
+int main() {
using namespace android;
sp<CommonTimeServer> service = new CommonTimeServer();
diff --git a/libs/hwui/AmbientShadow.cpp b/libs/hwui/AmbientShadow.cpp
index 21c869b..13de0a6 100644
--- a/libs/hwui/AmbientShadow.cpp
+++ b/libs/hwui/AmbientShadow.cpp
@@ -121,14 +121,14 @@ inline void computeBufferSize(int* totalVertexCount, int* totalIndexCount,
*totalUmbraCount = 0;
if (!isCasterOpaque) {
// Add the centroid if occluder is translucent.
- *totalVertexCount++;
+ (*totalVertexCount)++;
*totalIndexCount += 2 * innerVertexCount + 1;
*totalUmbraCount = innerVertexCount;
}
}
inline bool needsExtraForEdge(float firstAlpha, float secondAlpha) {
- return abs(firstAlpha - secondAlpha) > ALPHA_THRESHOLD;
+ return fabsf(firstAlpha - secondAlpha) > ALPHA_THRESHOLD;
}
/**
diff --git a/libs/hwui/Android.mk b/libs/hwui/Android.mk
index 49560ff..d0b9d82 100644
--- a/libs/hwui/Android.mk
+++ b/libs/hwui/Android.mk
@@ -1,110 +1,119 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
+
+# Too many unused parameters in external/skia/include and this directory.
+# getConfig in external/skia/include/core/SkBitmap.h is deprecated.
+# Allow Gnu extension: in-class initializer of static 'const float' member.
+LOCAL_CLANG_CFLAGS += \
+ -Wno-gnu-static-float-init
# Only build libhwui when USE_OPENGL_RENDERER is
# defined in the current device/board configuration
ifeq ($(USE_OPENGL_RENDERER),true)
- LOCAL_SRC_FILES := \
- utils/Blur.cpp \
- utils/GLUtils.cpp \
- utils/SortedListImpl.cpp \
- thread/TaskManager.cpp \
- font/CacheTexture.cpp \
- font/Font.cpp \
- AmbientShadow.cpp \
- AnimationContext.cpp \
- Animator.cpp \
- AnimatorManager.cpp \
- AssetAtlas.cpp \
- DamageAccumulator.cpp \
- FontRenderer.cpp \
- GammaFontRenderer.cpp \
- Caches.cpp \
- DisplayList.cpp \
- DeferredDisplayList.cpp \
- DeferredLayerUpdater.cpp \
- DisplayListLogBuffer.cpp \
- DisplayListRenderer.cpp \
- Dither.cpp \
- DrawProfiler.cpp \
- Extensions.cpp \
- FboCache.cpp \
- GradientCache.cpp \
- Image.cpp \
- Interpolator.cpp \
- Layer.cpp \
- LayerCache.cpp \
- LayerRenderer.cpp \
- Matrix.cpp \
- OpenGLRenderer.cpp \
- Patch.cpp \
- PatchCache.cpp \
- PathCache.cpp \
- PathTessellator.cpp \
- PixelBuffer.cpp \
- Program.cpp \
- ProgramCache.cpp \
- RenderBufferCache.cpp \
- RenderNode.cpp \
- RenderProperties.cpp \
- RenderState.cpp \
- ResourceCache.cpp \
- ShadowTessellator.cpp \
- SkiaShader.cpp \
- Snapshot.cpp \
- SpotShadow.cpp \
- StatefulBaseRenderer.cpp \
- Stencil.cpp \
- TessellationCache.cpp \
- Texture.cpp \
- TextureCache.cpp \
- TextDropShadowCache.cpp
+ LOCAL_SRC_FILES := \
+ utils/Blur.cpp \
+ utils/GLUtils.cpp \
+ utils/SortedListImpl.cpp \
+ thread/TaskManager.cpp \
+ font/CacheTexture.cpp \
+ font/Font.cpp \
+ AmbientShadow.cpp \
+ AnimationContext.cpp \
+ Animator.cpp \
+ AnimatorManager.cpp \
+ AssetAtlas.cpp \
+ DamageAccumulator.cpp \
+ FontRenderer.cpp \
+ GammaFontRenderer.cpp \
+ Caches.cpp \
+ DisplayList.cpp \
+ DeferredDisplayList.cpp \
+ DeferredLayerUpdater.cpp \
+ DisplayListLogBuffer.cpp \
+ DisplayListRenderer.cpp \
+ Dither.cpp \
+ DrawProfiler.cpp \
+ Extensions.cpp \
+ FboCache.cpp \
+ GradientCache.cpp \
+ Image.cpp \
+ Interpolator.cpp \
+ Layer.cpp \
+ LayerCache.cpp \
+ LayerRenderer.cpp \
+ Matrix.cpp \
+ OpenGLRenderer.cpp \
+ Patch.cpp \
+ PatchCache.cpp \
+ PathCache.cpp \
+ PathTessellator.cpp \
+ PixelBuffer.cpp \
+ Program.cpp \
+ ProgramCache.cpp \
+ RenderBufferCache.cpp \
+ RenderNode.cpp \
+ RenderProperties.cpp \
+ RenderState.cpp \
+ ResourceCache.cpp \
+ ShadowTessellator.cpp \
+ SkiaShader.cpp \
+ Snapshot.cpp \
+ SpotShadow.cpp \
+ StatefulBaseRenderer.cpp \
+ Stencil.cpp \
+ TessellationCache.cpp \
+ Texture.cpp \
+ TextureCache.cpp \
+ TextDropShadowCache.cpp
# RenderThread stuff
- LOCAL_SRC_FILES += \
- renderthread/CanvasContext.cpp \
- renderthread/DrawFrameTask.cpp \
- renderthread/EglManager.cpp \
- renderthread/RenderProxy.cpp \
- renderthread/RenderTask.cpp \
- renderthread/RenderThread.cpp \
- renderthread/TimeLord.cpp
+ LOCAL_SRC_FILES += \
+ renderthread/CanvasContext.cpp \
+ renderthread/DrawFrameTask.cpp \
+ renderthread/EglManager.cpp \
+ renderthread/RenderProxy.cpp \
+ renderthread/RenderTask.cpp \
+ renderthread/RenderThread.cpp \
+ renderthread/TimeLord.cpp
+
+ intermediates := $(call intermediates-dir-for,STATIC_LIBRARIES,libRS,TARGET,)
- intermediates := $(call intermediates-dir-for,STATIC_LIBRARIES,libRS,TARGET,)
+ LOCAL_C_INCLUDES += \
+ external/skia/src/core
- LOCAL_C_INCLUDES += \
- external/skia/src/core
+ LOCAL_CFLAGS += -DUSE_OPENGL_RENDERER -DEGL_EGLEXT_PROTOTYPES -DGL_GLEXT_PROTOTYPES
+ LOCAL_CFLAGS += -Wno-unused-parameter
+ LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+ LOCAL_SHARED_LIBRARIES := liblog libcutils libutils libEGL libGLESv2 libskia libui libgui
+ LOCAL_MODULE := libhwui
+ LOCAL_MODULE_TAGS := optional
- LOCAL_CFLAGS += -DUSE_OPENGL_RENDERER -DEGL_EGLEXT_PROTOTYPES -DGL_GLEXT_PROTOTYPES
- LOCAL_CFLAGS += -Wno-unused-parameter
- LOCAL_MODULE_CLASS := SHARED_LIBRARIES
- LOCAL_SHARED_LIBRARIES := liblog libcutils libutils libEGL libGLESv2 libskia libui libgui
- LOCAL_MODULE := libhwui
- LOCAL_MODULE_TAGS := optional
+ ifneq (false,$(ANDROID_ENABLE_RENDERSCRIPT))
+ LOCAL_CFLAGS += -DANDROID_ENABLE_RENDERSCRIPT
+ LOCAL_SHARED_LIBRARIES += libRS libRScpp
+ LOCAL_C_INCLUDES += \
+ $(intermediates) \
+ frameworks/rs/cpp \
+ frameworks/rs \
- include external/stlport/libstlport.mk
+ endif
- ifneq (false,$(ANDROID_ENABLE_RENDERSCRIPT))
- LOCAL_CFLAGS += -DANDROID_ENABLE_RENDERSCRIPT
- LOCAL_SHARED_LIBRARIES += libRS libRScpp
- LOCAL_C_INCLUDES += \
- $(intermediates) \
- frameworks/rs/cpp \
- frameworks/rs
- endif
+ ifndef HWUI_COMPILE_SYMBOLS
+ LOCAL_CFLAGS += -fvisibility=hidden
+ endif
- ifndef HWUI_COMPILE_SYMBOLS
- LOCAL_CFLAGS += -fvisibility=hidden
- endif
+ ifdef HWUI_COMPILE_FOR_PERF
+ # TODO: Non-arm?
+ LOCAL_CFLAGS += -fno-omit-frame-pointer -marm -mapcs
+ endif
- ifdef HWUI_COMPILE_FOR_PERF
- LOCAL_CFLAGS += -fno-omit-frame-pointer -marm -mapcs
- endif
+ # Defaults for ATRACE_TAG and LOG_TAG for libhwui
+ LOCAL_CFLAGS += -DATRACE_TAG=ATRACE_TAG_VIEW -DLOG_TAG=\"OpenGLRenderer\"
- # Defaults for ATRACE_TAG and LOG_TAG for libhwui
- LOCAL_CFLAGS += -DATRACE_TAG=ATRACE_TAG_VIEW -DLOG_TAG=\"OpenGLRenderer\"
+ LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
- include $(BUILD_SHARED_LIBRARY)
+ include $(BUILD_SHARED_LIBRARY)
- include $(call all-makefiles-under,$(LOCAL_PATH))
+ include $(call all-makefiles-under,$(LOCAL_PATH))
endif
diff --git a/libs/hwui/AnimationContext.cpp b/libs/hwui/AnimationContext.cpp
index a20bdae..d2152ca 100644
--- a/libs/hwui/AnimationContext.cpp
+++ b/libs/hwui/AnimationContext.cpp
@@ -54,7 +54,7 @@ void AnimationContext::addAnimationHandle(AnimationHandle* handle) {
handle->insertAfter(&mNextFrameAnimations);
}
-void AnimationContext::startFrame(TreeInfo::TraversalMode mode) {
+void AnimationContext::startFrame(TreeInfo::TraversalMode /* mode */) {
LOG_ALWAYS_FATAL_IF(mCurrentFrameAnimations.mNextHandle,
"Missed running animations last frame!");
AnimationHandle* head = mNextFrameAnimations.mNextHandle;
diff --git a/libs/hwui/Animator.cpp b/libs/hwui/Animator.cpp
index 8bf2107..71b7476 100644
--- a/libs/hwui/Animator.cpp
+++ b/libs/hwui/Animator.cpp
@@ -245,11 +245,11 @@ CanvasPropertyPrimitiveAnimator::CanvasPropertyPrimitiveAnimator(
, mProperty(property) {
}
-float CanvasPropertyPrimitiveAnimator::getValue(RenderNode* target) const {
+float CanvasPropertyPrimitiveAnimator::getValue(RenderNode* /* target */) const {
return mProperty->value;
}
-void CanvasPropertyPrimitiveAnimator::setValue(RenderNode* target, float value) {
+void CanvasPropertyPrimitiveAnimator::setValue(RenderNode* /* target */, float value) {
mProperty->value = value;
}
@@ -268,7 +268,7 @@ CanvasPropertyPaintAnimator::CanvasPropertyPaintAnimator(
, mField(field) {
}
-float CanvasPropertyPaintAnimator::getValue(RenderNode* target) const {
+float CanvasPropertyPaintAnimator::getValue(RenderNode* /* target */) const {
switch (mField) {
case STROKE_WIDTH:
return mProperty->value.getStrokeWidth();
@@ -284,7 +284,7 @@ static uint8_t to_uint8(float value) {
return static_cast<uint8_t>( c < 0 ? 0 : c > 255 ? 255 : c );
}
-void CanvasPropertyPaintAnimator::setValue(RenderNode* target, float value) {
+void CanvasPropertyPaintAnimator::setValue(RenderNode* /* target */, float value) {
switch (mField) {
case STROKE_WIDTH:
mProperty->value.setStrokeWidth(value);
diff --git a/libs/hwui/Caches.h b/libs/hwui/Caches.h
index e338686..d3266f7 100644
--- a/libs/hwui/Caches.h
+++ b/libs/hwui/Caches.h
@@ -384,13 +384,13 @@ private:
bool bindIndicesBufferInternal(const GLuint buffer);
- static void eventMarkNull(GLsizei length, const GLchar* marker) { }
- static void startMarkNull(GLsizei length, const GLchar* marker) { }
+ static void eventMarkNull(GLsizei /* length */, const GLchar* /* marker */) { }
+ static void startMarkNull(GLsizei /* length */, const GLchar* /* marker */) { }
static void endMarkNull() { }
- static void setLabelNull(GLenum type, uint object, GLsizei length,
- const char* label) { }
- static void getLabelNull(GLenum type, uint object, GLsizei bufferSize,
+ static void setLabelNull(GLenum /* type */, uint /* object */, GLsizei /* length */,
+ const char* /* label */) { }
+ static void getLabelNull(GLenum /* type */, uint /* object */, GLsizei /* bufferSize */,
GLsizei* length, char* label) {
if (length) *length = 0;
if (label) *label = '\0';
diff --git a/libs/hwui/DeferredDisplayList.cpp b/libs/hwui/DeferredDisplayList.cpp
index fab4a1a..65fd47d 100644
--- a/libs/hwui/DeferredDisplayList.cpp
+++ b/libs/hwui/DeferredDisplayList.cpp
@@ -55,7 +55,7 @@ public:
virtual status_t replay(OpenGLRenderer& renderer, Rect& dirty, int index) = 0;
virtual ~Batch() {}
virtual bool purelyDrawBatch() { return false; }
- virtual bool coversBounds(const Rect& bounds) { return false; }
+ virtual bool coversBounds(const Rect& /* bounds */) { return false; }
};
class DrawBatch : public Batch {
@@ -91,7 +91,7 @@ public:
return false;
}
- virtual status_t replay(OpenGLRenderer& renderer, Rect& dirty, int index) {
+ virtual status_t replay(OpenGLRenderer& renderer, Rect& dirty, int /* index */) {
DEFER_LOGD("%d replaying DrawBatch %p, with %d ops (batch id %x, merge id %p)",
index, this, mOps.size(), getBatchId(), getMergeId());
@@ -269,7 +269,7 @@ public:
if (newClipSideFlags & kClipSide_Bottom) mClipRect.bottom = state->mClip.bottom;
}
- virtual status_t replay(OpenGLRenderer& renderer, Rect& dirty, int index) {
+ virtual status_t replay(OpenGLRenderer& renderer, Rect& dirty, int /* index */) {
DEFER_LOGD("%d replaying MergingDrawBatch %p, with %d ops,"
" clip flags %x (batch id %x, merge id %p)",
index, this, mOps.size(), mClipSideFlags, getBatchId(), getMergeId());
@@ -313,7 +313,7 @@ public:
// creates a single operation batch
StateOpBatch(const StateOp* op, const DeferredDisplayState* state) : mOp(op), mState(state) {}
- virtual status_t replay(OpenGLRenderer& renderer, Rect& dirty, int index) {
+ virtual status_t replay(OpenGLRenderer& renderer, Rect& /* dirty */, int /* index */) {
DEFER_LOGD("replaying state op batch %p", this);
renderer.restoreDisplayState(*mState);
@@ -332,10 +332,10 @@ private:
class RestoreToCountBatch : public Batch {
public:
- RestoreToCountBatch(const StateOp* op, const DeferredDisplayState* state, int restoreCount) :
- mOp(op), mState(state), mRestoreCount(restoreCount) {}
+ RestoreToCountBatch(const StateOp* /* op */, const DeferredDisplayState* state,
+ int restoreCount) : mState(state), mRestoreCount(restoreCount) {}
- virtual status_t replay(OpenGLRenderer& renderer, Rect& dirty, int index) {
+ virtual status_t replay(OpenGLRenderer& renderer, Rect& /* dirty */, int /* index */) {
DEFER_LOGD("batch %p restoring to count %d", this, mRestoreCount);
renderer.restoreDisplayState(*mState);
@@ -345,7 +345,6 @@ public:
private:
// we use the state storage for the RestoreToCountOp, but don't replay the op itself
- const StateOp* mOp;
const DeferredDisplayState* mState;
/*
@@ -699,7 +698,6 @@ void DeferredDisplayList::discardDrawingBatches(const unsigned int maxIndex) {
for (unsigned int i = mEarliestUnclearedIndex; i <= maxIndex; i++) {
// leave deferred state ops alone for simplicity (empty save restore pairs may now exist)
if (mBatches[i] && mBatches[i]->purelyDrawBatch()) {
- DrawBatch* b = (DrawBatch*) mBatches[i];
delete mBatches[i];
mBatches.replaceAt(NULL, i);
}
diff --git a/libs/hwui/DeferredDisplayList.h b/libs/hwui/DeferredDisplayList.h
index 885b411..9d02382 100644
--- a/libs/hwui/DeferredDisplayList.h
+++ b/libs/hwui/DeferredDisplayList.h
@@ -79,7 +79,7 @@ public:
};
class DeferredDisplayList {
- friend class DeferStateStruct; // used to give access to allocator
+ friend struct DeferStateStruct; // used to give access to allocator
public:
DeferredDisplayList(const Rect& bounds) :
mBounds(bounds) {
diff --git a/libs/hwui/DisplayList.h b/libs/hwui/DisplayList.h
index cb8a8d1..e15adf3 100644
--- a/libs/hwui/DisplayList.h
+++ b/libs/hwui/DisplayList.h
@@ -82,7 +82,7 @@ public:
LinearAllocator * const mAllocator;
SkPath* allocPathForFrame() {
- mTempPaths.push_back();
+ mTempPaths.push_back(SkPath());
return &mTempPaths.back();
}
@@ -91,8 +91,7 @@ private:
std::vector<SkPath> mTempPaths;
};
-class DeferStateStruct : public PlaybackStateStruct {
-public:
+struct DeferStateStruct : public PlaybackStateStruct {
DeferStateStruct(DeferredDisplayList& deferredList, OpenGLRenderer& renderer, int replayFlags)
: PlaybackStateStruct(renderer, replayFlags, &(deferredList.mAllocator)),
mDeferredList(deferredList) {}
diff --git a/libs/hwui/DisplayListLogBuffer.cpp b/libs/hwui/DisplayListLogBuffer.cpp
index 45aacca..bc9e7bd 100644
--- a/libs/hwui/DisplayListLogBuffer.cpp
+++ b/libs/hwui/DisplayListLogBuffer.cpp
@@ -80,7 +80,7 @@ void DisplayListLogBuffer::outputCommands(FILE *file)
fprintf(file, "%*s%s\n", 2 * tmpBufferPtr->level, "", tmpBufferPtr->label);
- OpLog* nextOp = tmpBufferPtr++;
+ tmpBufferPtr++;
if (tmpBufferPtr > mBufferLast) {
tmpBufferPtr = mBufferFirst;
}
diff --git a/libs/hwui/DisplayListOp.h b/libs/hwui/DisplayListOp.h
index d78c1cb..46016d9 100644
--- a/libs/hwui/DisplayListOp.h
+++ b/libs/hwui/DisplayListOp.h
@@ -63,7 +63,7 @@ public:
// These objects should always be allocated with a LinearAllocator, and never destroyed/deleted.
// standard new() intentionally not implemented, and delete/deconstructor should never be used.
virtual ~DisplayListOp() { CRASH(); }
- static void operator delete(void* ptr) { CRASH(); }
+ static void operator delete(void* /* ptr */) { CRASH(); }
/** static void* operator new(size_t size); PURPOSELY OMITTED **/
static void* operator new(size_t size, LinearAllocator& allocator) {
return allocator.alloc(size);
@@ -93,8 +93,8 @@ public:
virtual ~StateOp() {}
- virtual void defer(DeferStateStruct& deferStruct, int saveCount, int level,
- bool useQuickReject) {
+ virtual void defer(DeferStateStruct& deferStruct, int saveCount, int /* level */,
+ bool /* useQuickReject */) {
// default behavior only affects immediate, deferrable state, issue directly to renderer
applyState(deferStruct.mRenderer, saveCount);
}
@@ -103,8 +103,8 @@ public:
* State operations are applied directly to the renderer, but can cause the deferred drawing op
* list to flush
*/
- virtual void replay(ReplayStateStruct& replayStruct, int saveCount, int level,
- bool useQuickReject) {
+ virtual void replay(ReplayStateStruct& replayStruct, int saveCount, int /* level */,
+ bool /* useQuickReject */) {
applyState(replayStruct.mRenderer, saveCount);
}
@@ -117,7 +117,7 @@ public:
DrawOp(const SkPaint* paint)
: mPaint(paint), mQuickRejected(false) {}
- virtual void defer(DeferStateStruct& deferStruct, int saveCount, int level,
+ virtual void defer(DeferStateStruct& deferStruct, int /* saveCount */, int /* level */,
bool useQuickReject) {
if (mQuickRejected && CC_LIKELY(useQuickReject)) {
return;
@@ -126,7 +126,7 @@ public:
deferStruct.mDeferredList.addDrawOp(deferStruct.mRenderer, this);
}
- virtual void replay(ReplayStateStruct& replayStruct, int saveCount, int level,
+ virtual void replay(ReplayStateStruct& replayStruct, int /* saveCount */, int /* level */,
bool useQuickReject) {
if (mQuickRejected && CC_LIKELY(useQuickReject)) {
return;
@@ -145,7 +145,7 @@ public:
* reducing which operations are tagged as mergeable.
*/
virtual status_t multiDraw(OpenGLRenderer& renderer, Rect& dirty,
- const Vector<OpStatePair>& ops, const Rect& bounds) {
+ const Vector<OpStatePair>& ops, const Rect& /* bounds */) {
status_t status = DrawGlInfo::kStatusDone;
for (unsigned int i = 0; i < ops.size(); i++) {
renderer.restoreDisplayState(*(ops[i].state), true);
@@ -164,15 +164,15 @@ public:
*
* if a subclass can set deferInfo.mergeable to true, it should implement multiDraw()
*/
- virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& deferInfo,
- const DeferredDisplayState& state) {}
+ virtual void onDefer(OpenGLRenderer& /* renderer */, DeferInfo& /* deferInfo */,
+ const DeferredDisplayState& /* state */) {}
/**
* Query the conservative, local bounds (unmapped) bounds of the op.
*
* returns true if bounds exist
*/
- virtual bool getLocalBounds(Rect& localBounds) {
+ virtual bool getLocalBounds(Rect& /* localBounds */) {
return false;
}
@@ -285,17 +285,17 @@ public:
SaveOp(int flags)
: mFlags(flags) {}
- virtual void defer(DeferStateStruct& deferStruct, int saveCount, int level,
- bool useQuickReject) {
+ virtual void defer(DeferStateStruct& deferStruct, int /* saveCount */, int /* level */,
+ bool /* useQuickReject */) {
int newSaveCount = deferStruct.mRenderer.save(mFlags);
deferStruct.mDeferredList.addSave(deferStruct.mRenderer, this, newSaveCount);
}
- virtual void applyState(OpenGLRenderer& renderer, int saveCount) const {
+ virtual void applyState(OpenGLRenderer& renderer, int /* saveCount */) const {
renderer.save(mFlags);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("Save flags %x", mFlags);
}
@@ -311,8 +311,8 @@ public:
RestoreToCountOp(int count)
: mCount(count) {}
- virtual void defer(DeferStateStruct& deferStruct, int saveCount, int level,
- bool useQuickReject) {
+ virtual void defer(DeferStateStruct& deferStruct, int saveCount, int /* level */,
+ bool /* useQuickReject */) {
deferStruct.mDeferredList.addRestoreToCount(deferStruct.mRenderer,
this, saveCount + mCount);
deferStruct.mRenderer.restoreToCount(saveCount + mCount);
@@ -322,7 +322,7 @@ public:
renderer.restoreToCount(saveCount + mCount);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("Restore to count %d", mCount);
}
@@ -349,8 +349,8 @@ public:
, mConvexMask(NULL)
{}
- virtual void defer(DeferStateStruct& deferStruct, int saveCount, int level,
- bool useQuickReject) {
+ virtual void defer(DeferStateStruct& deferStruct, int /* saveCount */, int /* level */,
+ bool /* useQuickReject */) {
// NOTE: don't bother with actual saveLayer, instead issuing it at flush time
int newSaveCount = deferStruct.mRenderer.getSaveCount();
deferStruct.mDeferredList.addSaveLayer(deferStruct.mRenderer, this, newSaveCount);
@@ -361,12 +361,12 @@ public:
mPaint, mFlags);
}
- virtual void applyState(OpenGLRenderer& renderer, int saveCount) const {
+ virtual void applyState(OpenGLRenderer& renderer, int /* saveCount */) const {
renderer.saveLayer(mArea.left, mArea.top, mArea.right, mArea.bottom,
mPaint, mFlags, mConvexMask);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("SaveLayer%s of area " RECT_STRING,
(isSaveLayerAlpha() ? "Alpha" : ""),RECT_ARGS(mArea));
}
@@ -402,11 +402,11 @@ public:
TranslateOp(float dx, float dy)
: mDx(dx), mDy(dy) {}
- virtual void applyState(OpenGLRenderer& renderer, int saveCount) const {
+ virtual void applyState(OpenGLRenderer& renderer, int /* saveCount */) const {
renderer.translate(mDx, mDy);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("Translate by %f %f", mDx, mDy);
}
@@ -422,11 +422,11 @@ public:
RotateOp(float degrees)
: mDegrees(degrees) {}
- virtual void applyState(OpenGLRenderer& renderer, int saveCount) const {
+ virtual void applyState(OpenGLRenderer& renderer, int /* saveCount */) const {
renderer.rotate(mDegrees);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("Rotate by %f degrees", mDegrees);
}
@@ -441,11 +441,11 @@ public:
ScaleOp(float sx, float sy)
: mSx(sx), mSy(sy) {}
- virtual void applyState(OpenGLRenderer& renderer, int saveCount) const {
+ virtual void applyState(OpenGLRenderer& renderer, int /* saveCount */) const {
renderer.scale(mSx, mSy);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("Scale by %f %f", mSx, mSy);
}
@@ -461,11 +461,11 @@ public:
SkewOp(float sx, float sy)
: mSx(sx), mSy(sy) {}
- virtual void applyState(OpenGLRenderer& renderer, int saveCount) const {
+ virtual void applyState(OpenGLRenderer& renderer, int /* saveCount */) const {
renderer.skew(mSx, mSy);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("Skew by %f %f", mSx, mSy);
}
@@ -481,11 +481,11 @@ public:
SetMatrixOp(const SkMatrix& matrix)
: mMatrix(matrix) {}
- virtual void applyState(OpenGLRenderer& renderer, int saveCount) const {
+ virtual void applyState(OpenGLRenderer& renderer, int /* saveCount */) const {
renderer.setMatrix(mMatrix);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
if (mMatrix.isIdentity()) {
OP_LOGS("SetMatrix (reset)");
} else {
@@ -504,11 +504,11 @@ public:
ConcatMatrixOp(const SkMatrix& matrix)
: mMatrix(matrix) {}
- virtual void applyState(OpenGLRenderer& renderer, int saveCount) const {
+ virtual void applyState(OpenGLRenderer& renderer, int /* saveCount */) const {
renderer.concatMatrix(mMatrix);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("ConcatMatrix " SK_MATRIX_STRING, SK_MATRIX_ARGS(&mMatrix));
}
@@ -522,8 +522,8 @@ class ClipOp : public StateOp {
public:
ClipOp(SkRegion::Op op) : mOp(op) {}
- virtual void defer(DeferStateStruct& deferStruct, int saveCount, int level,
- bool useQuickReject) {
+ virtual void defer(DeferStateStruct& deferStruct, int saveCount, int /* level */,
+ bool /* useQuickReject */) {
// NOTE: must defer op BEFORE applying state, since it may read clip
deferStruct.mDeferredList.addClip(deferStruct.mRenderer, this);
@@ -546,11 +546,11 @@ public:
ClipRectOp(float left, float top, float right, float bottom, SkRegion::Op op)
: ClipOp(op), mArea(left, top, right, bottom) {}
- virtual void applyState(OpenGLRenderer& renderer, int saveCount) const {
+ virtual void applyState(OpenGLRenderer& renderer, int /* saveCount */) const {
renderer.clipRect(mArea.left, mArea.top, mArea.right, mArea.bottom, mOp);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("ClipRect " RECT_STRING, RECT_ARGS(mArea));
}
@@ -568,11 +568,11 @@ public:
ClipPathOp(const SkPath* path, SkRegion::Op op)
: ClipOp(op), mPath(path) {}
- virtual void applyState(OpenGLRenderer& renderer, int saveCount) const {
+ virtual void applyState(OpenGLRenderer& renderer, int /* saveCount */) const {
renderer.clipPath(mPath, mOp);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
SkRect bounds = mPath->getBounds();
OP_LOG("ClipPath bounds " RECT_STRING,
bounds.left(), bounds.top(), bounds.right(), bounds.bottom());
@@ -589,11 +589,11 @@ public:
ClipRegionOp(const SkRegion* region, SkRegion::Op op)
: ClipOp(op), mRegion(region) {}
- virtual void applyState(OpenGLRenderer& renderer, int saveCount) const {
+ virtual void applyState(OpenGLRenderer& renderer, int /* saveCount */) const {
renderer.clipRegion(mRegion, mOp);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
SkIRect bounds = mRegion->getBounds();
OP_LOG("ClipRegion bounds %d %d %d %d",
bounds.left(), bounds.top(), bounds.right(), bounds.bottom());
@@ -607,11 +607,11 @@ private:
class ResetPaintFilterOp : public StateOp {
public:
- virtual void applyState(OpenGLRenderer& renderer, int saveCount) const {
+ virtual void applyState(OpenGLRenderer& renderer, int /* saveCount */) const {
renderer.resetPaintFilter();
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOGS("ResetPaintFilter");
}
@@ -623,11 +623,11 @@ public:
SetupPaintFilterOp(int clearBits, int setBits)
: mClearBits(clearBits), mSetBits(setBits) {}
- virtual void applyState(OpenGLRenderer& renderer, int saveCount) const {
+ virtual void applyState(OpenGLRenderer& renderer, int /* saveCount */) const {
renderer.setupPaintFilter(mClearBits, mSetBits);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("SetupPaintFilter, clear %#x, set %#x", mClearBits, mSetBits);
}
@@ -655,7 +655,7 @@ public:
}
}
- virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& /* dirty */) {
return renderer.drawBitmap(mBitmap, getPaint(renderer));
}
@@ -678,7 +678,7 @@ public:
* for each bitmap in the batch. This method is also responsible for dirtying
* the current layer, if any.
*/
- virtual status_t multiDraw(OpenGLRenderer& renderer, Rect& dirty,
+ virtual status_t multiDraw(OpenGLRenderer& renderer, Rect& /* dirty */,
const Vector<OpStatePair>& ops, const Rect& bounds) {
const DeferredDisplayState& firstState = *(ops[0].state);
renderer.restoreDisplayState(firstState, true); // restore all but the clip
@@ -719,13 +719,13 @@ public:
pureTranslate, bounds, mPaint);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("Draw bitmap %p at %f %f", mBitmap, mLocalBounds.left, mLocalBounds.top);
}
virtual const char* name() { return "DrawBitmap"; }
- virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& deferInfo,
+ virtual void onDefer(OpenGLRenderer& /* renderer */, DeferInfo& deferInfo,
const DeferredDisplayState& state) {
deferInfo.batchId = DeferredDisplayList::kOpBatch_Bitmap;
deferInfo.mergeId = getAtlasEntry() ?
@@ -758,21 +758,21 @@ public:
: DrawBoundedOp(dstLeft, dstTop, dstRight, dstBottom, paint),
mBitmap(bitmap), mSrc(srcLeft, srcTop, srcRight, srcBottom) {}
- virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& /* dirty */) {
return renderer.drawBitmap(mBitmap, mSrc.left, mSrc.top, mSrc.right, mSrc.bottom,
mLocalBounds.left, mLocalBounds.top, mLocalBounds.right, mLocalBounds.bottom,
getPaint(renderer));
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("Draw bitmap %p src=" RECT_STRING ", dst=" RECT_STRING,
mBitmap, RECT_ARGS(mSrc), RECT_ARGS(mLocalBounds));
}
virtual const char* name() { return "DrawBitmapRect"; }
- virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& deferInfo,
- const DeferredDisplayState& state) {
+ virtual void onDefer(OpenGLRenderer& /* renderer */, DeferInfo& deferInfo,
+ const DeferredDisplayState& /* state */) {
deferInfo.batchId = DeferredDisplayList::kOpBatch_Bitmap;
}
@@ -786,18 +786,18 @@ public:
DrawBitmapDataOp(const SkBitmap* bitmap, const SkPaint* paint)
: DrawBitmapOp(bitmap, paint) {}
- virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& /* dirty */) {
return renderer.drawBitmapData(mBitmap, getPaint(renderer));
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("Draw bitmap %p", mBitmap);
}
virtual const char* name() { return "DrawBitmapData"; }
- virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& deferInfo,
- const DeferredDisplayState& state) {
+ virtual void onDefer(OpenGLRenderer& /* renderer */, DeferInfo& deferInfo,
+ const DeferredDisplayState& /* state */) {
deferInfo.batchId = DeferredDisplayList::kOpBatch_Bitmap;
}
};
@@ -810,19 +810,19 @@ public:
mBitmap(bitmap), mMeshWidth(meshWidth), mMeshHeight(meshHeight),
mVertices(vertices), mColors(colors) {}
- virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& /* dirty */) {
return renderer.drawBitmapMesh(mBitmap, mMeshWidth, mMeshHeight,
mVertices, mColors, getPaint(renderer));
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("Draw bitmap %p mesh %d x %d", mBitmap, mMeshWidth, mMeshHeight);
}
virtual const char* name() { return "DrawBitmapMesh"; }
- virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& deferInfo,
- const DeferredDisplayState& state) {
+ virtual void onDefer(OpenGLRenderer& /* renderer */, DeferInfo& deferInfo,
+ const DeferredDisplayState& /* state */) {
deferInfo.batchId = DeferredDisplayList::kOpBatch_Bitmap;
}
@@ -871,8 +871,8 @@ public:
* and transforming the vertices of each 9-patch in the batch. This method
* is also responsible for dirtying the current layer, if any.
*/
- virtual status_t multiDraw(OpenGLRenderer& renderer, Rect& dirty,
- const Vector<OpStatePair>& ops, const Rect& bounds) {
+ virtual status_t multiDraw(OpenGLRenderer& renderer, Rect& /* dirty */,
+ const Vector<OpStatePair>& ops, const Rect& /* bounds */) {
const DeferredDisplayState& firstState = *(ops[0].state);
renderer.restoreDisplayState(firstState, true); // restore all but the clip
@@ -945,7 +945,7 @@ public:
&vertices[0], indexCount, getPaint(renderer));
}
- virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& /* dirty */) {
// We're not calling the public variant of drawPatch() here
// This method won't perform the quickReject() since we've already done it at this point
return renderer.drawPatch(mBitmap, getMesh(renderer), getAtlasEntry(),
@@ -953,13 +953,13 @@ public:
getPaint(renderer));
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("Draw patch " RECT_STRING, RECT_ARGS(mLocalBounds));
}
virtual const char* name() { return "DrawPatch"; }
- virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& deferInfo,
+ virtual void onDefer(OpenGLRenderer& /* renderer */, DeferInfo& deferInfo,
const DeferredDisplayState& state) {
deferInfo.batchId = DeferredDisplayList::kOpBatch_Patch;
deferInfo.mergeId = getAtlasEntry() ? (mergeid_t) mEntry->getMergeId() : (mergeid_t) mBitmap;
@@ -985,11 +985,11 @@ public:
DrawColorOp(int color, SkXfermode::Mode mode)
: DrawOp(NULL), mColor(color), mMode(mode) {};
- virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& /* dirty */) {
return renderer.drawColor(mColor, mMode);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("Draw color %#x, mode %d", mColor, mMode);
}
@@ -1015,8 +1015,8 @@ public:
return true;
}
- virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& deferInfo,
- const DeferredDisplayState& state) {
+ virtual void onDefer(OpenGLRenderer& /* renderer */, DeferInfo& deferInfo,
+ const DeferredDisplayState& /* state */) {
if (mPaint->getPathEffect()) {
deferInfo.batchId = DeferredDisplayList::kOpBatch_AlphaMaskTexture;
} else {
@@ -1032,12 +1032,12 @@ public:
DrawRectOp(float left, float top, float right, float bottom, const SkPaint* paint)
: DrawStrokableOp(left, top, right, bottom, paint) {}
- virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& /* dirty */) {
return renderer.drawRect(mLocalBounds.left, mLocalBounds.top,
mLocalBounds.right, mLocalBounds.bottom, getPaint(renderer));
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("Draw Rect " RECT_STRING, RECT_ARGS(mLocalBounds));
}
@@ -1057,18 +1057,18 @@ public:
: DrawBoundedOp(rects, count, paint),
mRects(rects), mCount(count) {}
- virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& /* dirty */) {
return renderer.drawRects(mRects, mCount, getPaint(renderer));
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("Draw Rects count %d", mCount);
}
virtual const char* name() { return "DrawRects"; }
- virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& deferInfo,
- const DeferredDisplayState& state) {
+ virtual void onDefer(OpenGLRenderer& /* renderer */, DeferInfo& deferInfo,
+ const DeferredDisplayState& /* state */) {
deferInfo.batchId = DeferredDisplayList::kOpBatch_Vertices;
}
@@ -1083,12 +1083,12 @@ public:
float rx, float ry, const SkPaint* paint)
: DrawStrokableOp(left, top, right, bottom, paint), mRx(rx), mRy(ry) {}
- virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& /* dirty */) {
return renderer.drawRoundRect(mLocalBounds.left, mLocalBounds.top,
mLocalBounds.right, mLocalBounds.bottom, mRx, mRy, getPaint(renderer));
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("Draw RoundRect " RECT_STRING ", rx %f, ry %f", RECT_ARGS(mLocalBounds), mRx, mRy);
}
@@ -1115,12 +1115,12 @@ public:
: DrawOp(paint), mLeft(left), mTop(top), mRight(right), mBottom(bottom),
mRx(rx), mRy(ry) {}
- virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& /* dirty */) {
return renderer.drawRoundRect(*mLeft, *mTop, *mRight, *mBottom,
*mRx, *mRy, getPaint(renderer));
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("Draw RoundRect Props " RECT_STRING ", rx %f, ry %f",
*mLeft, *mTop, *mRight, *mBottom, *mRx, *mRy);
}
@@ -1142,11 +1142,11 @@ public:
: DrawStrokableOp(x - radius, y - radius, x + radius, y + radius, paint),
mX(x), mY(y), mRadius(radius) {}
- virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& /* dirty */) {
return renderer.drawCircle(mX, mY, mRadius, getPaint(renderer));
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("Draw Circle x %f, y %f, r %f", mX, mY, mRadius);
}
@@ -1163,11 +1163,11 @@ public:
DrawCirclePropsOp(float* x, float* y, float* radius, const SkPaint* paint)
: DrawOp(paint), mX(x), mY(y), mRadius(radius) {}
- virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& /* dirty */) {
return renderer.drawCircle(*mX, *mY, *mRadius, getPaint(renderer));
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("Draw Circle Props x %p, y %p, r %p", mX, mY, mRadius);
}
@@ -1184,12 +1184,12 @@ public:
DrawOvalOp(float left, float top, float right, float bottom, const SkPaint* paint)
: DrawStrokableOp(left, top, right, bottom, paint) {}
- virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& /* dirty */) {
return renderer.drawOval(mLocalBounds.left, mLocalBounds.top,
mLocalBounds.right, mLocalBounds.bottom, getPaint(renderer));
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("Draw Oval " RECT_STRING, RECT_ARGS(mLocalBounds));
}
@@ -1203,13 +1203,13 @@ public:
: DrawStrokableOp(left, top, right, bottom, paint),
mStartAngle(startAngle), mSweepAngle(sweepAngle), mUseCenter(useCenter) {}
- virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& /* dirty */) {
return renderer.drawArc(mLocalBounds.left, mLocalBounds.top,
mLocalBounds.right, mLocalBounds.bottom,
mStartAngle, mSweepAngle, mUseCenter, getPaint(renderer));
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("Draw Arc " RECT_STRING ", start %f, sweep %f, useCenter %d",
RECT_ARGS(mLocalBounds), mStartAngle, mSweepAngle, mUseCenter);
}
@@ -1234,19 +1234,19 @@ public:
mLocalBounds.set(left, top, left + width, top + height);
}
- virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& /* dirty */) {
return renderer.drawPath(mPath, getPaint(renderer));
}
virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& deferInfo,
- const DeferredDisplayState& state) {
+ const DeferredDisplayState& /* state */) {
const SkPaint* paint = getPaint(renderer);
renderer.getCaches().pathCache.precache(mPath, paint);
deferInfo.batchId = DeferredDisplayList::kOpBatch_AlphaMaskTexture;
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("Draw Path %p in " RECT_STRING, mPath, RECT_ARGS(mLocalBounds));
}
@@ -1264,18 +1264,18 @@ public:
mLocalBounds.outset(strokeWidthOutset());
}
- virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& /* dirty */) {
return renderer.drawLines(mPoints, mCount, getPaint(renderer));
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("Draw Lines count %d", mCount);
}
virtual const char* name() { return "DrawLines"; }
- virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& deferInfo,
- const DeferredDisplayState& state) {
+ virtual void onDefer(OpenGLRenderer& /* renderer */, DeferInfo& deferInfo,
+ const DeferredDisplayState& /* state */) {
deferInfo.batchId = mPaint->isAntiAlias() ?
DeferredDisplayList::kOpBatch_AlphaVertices :
DeferredDisplayList::kOpBatch_Vertices;
@@ -1291,11 +1291,11 @@ public:
DrawPointsOp(const float* points, int count, const SkPaint* paint)
: DrawLinesOp(points, count, paint) {}
- virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& /* dirty */) {
return renderer.drawPoints(mPoints, mCount, getPaint(renderer));
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("Draw Points count %d", mCount);
}
@@ -1307,7 +1307,7 @@ public:
DrawSomeTextOp(const char* text, int bytesCount, int count, const SkPaint* paint)
: DrawOp(paint), mText(text), mBytesCount(bytesCount), mCount(count) {};
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("Draw some text, %d bytes", mBytesCount);
}
@@ -1316,7 +1316,7 @@ public:
}
virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& deferInfo,
- const DeferredDisplayState& state) {
+ const DeferredDisplayState& /* state */) {
const SkPaint* paint = getPaint(renderer);
FontRenderer& fontRenderer = renderer.getCaches().fontRenderer->getFontRenderer(paint);
fontRenderer.precache(paint, mText, mCount, SkMatrix::I());
@@ -1341,7 +1341,7 @@ public:
/* TODO: inherit from DrawBounded and init mLocalBounds */
}
- virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& /* dirty */) {
return renderer.drawTextOnPath(mText, mBytesCount, mCount, mPath,
mHOffset, mVOffset, getPaint(renderer));
}
@@ -1362,7 +1362,7 @@ public:
/* TODO: inherit from DrawBounded and init mLocalBounds */
}
- virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& /* dirty */) {
return renderer.drawPosText(mText, mBytesCount, mCount, mPositions, getPaint(renderer));
}
@@ -1406,15 +1406,15 @@ public:
&& OpenGLRenderer::getXfermodeDirect(mPaint) == SkXfermode::kSrcOver_Mode;
}
- virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& /* dirty */) {
Rect bounds;
getLocalBounds(bounds);
return renderer.drawText(mText, mBytesCount, mCount, mX, mY,
mPositions, getPaint(renderer), mTotalAdvance, bounds);
}
- virtual status_t multiDraw(OpenGLRenderer& renderer, Rect& dirty,
- const Vector<OpStatePair>& ops, const Rect& bounds) {
+ virtual status_t multiDraw(OpenGLRenderer& renderer, Rect& /* dirty */,
+ const Vector<OpStatePair>& ops, const Rect& /* bounds */) {
status_t status = DrawGlInfo::kStatusDone;
for (unsigned int i = 0; i < ops.size(); i++) {
const DeferredDisplayState& state = *(ops[i].state);
@@ -1431,7 +1431,7 @@ public:
return status;
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("Draw Text of count %d, bytes %d", mCount, mBytesCount);
}
@@ -1464,7 +1464,7 @@ public:
return ret;
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("Draw Functor %p", mFunctor);
}
@@ -1482,21 +1482,21 @@ public:
: DrawBoundedOp(0, 0, renderNode->getWidth(), renderNode->getHeight(), 0),
mRenderNode(renderNode), mFlags(flags), mTransformFromParent(transformFromParent) {}
- virtual void defer(DeferStateStruct& deferStruct, int saveCount, int level,
- bool useQuickReject) {
+ virtual void defer(DeferStateStruct& deferStruct, int /* saveCount */, int level,
+ bool /* useQuickReject */) {
if (mRenderNode->isRenderable() && !mSkipInOrderDraw) {
mRenderNode->defer(deferStruct, level + 1);
}
}
- virtual void replay(ReplayStateStruct& replayStruct, int saveCount, int level,
- bool useQuickReject) {
+ virtual void replay(ReplayStateStruct& replayStruct, int /* saveCount */, int level,
+ bool /* useQuickReject */) {
if (mRenderNode->isRenderable() && !mSkipInOrderDraw) {
mRenderNode->replay(replayStruct, level + 1);
}
}
- virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual status_t applyDraw(OpenGLRenderer& /* renderer */, Rect& /* dirty */) {
LOG_ALWAYS_FATAL("should not be called, because replay() is overridden");
return 0;
}
@@ -1550,14 +1550,14 @@ public:
, mCasterOutline(casterOutline) {
}
- virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& deferInfo,
+ virtual void onDefer(OpenGLRenderer& renderer, DeferInfo& /* deferInfo */,
const DeferredDisplayState& state) {
renderer.getCaches().tessellationCache.precacheShadows(&state.mMatrix,
renderer.getLocalClipBounds(), isCasterOpaque(), mCasterOutline,
&mTransformXY, &mTransformZ, renderer.getLightCenter(), renderer.getLightRadius());
}
- virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& /* dirty */) {
TessellationCache::vertexBuffer_pair_t buffers;
Matrix4 drawTransform(*(renderer.currentTransform()));
renderer.getCaches().tessellationCache.getShadowBuffers(&drawTransform,
@@ -1568,7 +1568,7 @@ public:
return renderer.drawShadow(mCasterAlpha, buffers.first, buffers.second);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOGS("DrawShadow");
}
@@ -1588,11 +1588,11 @@ public:
DrawLayerOp(Layer* layer, float x, float y)
: DrawOp(NULL), mLayer(layer), mX(x), mY(y) {}
- virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
+ virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& /* dirty */) {
return renderer.drawLayer(mLayer, mX, mY);
}
- virtual void output(int level, uint32_t logFlags) const {
+ virtual void output(int level, uint32_t /* logFlags */) const {
OP_LOG("Draw Layer %p at %f %f", mLayer, mX, mY);
}
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index c2cb76e..399cbfb 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -60,8 +60,8 @@ DisplayListData* DisplayListRenderer::finishRecording() {
return data;
}
-status_t DisplayListRenderer::prepareDirty(float left, float top,
- float right, float bottom, bool opaque) {
+status_t DisplayListRenderer::prepareDirty(float /* left */, float /* top */,
+ float /* right */, float /* bottom */, bool opaque) {
LOG_ALWAYS_FATAL_IF(mDisplayListData,
"prepareDirty called a second time during a recording!");
@@ -87,7 +87,7 @@ void DisplayListRenderer::interrupt() {
void DisplayListRenderer::resume() {
}
-status_t DisplayListRenderer::callDrawGLFunction(Functor *functor, Rect& dirty) {
+status_t DisplayListRenderer::callDrawGLFunction(Functor *functor, Rect& /* dirty */) {
// Ignore dirty during recording, it matters only when we replay
addDrawOp(new (alloc()) DrawFunctorOp(functor));
mDisplayListData->functors.add(functor);
@@ -178,7 +178,8 @@ bool DisplayListRenderer::clipRegion(const SkRegion* region, SkRegion::Op op) {
return StatefulBaseRenderer::clipRegion(region, op);
}
-status_t DisplayListRenderer::drawRenderNode(RenderNode* renderNode, Rect& dirty, int32_t flags) {
+status_t DisplayListRenderer::drawRenderNode(RenderNode* renderNode, Rect& /* dirty */,
+ int32_t flags) {
LOG_ALWAYS_FATAL_IF(!renderNode, "missing rendernode");
// dirty is an out parameter and should not be recorded,
@@ -394,7 +395,7 @@ static void simplifyPaint(int color, SkPaint* paint) {
status_t DisplayListRenderer::drawText(const char* text, int bytesCount, int count,
float x, float y, const float* positions, const SkPaint* paint,
- float totalAdvance, const Rect& bounds, DrawOpMode drawOpMode) {
+ float totalAdvance, const Rect& bounds, DrawOpMode /* drawOpMode */) {
if (!text || count <= 0 || paintWillNotDrawText(*paint)) return DrawGlInfo::kStatusDone;
diff --git a/libs/hwui/FontRenderer.cpp b/libs/hwui/FontRenderer.cpp
index 3910381..27ee0dc 100644
--- a/libs/hwui/FontRenderer.cpp
+++ b/libs/hwui/FontRenderer.cpp
@@ -47,7 +47,7 @@ namespace uirenderer {
///////////////////////////////////////////////////////////////////////////////
// TextSetupFunctor
///////////////////////////////////////////////////////////////////////////////
-status_t TextSetupFunctor::operator ()(int what, void* data) {
+status_t TextSetupFunctor::operator ()(int /* what */, void* data) {
Data* typedData = reinterpret_cast<Data*>(data);
GLenum glyphFormat = typedData ? typedData->glyphFormat : GL_ALPHA;
@@ -358,7 +358,7 @@ void FontRenderer::cacheBitmap(const SkGlyph& glyph, CachedGlyphInfo* cachedGlyp
break;
}
case SkMask::kBW_Format: {
- uint32_t cacheX = 0, bX = 0, cacheY = 0, bY = 0;
+ uint32_t cacheX = 0, cacheY = 0;
uint32_t row = (startY - TEXTURE_BORDER_SIZE) * cacheWidth + startX
- TEXTURE_BORDER_SIZE;
static const uint8_t COLORS[2] = { 0, 255 };
diff --git a/libs/hwui/GammaFontRenderer.h b/libs/hwui/GammaFontRenderer.h
index 46cfd04..3abbad0 100644
--- a/libs/hwui/GammaFontRenderer.h
+++ b/libs/hwui/GammaFontRenderer.h
@@ -70,7 +70,7 @@ public:
}
}
- FontRenderer& getFontRenderer(const SkPaint* paint) {
+ FontRenderer& getFontRenderer(const SkPaint* /* paint */) {
if (!mRenderer) {
mRenderer = new FontRenderer;
}
@@ -81,7 +81,7 @@ public:
return 1;
}
- uint32_t getFontRendererSize(uint32_t fontRenderer, GLenum format) const {
+ uint32_t getFontRendererSize(uint32_t /* fontRenderer */, GLenum format) const {
return mRenderer ? mRenderer->getCacheSize(format) : 0;
}
@@ -116,7 +116,7 @@ public:
}
}
- FontRenderer& getFontRenderer(const SkPaint* paint) {
+ FontRenderer& getFontRenderer(const SkPaint* /* paint */) {
if (!mRenderer) {
mRenderer = new FontRenderer;
mRenderer->setGammaTable(&mGammaTable[0]);
@@ -128,14 +128,14 @@ public:
return 1;
}
- uint32_t getFontRendererSize(uint32_t fontRenderer, GLenum format) const {
+ uint32_t getFontRendererSize(uint32_t /* fontRenderer */, GLenum format) const {
return mRenderer ? mRenderer->getCacheSize(format) : 0;
}
- void describe(ProgramDescription& description, const SkPaint* paint) const {
+ void describe(ProgramDescription& /* description */, const SkPaint* /* paint */) const {
}
- void setupProgram(ProgramDescription& description, Program* program) const {
+ void setupProgram(ProgramDescription& /* description */, Program* /* program */) const {
}
void endPrecaching();
@@ -171,10 +171,10 @@ public:
return renderer->getCacheSize(format);
}
- void describe(ProgramDescription& description, const SkPaint* paint) const {
+ void describe(ProgramDescription& /* description */, const SkPaint* /* paint */) const {
}
- void setupProgram(ProgramDescription& description, Program* program) const {
+ void setupProgram(ProgramDescription& /* description */, Program* /* program */) const {
}
void endPrecaching();
diff --git a/libs/hwui/Interpolator.cpp b/libs/hwui/Interpolator.cpp
index ff8ff73..0e62d77 100644
--- a/libs/hwui/Interpolator.cpp
+++ b/libs/hwui/Interpolator.cpp
@@ -14,6 +14,10 @@
* limitations under the License.
*/
+// LOG_TAG is being provided by the Makefile, reset.
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
#define LOG_TAG "Interpolator"
#include "Interpolator.h"
diff --git a/libs/hwui/Layer.h b/libs/hwui/Layer.h
index 64d1d12..2d6a727 100644
--- a/libs/hwui/Layer.h
+++ b/libs/hwui/Layer.h
@@ -47,7 +47,7 @@ class RenderState;
class OpenGLRenderer;
class RenderNode;
class DeferredDisplayList;
-class DeferStateStruct;
+struct DeferStateStruct;
/**
* A layer has dimensions and is backed by an OpenGL texture or FBO.
diff --git a/libs/hwui/LayerCache.cpp b/libs/hwui/LayerCache.cpp
index 3033dc6..3216cd2 100644
--- a/libs/hwui/LayerCache.cpp
+++ b/libs/hwui/LayerCache.cpp
@@ -80,8 +80,10 @@ int LayerCache::LayerEntry::compare(const LayerCache::LayerEntry& lhs,
void LayerCache::deleteLayer(Layer* layer) {
if (layer) {
- LAYER_LOGD("Destroying layer %dx%d, fbo %d", layer->getWidth(), layer->getHeight(),
- layer->getFbo());
+ if (kDebugLayers) {
+ ALOGD("Destroying layer %dx%d, fbo %d", layer->getWidth(), layer->getHeight(),
+ layer->getFbo());
+ }
mSize -= layer->getWidth() * layer->getHeight() * 4;
layer->state = Layer::kState_DeletedFromCache;
layer->decStrong(0);
@@ -110,9 +112,13 @@ Layer* LayerCache::get(RenderState& renderState, const uint32_t width, const uin
layer->state = Layer::kState_RemovedFromCache;
mSize -= layer->getWidth() * layer->getHeight() * 4;
- LAYER_LOGD("Reusing layer %dx%d", layer->getWidth(), layer->getHeight());
+ if (kDebugLayers) {
+ ALOGD("Reusing layer %dx%d", layer->getWidth(), layer->getHeight());
+ }
} else {
- LAYER_LOGD("Creating new layer %dx%d", entry.mWidth, entry.mHeight);
+ if (kDebugLayers) {
+ ALOGD("Creating new layer %dx%d", entry.mWidth, entry.mHeight);
+ }
layer = new Layer(Layer::kType_DisplayList, renderState, entry.mWidth, entry.mHeight);
layer->setBlend(true);
@@ -137,7 +143,9 @@ void LayerCache::dump() {
size_t size = mCache.size();
for (size_t i = 0; i < size; i++) {
const LayerEntry& entry = mCache.itemAt(i);
- LAYER_LOGD(" Layer size %dx%d", entry.mWidth, entry.mHeight);
+ if (kDebugLayers) {
+ ALOGD(" Layer size %dx%d", entry.mWidth, entry.mHeight);
+ }
}
}
@@ -157,8 +165,10 @@ bool LayerCache::put(Layer* layer) {
deleteLayer(victim);
mCache.removeAt(position);
- LAYER_LOGD(" Deleting layer %.2fx%.2f", victim->layer.getWidth(),
- victim->layer.getHeight());
+ if (kDebugLayers) {
+ ALOGD(" Deleting layer %.2fx%.2f", victim->layer.getWidth(),
+ victim->layer.getHeight());
+ }
}
layer->cancelDefer();
diff --git a/libs/hwui/LayerCache.h b/libs/hwui/LayerCache.h
index 6b93e8f..81810ac 100644
--- a/libs/hwui/LayerCache.h
+++ b/libs/hwui/LayerCache.h
@@ -26,15 +26,11 @@ namespace uirenderer {
class RenderState;
-///////////////////////////////////////////////////////////////////////////////
-// Defines
-///////////////////////////////////////////////////////////////////////////////
-
// Debug
#if DEBUG_LAYERS
- #define LAYER_LOGD(...) ALOGD(__VA_ARGS__)
+static const bool kDebugLayers = true;
#else
- #define LAYER_LOGD(...)
+static const bool kDebugLayers = false;
#endif
///////////////////////////////////////////////////////////////////////////////
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 075f2c5..86821e8 100755
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -344,7 +344,7 @@ void OpenGLRenderer::resumeAfterLayer() {
dirtyClip();
}
-status_t OpenGLRenderer::callDrawGLFunction(Functor* functor, Rect& dirty) {
+status_t OpenGLRenderer::callDrawGLFunction(Functor* functor, Rect& /* dirty */) {
if (currentSnapshot()->isIgnored()) return DrawGlInfo::kStatusDone;
Rect clip(*currentClipRect());
@@ -397,6 +397,8 @@ void OpenGLRenderer::eventMarkDEBUG(const char* fmt, ...) const {
va_end(ap);
eventMark(buf);
+#else
+ (void)fmt;
#endif
}
@@ -452,7 +454,6 @@ void OpenGLRenderer::renderOverdraw() {
bool OpenGLRenderer::updateLayer(Layer* layer, bool inFrame) {
if (layer->deferredUpdateScheduled && layer->renderer
&& layer->renderNode.get() && layer->renderNode->isRenderable()) {
- Rect& dirty = layer->dirtyRect;
if (inFrame) {
endTiling();
@@ -731,8 +732,10 @@ int OpenGLRenderer::saveLayerDeferred(float left, float top, float right, float
*/
bool OpenGLRenderer::createLayer(float left, float top, float right, float bottom,
const SkPaint* paint, int flags, const SkPath* convexMask) {
- LAYER_LOGD("Requesting layer %.2fx%.2f", right - left, bottom - top);
- LAYER_LOGD("Layer cache size = %d", mCaches.layerCache.getSize());
+ if (kDebugLayers) {
+ ALOGD("Requesting layer %.2fx%.2f", right - left, bottom - top);
+ ALOGD("Layer cache size = %d", mCaches.layerCache.getSize());
+ }
const bool fboLayer = flags & SkCanvas::kClipToLayer_SaveFlag;
@@ -910,7 +913,9 @@ void OpenGLRenderer::composeLayer(const Snapshot& removed, const Snapshot& resto
// Failing to add the layer to the cache should happen only if the layer is too large
layer->setConvexMask(NULL);
if (!mCaches.layerCache.put(layer)) {
- LAYER_LOGD("Deleting layer");
+ if (kDebugLayers) {
+ ALOGD("Deleting layer");
+ }
layer->decStrong(0);
}
}
@@ -1040,7 +1045,7 @@ public:
}
protected:
- virtual void shadeSpan(int x, int y, SkPMColor[], int count) {
+ virtual void shadeSpan(int /* x */, int /* y */, SkPMColor[], int /* count */) {
LOG_ALWAYS_FATAL("LayerShader should never be drawn with raster backend.");
}
@@ -1923,8 +1928,6 @@ status_t OpenGLRenderer::drawRenderNode(RenderNode* renderNode, Rect& dirty, int
}
void OpenGLRenderer::drawAlphaBitmap(Texture* texture, float left, float top, const SkPaint* paint) {
- int color = paint != NULL ? paint->getColor() : 0;
-
float x = left;
float y = top;
@@ -2346,7 +2349,7 @@ status_t OpenGLRenderer::drawVertexBuffer(float translateX, float translateY,
setupDrawShaderUniforms(getShader(paint));
const void* vertices = vertexBuffer.getBuffer();
- bool force = mCaches.unbindMeshBuffer();
+ mCaches.unbindMeshBuffer();
mCaches.bindPositionVertexPointer(true, vertices, isAA ? gAlphaVertexStride : gVertexStride);
mCaches.resetTexCoordsVertexPointer();
@@ -3121,14 +3124,6 @@ status_t OpenGLRenderer::drawRects(const float* rects, int count, const SkPaint*
return drawColorRects(rects, count, paint, false, true, true);
}
-static void mapPointFakeZ(Vector3& point, const mat4& transformXY, const mat4& transformZ) {
- // map z coordinate with true 3d matrix
- point.z = transformZ.mapZ(point);
-
- // map x,y coordinates with draw/Skia matrix
- transformXY.mapPoint(point.x, point.y);
-}
-
status_t OpenGLRenderer::drawShadow(float casterAlpha,
const VertexBuffer* ambientShadowVertexBuffer, const VertexBuffer* spotShadowVertexBuffer) {
if (currentSnapshot()->isIgnored()) return DrawGlInfo::kStatusDone;
diff --git a/libs/hwui/PathCache.cpp b/libs/hwui/PathCache.cpp
index 6f48e4d..37d70f2 100644
--- a/libs/hwui/PathCache.cpp
+++ b/libs/hwui/PathCache.cpp
@@ -196,7 +196,7 @@ void PathCache::setMaxSize(uint32_t maxSize) {
// Callbacks
///////////////////////////////////////////////////////////////////////////////
-void PathCache::operator()(PathDescription& entry, PathTexture*& texture) {
+void PathCache::operator()(PathDescription& /* entry */, PathTexture*& texture) {
removeTexture(texture);
}
@@ -212,7 +212,7 @@ void PathCache::removeTexture(PathTexture* texture) {
// before attempting our cleanup
const sp<Task<SkBitmap*> >& task = texture->task();
if (task != NULL) {
- SkBitmap* bitmap = task->getResult();
+ task->getResult();
texture->clearTask();
} else {
// If there is a pending task, the path was not added
diff --git a/libs/hwui/PathTessellator.cpp b/libs/hwui/PathTessellator.cpp
index 27ef06f..9f7dd50 100644
--- a/libs/hwui/PathTessellator.cpp
+++ b/libs/hwui/PathTessellator.cpp
@@ -279,7 +279,6 @@ void getStrokeVerticesFromUnclosedVertices(const PaintInfo& paintInfo,
- (vertices[lastIndex].x - vertices[lastIndex - 1].x),
vertices[lastIndex].y - vertices[lastIndex - 1].y);
const float dTheta = PI / (extra + 1);
- const float radialScale = 2.0f / (1 + cos(dTheta));
int capOffset;
for (int i = 0; i < extra; i++) {
@@ -290,14 +289,14 @@ void getStrokeVerticesFromUnclosedVertices(const PaintInfo& paintInfo,
}
beginTheta += dTheta;
- Vector2 beginRadialOffset = {cos(beginTheta), sin(beginTheta)};
+ Vector2 beginRadialOffset = {cosf(beginTheta), sinf(beginTheta)};
paintInfo.scaleOffsetForStrokeWidth(beginRadialOffset);
Vertex::set(&buffer[capOffset],
vertices[0].x + beginRadialOffset.x,
vertices[0].y + beginRadialOffset.y);
endTheta += dTheta;
- Vector2 endRadialOffset = {cos(endTheta), sin(endTheta)};
+ Vector2 endRadialOffset = {cosf(endTheta), sinf(endTheta)};
paintInfo.scaleOffsetForStrokeWidth(endRadialOffset);
Vertex::set(&buffer[allocSize - 1 - capOffset],
vertices[lastIndex].x + endRadialOffset.x,
@@ -468,7 +467,7 @@ inline static void storeCapAA(const PaintInfo& paintInfo, const Vector<Vertex>&
for (int i = 0; i < extra; i++) {
theta += dTheta;
- Vector2 radialOffset = {cos(theta), sin(theta)};
+ Vector2 radialOffset = {cosf(theta), sinf(theta)};
// scale to compensate for pinching at sharp angles, see totalOffsetFromNormals()
radialOffset *= radialScale;
@@ -831,7 +830,6 @@ void PathTessellator::tessellatePoints(const float* points, int count, const SkP
Rect bounds;
// tessellate, then duplicate outline across points
- int numPoints = count / 2;
VertexBuffer tempBuffer;
if (!paintInfo.isAA) {
getFillVerticesFromPerimeter(outlineVertices, tempBuffer);
diff --git a/libs/hwui/Program.h b/libs/hwui/Program.h
index d05b331..fc7d134 100644
--- a/libs/hwui/Program.h
+++ b/libs/hwui/Program.h
@@ -281,6 +281,8 @@ struct ProgramDescription {
programid k = key();
PROGRAM_LOGD("%s (key = 0x%.8x%.8x)", message, uint32_t(k >> 32),
uint32_t(k & 0xffffffff));
+#else
+ (void)message;
#endif
}
diff --git a/libs/hwui/ProgramCache.cpp b/libs/hwui/ProgramCache.cpp
index 62835e0..a5b9851 100644
--- a/libs/hwui/ProgramCache.cpp
+++ b/libs/hwui/ProgramCache.cpp
@@ -449,7 +449,7 @@ Program* ProgramCache::get(const ProgramDescription& description) {
// Program generation
///////////////////////////////////////////////////////////////////////////////
-Program* ProgramCache::generateProgram(const ProgramDescription& description, programid key) {
+Program* ProgramCache::generateProgram(const ProgramDescription& description, programid /* key */) {
String8 vertexShader = generateVertexShader(description);
String8 fragmentShader = generateFragmentShader(description);
diff --git a/libs/hwui/Properties.h b/libs/hwui/Properties.h
index befed16..7b9459a 100644
--- a/libs/hwui/Properties.h
+++ b/libs/hwui/Properties.h
@@ -253,7 +253,7 @@ enum DebugLevel {
// Converts a number of kilo-bytes into bytes
#define KB(s) s * 1024
-static DebugLevel readDebugLevel() {
+static inline DebugLevel readDebugLevel() {
char property[PROPERTY_VALUE_MAX];
if (property_get(PROPERTY_DEBUG, property, NULL) > 0) {
return (DebugLevel) atoi(property);
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp
index 810e487..a349ed6 100644
--- a/libs/hwui/RenderNode.cpp
+++ b/libs/hwui/RenderNode.cpp
@@ -282,7 +282,7 @@ void RenderNode::pushStagingPropertiesChanges(TreeInfo& info) {
}
}
-void RenderNode::applyLayerPropertiesToLayer(TreeInfo& info) {
+void RenderNode::applyLayerPropertiesToLayer(TreeInfo& /* info */) {
if (CC_LIKELY(!mLayer)) return;
const LayerProperties& props = properties().layerProperties();
@@ -589,7 +589,7 @@ public:
operation->defer(mDeferStruct, saveCount, mLevel, clipToBounds);
}
inline LinearAllocator& allocator() { return *(mDeferStruct.mAllocator); }
- inline void startMark(const char* name) {} // do nothing
+ inline void startMark(const char* /* name */) {} // do nothing
inline void endMark() {}
inline int level() { return mLevel; }
inline int replayFlags() { return mDeferStruct.mReplayFlags; }
@@ -777,7 +777,6 @@ void RenderNode::issueOperationsOf3dChildren(ChildrenSelectMode mode,
int restoreTo = renderer.save(SkCanvas::kMatrix_SaveFlag);
DrawRenderNodeOp* childOp = zTranslatedNodes[drawIndex].value;
- RenderNode* child = childOp->mRenderNode;
renderer.concatMatrix(childOp->mTransformFromParent);
childOp->mSkipInOrderDraw = false; // this is horrible, I'm so sorry everyone
@@ -926,7 +925,7 @@ void RenderNode::issueOperations(OpenGLRenderer& renderer, T& handler) {
initialTransform, zTranslatedNodes, renderer, handler);
- for (int opIndex = chunk.beginOpIndex; opIndex < chunk.endOpIndex; opIndex++) {
+ for (size_t opIndex = chunk.beginOpIndex; opIndex < chunk.endOpIndex; opIndex++) {
DisplayListOp *op = mDisplayListData->displayListOps[opIndex];
#if DEBUG_DISPLAY_LIST
op->output(level + 1);
@@ -934,7 +933,8 @@ void RenderNode::issueOperations(OpenGLRenderer& renderer, T& handler) {
logBuffer.writeCommand(level, op->name());
handler(op, saveCountOffset, properties().getClipToBounds());
- if (CC_UNLIKELY(!mProjectedNodes.isEmpty() && opIndex == projectionReceiveIndex)) {
+ if (CC_UNLIKELY(!mProjectedNodes.isEmpty() && projectionReceiveIndex >= 0 &&
+ opIndex == static_cast<size_t>(projectionReceiveIndex))) {
issueOperationsOfProjectedChildren(renderer, handler);
}
}
diff --git a/libs/hwui/ShadowTessellator.cpp b/libs/hwui/ShadowTessellator.cpp
index c1ffa0a..93d4b31 100644
--- a/libs/hwui/ShadowTessellator.cpp
+++ b/libs/hwui/ShadowTessellator.cpp
@@ -87,7 +87,6 @@ void ShadowTessellator::tessellateSpotShadow(bool isCasterOpaque,
reverseReceiverTransform.loadInverse(receiverTransform);
reverseReceiverTransform.mapPoint3d(adjustedLightCenter);
- const int lightVertexCount = 8;
if (CC_UNLIKELY(caches.propertyLightDiameter > 0)) {
lightRadius = caches.propertyLightDiameter;
}
diff --git a/libs/hwui/SkiaShader.cpp b/libs/hwui/SkiaShader.cpp
index c672bc4..76a70c2 100644
--- a/libs/hwui/SkiaShader.cpp
+++ b/libs/hwui/SkiaShader.cpp
@@ -163,7 +163,7 @@ void SkiaShader::setupProgram(Caches* caches, const mat4& modelViewMatrix,
///////////////////////////////////////////////////////////////////////////////
void SkiaLayerShader::describe(Caches*, ProgramDescription& description,
- const Extensions&, const SkShader& shader) {
+ const Extensions&, const SkShader& /* shader */) {
description.hasBitmap = true;
}
@@ -339,7 +339,7 @@ static bool isSimpleGradient(const SkShader::GradientInfo& gradInfo) {
}
void SkiaGradientShader::describe(Caches*, ProgramDescription& description,
- const Extensions& extensions, const SkShader& shader) {
+ const Extensions& /* extensions */, const SkShader& shader) {
SkShader::GradientInfo gradInfo;
gradInfo.fColorCount = 0;
gradInfo.fColors = NULL;
diff --git a/libs/hwui/SkiaShader.h b/libs/hwui/SkiaShader.h
index 034c3f6..c0a00ee 100644
--- a/libs/hwui/SkiaShader.h
+++ b/libs/hwui/SkiaShader.h
@@ -57,12 +57,13 @@ public:
class InvalidSkiaShader {
public:
- static void describe(Caches* caches, ProgramDescription& description,
- const Extensions& extensions, const SkShader& shader) {
+ static void describe(Caches* /* caches */, ProgramDescription& /* description */,
+ const Extensions& /* extensions */, const SkShader& /* shader */) {
// This shader is unsupported. Skip it.
}
- static void setupProgram(Caches* caches, const mat4& modelViewMatrix,
- GLuint* textureUnit, const Extensions& extensions, const SkShader& shader) {
+ static void setupProgram(Caches* /* caches */, const mat4& /* modelViewMatrix */,
+ GLuint* /* textureUnit */, const Extensions& /* extensions */,
+ const SkShader& /* shader */) {
// This shader is unsupported. Skip it.
}
diff --git a/libs/hwui/SpotShadow.cpp b/libs/hwui/SpotShadow.cpp
index b2dd899..df068e6 100644
--- a/libs/hwui/SpotShadow.cpp
+++ b/libs/hwui/SpotShadow.cpp
@@ -797,11 +797,15 @@ inline void genNewPenumbraAndPairWithUmbra(const Vector2* penumbra, int penumbra
previousPenumbra * weightForPreviousPenumbra;
int skippedUmbraIndex = (previousClosestUmbraIndex + k + 1) % umbraLength;
- verticesPair[verticesPairIndex++] = {newPenumbraIndex, skippedUmbraIndex};
+ verticesPair[verticesPairIndex].outerIndex = newPenumbraIndex;
+ verticesPair[verticesPairIndex].innerIndex = skippedUmbraIndex;
+ verticesPairIndex++;
newPenumbra[newPenumbraIndex++] = interpolatedPenumbra;
}
}
- verticesPair[verticesPairIndex++] = {newPenumbraIndex, currentClosestUmbraIndex};
+ verticesPair[verticesPairIndex].outerIndex = newPenumbraIndex;
+ verticesPair[verticesPairIndex].innerIndex = currentClosestUmbraIndex;
+ verticesPairIndex++;
newPenumbra[newPenumbraIndex++] = currentPenumbraVertex;
previousClosestUmbraIndex = currentClosestUmbraIndex;
@@ -866,7 +870,7 @@ inline Vector2 getCloserVertex(const Vector2& umbraVertex, const Vector2& centro
/**
* Generate a triangle strip given two convex polygon
**/
-void SpotShadow::generateTriangleStrip(bool isCasterOpaque, float shadowStrengthScale,
+void SpotShadow::generateTriangleStrip(bool isCasterOpaque, float /* shadowStrengthScale */,
Vector2* penumbra, int penumbraLength, Vector2* umbra, int umbraLength,
const Vector3* poly, int polyLength, VertexBuffer& shadowTriangleStrip,
const Vector2& centroid) {
diff --git a/libs/hwui/StatefulBaseRenderer.h b/libs/hwui/StatefulBaseRenderer.h
index 745e48a..a8e4f88 100644
--- a/libs/hwui/StatefulBaseRenderer.h
+++ b/libs/hwui/StatefulBaseRenderer.h
@@ -129,7 +129,8 @@ protected:
*
* Subclasses can override this method to handle layer restoration
*/
- virtual void onSnapshotRestored(const Snapshot& removed, const Snapshot& restored) {};
+ virtual void onSnapshotRestored(const Snapshot& /* removed */,
+ const Snapshot& /* restored */) {};
virtual void onViewportInitialized() {};
diff --git a/libs/hwui/TessellationCache.cpp b/libs/hwui/TessellationCache.cpp
index 1e38f9e..35ec5e9 100644
--- a/libs/hwui/TessellationCache.cpp
+++ b/libs/hwui/TessellationCache.cpp
@@ -365,7 +365,7 @@ void TessellationCache::clear() {
// Callbacks
///////////////////////////////////////////////////////////////////////////////
-void TessellationCache::BufferRemovedListener::operator()(Description& description,
+void TessellationCache::BufferRemovedListener::operator()(Description& /* description */,
Buffer*& buffer) {
delete buffer;
}
diff --git a/libs/hwui/TessellationCache.h b/libs/hwui/TessellationCache.h
index 688a699..a05c690 100644
--- a/libs/hwui/TessellationCache.h
+++ b/libs/hwui/TessellationCache.h
@@ -178,7 +178,8 @@ private:
// holds a pointer, and implicit strong ref to each shadow task of the frame
LruCache<ShadowDescription, Task<vertexBuffer_pair_t*>*> mShadowCache;
class BufferPairRemovedListener : public OnEntryRemoved<ShadowDescription, Task<vertexBuffer_pair_t*>*> {
- void operator()(ShadowDescription& description, Task<vertexBuffer_pair_t*>*& bufferPairTask) {
+ void operator()(ShadowDescription& /* description */,
+ Task<vertexBuffer_pair_t*>*& bufferPairTask) {
bufferPairTask->decStrong(NULL);
}
};
diff --git a/libs/hwui/TextDropShadowCache.cpp b/libs/hwui/TextDropShadowCache.cpp
index 4eec462..96c09e6 100644
--- a/libs/hwui/TextDropShadowCache.cpp
+++ b/libs/hwui/TextDropShadowCache.cpp
@@ -40,7 +40,8 @@ hash_t ShadowText::hash() const {
hash = JenkinsHashMix(hash, android::hash_type(italicStyle));
hash = JenkinsHashMix(hash, android::hash_type(scaleX));
if (text) {
- hash = JenkinsHashMixShorts(hash, text, charCount);
+ hash = JenkinsHashMixShorts(
+ hash, reinterpret_cast<const uint16_t*>(text), charCount);
}
if (positions) {
for (uint32_t i = 0; i < charCount * 2; i++) {
diff --git a/libs/hwui/font/Font.cpp b/libs/hwui/font/Font.cpp
index af39f16..d73d9ac 100644
--- a/libs/hwui/font/Font.cpp
+++ b/libs/hwui/font/Font.cpp
@@ -139,7 +139,8 @@ void Font::invalidateTextureCache(CacheTexture* cacheTexture) {
}
void Font::measureCachedGlyph(CachedGlyphInfo *glyph, int x, int y,
- uint8_t* bitmap, uint32_t bitmapW, uint32_t bitmapH, Rect* bounds, const float* pos) {
+ uint8_t* /* bitmap */, uint32_t /* bitmapW */, uint32_t /* bitmapH */, Rect* bounds,
+ const float* /* pos */) {
int width = (int) glyph->mBitmapWidth;
int height = (int) glyph->mBitmapHeight;
@@ -161,7 +162,8 @@ void Font::measureCachedGlyph(CachedGlyphInfo *glyph, int x, int y,
}
void Font::drawCachedGlyph(CachedGlyphInfo* glyph, int x, int y,
- uint8_t* bitmap, uint32_t bitmapW, uint32_t bitmapH, Rect* bounds, const float* pos) {
+ uint8_t* /* bitmap */, uint32_t /* bitmapW */, uint32_t /* bitmapH */, Rect* /* bounds */,
+ const float* /* pos */) {
float width = (float) glyph->mBitmapWidth;
float height = (float) glyph->mBitmapHeight;
@@ -180,7 +182,8 @@ void Font::drawCachedGlyph(CachedGlyphInfo* glyph, int x, int y,
}
void Font::drawCachedGlyphTransformed(CachedGlyphInfo* glyph, int x, int y,
- uint8_t* bitmap, uint32_t bitmapW, uint32_t bitmapH, Rect* bounds, const float* pos) {
+ uint8_t* /* bitmap */, uint32_t /* bitmapW */, uint32_t /* bitmapH */, Rect* /* bounds */,
+ const float* /* pos */) {
float width = (float) glyph->mBitmapWidth;
float height = (float) glyph->mBitmapHeight;
@@ -210,7 +213,8 @@ void Font::drawCachedGlyphTransformed(CachedGlyphInfo* glyph, int x, int y,
}
void Font::drawCachedGlyphBitmap(CachedGlyphInfo* glyph, int x, int y, uint8_t* bitmap,
- uint32_t bitmapWidth, uint32_t bitmapHeight, Rect* bounds, const float* pos) {
+ uint32_t bitmapWidth, uint32_t /* bitmapHeight */, Rect* /* bounds */,
+ const float* /* pos */) {
int dstX = x + glyph->mBitmapLeft;
int dstY = y + glyph->mBitmapTop;
@@ -378,7 +382,7 @@ void Font::precache(const SkPaint* paint, const char* text, int numGlyphs) {
break;
}
- CachedGlyphInfo* cachedGlyph = getCachedGlyph(paint, glyph, true);
+ getCachedGlyph(paint, glyph, true);
glyphsCount++;
}
}
@@ -403,8 +407,6 @@ void Font::render(const SkPaint* paint, const char* text, uint32_t start, uint32
text += start;
int glyphsCount = 0;
- const SkPaint::Align align = paint->getTextAlign();
-
while (glyphsCount < numGlyphs) {
glyph_t glyph = GET_GLYPH(text);
@@ -429,7 +431,7 @@ void Font::render(const SkPaint* paint, const char* text, uint32_t start, uint32
}
}
-void Font::updateGlyphCache(const SkPaint* paint, const SkGlyph& skiaGlyph,
+void Font::updateGlyphCache(const SkPaint* /* paint */, const SkGlyph& skiaGlyph,
SkGlyphCache* skiaGlyphCache, CachedGlyphInfo* glyph, bool precaching) {
glyph->mAdvanceX = skiaGlyph.fAdvanceX;
glyph->mAdvanceY = skiaGlyph.fAdvanceY;
diff --git a/libs/hwui/font/FontUtil.h b/libs/hwui/font/FontUtil.h
index c2fd5f5..4e5debe 100644
--- a/libs/hwui/font/FontUtil.h
+++ b/libs/hwui/font/FontUtil.h
@@ -30,9 +30,12 @@
#define DEFAULT_TEXT_LARGE_CACHE_WIDTH 2048
#define DEFAULT_TEXT_LARGE_CACHE_HEIGHT 512
-#define TEXTURE_BORDER_SIZE 1
-#if TEXTURE_BORDER_SIZE != 1
-# error TEXTURE_BORDER_SIZE other than 1 is not currently supported
+#ifdef TEXTURE_BORDER_SIZE
+ #if TEXTURE_BORDER_SIZE != 1
+ #error TEXTURE_BORDER_SIZE other than 1 is not currently supported
+ #endif
+#else
+ #define TEXTURE_BORDER_SIZE 1
#endif
#define CACHE_BLOCK_ROUNDING_SIZE 4
@@ -44,7 +47,7 @@
#define GET_GLYPH(text) nextGlyph((const uint16_t**) &text)
#define IS_END_OF_STRING(glyph) false
- static glyph_t nextGlyph(const uint16_t** srcPtr) {
+ static inline glyph_t nextGlyph(const uint16_t** srcPtr) {
const uint16_t* src = *srcPtr;
glyph_t g = *src++;
*srcPtr = src;
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index 75bd067..5aeecd2 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -123,13 +123,13 @@ void CanvasContext::updateSurface(ANativeWindow* window) {
setSurface(window);
}
-bool CanvasContext::pauseSurface(ANativeWindow* window) {
+bool CanvasContext::pauseSurface(ANativeWindow* /* window */) {
return mRenderThread.removeFrameCallback(this);
}
// TODO: don't pass viewport size, it's automatic via EGL
-void CanvasContext::setup(int width, int height, const Vector3& lightCenter, float lightRadius,
- uint8_t ambientShadowAlpha, uint8_t spotShadowAlpha) {
+void CanvasContext::setup(int /* width */, int /* height */, const Vector3& lightCenter,
+ float lightRadius, uint8_t ambientShadowAlpha, uint8_t spotShadowAlpha) {
if (!mCanvas) return;
mCanvas->initLight(lightCenter, lightRadius, ambientShadowAlpha, spotShadowAlpha);
}
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
index 6d063a4..36ba3a9 100644
--- a/libs/hwui/renderthread/RenderProxy.cpp
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -339,13 +339,19 @@ void RenderProxy::trimMemory(int level) {
}
}
+template <typename T>
+void UNUSED(T) {}
+
+
CREATE_BRIDGE0(fence) {
// Intentionally empty
+ UNUSED(args);
return NULL;
}
void RenderProxy::fence() {
SETUP_TASK(fence);
+ UNUSED(args);
postAndWait(task);
}
diff --git a/libs/hwui/renderthread/RenderTask.cpp b/libs/hwui/renderthread/RenderTask.cpp
index 7ca61e4..13970ba 100644
--- a/libs/hwui/renderthread/RenderTask.cpp
+++ b/libs/hwui/renderthread/RenderTask.cpp
@@ -14,6 +14,10 @@
* limitations under the License.
*/
+// LOG_TAG is being provided by the Makefile, reset.
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
#define LOG_TAG "RenderTask"
#include "RenderTask.h"
diff --git a/libs/hwui/renderthread/RenderThread.cpp b/libs/hwui/renderthread/RenderThread.cpp
index 38cb4cd..6a55475 100644
--- a/libs/hwui/renderthread/RenderThread.cpp
+++ b/libs/hwui/renderthread/RenderThread.cpp
@@ -171,7 +171,7 @@ void RenderThread::initThreadLocals() {
mRenderState = new RenderState(*this);
}
-int RenderThread::displayEventReceiverCallback(int fd, int events, void* data) {
+int RenderThread::displayEventReceiverCallback(int /* fd */, int events, void* data) {
if (events & (Looper::EVENT_ERROR | Looper::EVENT_HANGUP)) {
ALOGE("Display event receiver pipe was closed or an error occurred. "
"events=0x%x", events);
diff --git a/libs/hwui/tests/main.cpp b/libs/hwui/tests/main.cpp
index 2d99e9f..d847d13 100644
--- a/libs/hwui/tests/main.cpp
+++ b/libs/hwui/tests/main.cpp
@@ -66,7 +66,7 @@ sp<RenderNode> createCard(int x, int y, int width, int height) {
return node;
}
-int main(int argc, char* argv[]) {
+int main() {
createTestEnvironment();
// create the native surface
@@ -111,7 +111,7 @@ int main(int argc, char* argv[]) {
for (int i = 0; i < 150; i++) {
ATRACE_NAME("UI-Draw Frame");
- for (int ci = 0; ci < cards.size(); ci++) {
+ for (size_t ci = 0; ci < cards.size(); ci++) {
cards[ci]->mutateStagingProperties().setTranslationX(i);
cards[ci]->mutateStagingProperties().setTranslationY(i);
cards[ci]->setPropertyFieldsDirty(RenderNode::X | RenderNode::Y);
diff --git a/libs/input/Android.mk b/libs/input/Android.mk
index a7fb0e2..2bbfdcc 100644
--- a/libs/input/Android.mk
+++ b/libs/input/Android.mk
@@ -27,14 +27,14 @@ LOCAL_SHARED_LIBRARIES := \
libskia \
libgui \
libui \
- libinput \
- libinputflinger
+ libinput \
+ libinputflinger
LOCAL_C_INCLUDES := \
frameworks/native/services
-LOCAL_CFLAGS += -Wno-unused-parameter
+LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
LOCAL_MODULE:= libinputservice
diff --git a/libs/input/PointerController.cpp b/libs/input/PointerController.cpp
index 9af521b..1152737 100644
--- a/libs/input/PointerController.cpp
+++ b/libs/input/PointerController.cpp
@@ -25,11 +25,14 @@
#include <cutils/log.h>
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
#include <SkBitmap.h>
#include <SkCanvas.h>
#include <SkColor.h>
#include <SkPaint.h>
#include <SkXfermode.h>
+#pragma GCC diagnostic pop
namespace android {
diff --git a/libs/input/SpriteController.cpp b/libs/input/SpriteController.cpp
index 5391393..0bc832a 100644
--- a/libs/input/SpriteController.cpp
+++ b/libs/input/SpriteController.cpp
@@ -24,11 +24,15 @@
#include <utils/String8.h>
#include <gui/Surface.h>
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
#include <SkBitmap.h>
#include <SkCanvas.h>
#include <SkColor.h>
#include <SkPaint.h>
#include <SkXfermode.h>
+#pragma GCC diagnostic pop
+
#include <android/native_window.h>
namespace android {
diff --git a/libs/storage/Android.mk b/libs/storage/Android.mk
index 7a9dd6c..fae2bf7 100644
--- a/libs/storage/Android.mk
+++ b/libs/storage/Android.mk
@@ -9,4 +9,6 @@ LOCAL_SRC_FILES:= \
LOCAL_MODULE:= libstorage
+LOCAL_CFLAGS += -Wall -Werror
+
include $(BUILD_STATIC_LIBRARY)
diff --git a/libs/storage/IMountService.cpp b/libs/storage/IMountService.cpp
index 621de18..c643ed0 100644
--- a/libs/storage/IMountService.cpp
+++ b/libs/storage/IMountService.cpp
@@ -64,7 +64,7 @@ public:
{
Parcel data, reply;
data.writeInterfaceToken(IMountService::getInterfaceDescriptor());
- data.writeStrongBinder(listener->asBinder());
+ data.writeStrongBinder(IInterface::asBinder(listener));
if (remote()->transact(TRANSACTION_registerListener, data, &reply) != NO_ERROR) {
ALOGD("registerListener could not contact remote\n");
return;
@@ -80,7 +80,7 @@ public:
{
Parcel data, reply;
data.writeInterfaceToken(IMountService::getInterfaceDescriptor());
- data.writeStrongBinder(listener->asBinder());
+ data.writeStrongBinder(IInterface::asBinder(listener));
if (remote()->transact(TRANSACTION_unregisterListener, data, &reply) != NO_ERROR) {
ALOGD("unregisterListener could not contact remote\n");
return;
@@ -207,12 +207,19 @@ public:
ALOGD("getStorageUsers caught exception %d\n", err);
return err;
}
- const int32_t numUsers = reply.readInt32();
+ int32_t numUsersI = reply.readInt32();
+ uint32_t numUsers;
+ if (numUsersI < 0) {
+ ALOGW("Number of users is negative: %d\n", numUsersI);
+ numUsers = 0;
+ } else {
+ numUsers = static_cast<uint32_t>(numUsersI);
+ }
*users = (int32_t*)malloc(sizeof(int32_t)*numUsers);
- for (int i = 0; i < numUsers; i++) {
+ for (size_t i = 0; i < numUsers; i++) {
**users++ = reply.readInt32();
}
- return numUsers;
+ return static_cast<int32_t>(numUsers);
}
int32_t getVolumeState(const String16& mountPoint)
@@ -406,7 +413,7 @@ public:
{
Parcel data, reply;
data.writeInterfaceToken(IMountService::getInterfaceDescriptor());
- data.writeStrongBinder(observer->asBinder());
+ data.writeStrongBinder(IInterface::asBinder(observer));
if (remote()->transact(TRANSACTION_shutdown, data, &reply) != NO_ERROR) {
ALOGD("shutdown could not contact remote\n");
return;
@@ -443,7 +450,7 @@ public:
data.writeString16(rawPath);
data.writeString16(canonicalPath);
data.writeString16(key);
- data.writeStrongBinder(token->asBinder());
+ data.writeStrongBinder(IInterface::asBinder(token));
data.writeInt32(nonce);
if (remote()->transact(TRANSACTION_mountObb, data, &reply) != NO_ERROR) {
ALOGD("mountObb could not contact remote\n");
@@ -463,7 +470,7 @@ public:
data.writeInterfaceToken(IMountService::getInterfaceDescriptor());
data.writeString16(filename);
data.writeInt32(force ? 1 : 0);
- data.writeStrongBinder(token->asBinder());
+ data.writeStrongBinder(IInterface::asBinder(token));
data.writeInt32(nonce);
if (remote()->transact(TRANSACTION_unmountObb, data, &reply) != NO_ERROR) {
ALOGD("unmountObb could not contact remote\n");
@@ -546,8 +553,8 @@ public:
}
};
-IMPLEMENT_META_INTERFACE(MountService, "IMountService");
+IMPLEMENT_META_INTERFACE(MountService, "IMountService")
// ----------------------------------------------------------------------
-};
+}
diff --git a/libs/storage/IMountServiceListener.cpp b/libs/storage/IMountServiceListener.cpp
index c98a424..11b53fd 100644
--- a/libs/storage/IMountServiceListener.cpp
+++ b/libs/storage/IMountServiceListener.cpp
@@ -34,7 +34,7 @@ status_t BnMountServiceListener::onTransact(
onUsbMassStorageConnectionChanged(connected);
reply->writeNoException();
return NO_ERROR;
- } break;
+ }
case TRANSACTION_onStorageStateChanged: {
CHECK_INTERFACE(IMountServiceListener, data, reply);
String16 path = data.readString16();
@@ -50,4 +50,4 @@ status_t BnMountServiceListener::onTransact(
}
// ----------------------------------------------------------------------
-};
+}
diff --git a/libs/storage/IMountShutdownObserver.cpp b/libs/storage/IMountShutdownObserver.cpp
index 1a6fdee..a74a768 100644
--- a/libs/storage/IMountShutdownObserver.cpp
+++ b/libs/storage/IMountShutdownObserver.cpp
@@ -33,11 +33,11 @@ status_t BnMountShutdownObserver::onTransact(
onShutDownComplete(statusCode);
reply->writeNoException();
return NO_ERROR;
- } break;
+ }
default:
return BBinder::onTransact(code, data, reply, flags);
}
}
// ----------------------------------------------------------------------
-};
+}
diff --git a/libs/storage/IObbActionListener.cpp b/libs/storage/IObbActionListener.cpp
index eaa211e..9656e65 100644
--- a/libs/storage/IObbActionListener.cpp
+++ b/libs/storage/IObbActionListener.cpp
@@ -30,10 +30,11 @@ public:
: BpInterface<IObbActionListener>(impl)
{ }
- virtual void onObbResult(const String16& filename, const int32_t nonce, const int32_t state) { }
+ virtual void onObbResult(const String16& /* filename */, const int32_t /* nonce */,
+ const int32_t /* state */) { }
};
-IMPLEMENT_META_INTERFACE(ObbActionListener, "IObbActionListener");
+IMPLEMENT_META_INTERFACE(ObbActionListener, "IObbActionListener")
// ----------------------------------------------------------------------
@@ -49,7 +50,7 @@ status_t BnObbActionListener::onTransact(
onObbResult(filename, nonce, state);
reply->writeNoException();
return NO_ERROR;
- } break;
+ }
default:
return BBinder::onTransact(code, data, reply, flags);
}
@@ -57,4 +58,4 @@ status_t BnObbActionListener::onTransact(
// ----------------------------------------------------------------------
-};
+}
diff --git a/libs/usb/tests/AccessoryChat/accessorychat/Android.mk b/libs/usb/tests/AccessoryChat/accessorychat/Android.mk
index 3e07155..51f2111 100644
--- a/libs/usb/tests/AccessoryChat/accessorychat/Android.mk
+++ b/libs/usb/tests/AccessoryChat/accessorychat/Android.mk
@@ -4,6 +4,7 @@ LOCAL_PATH:= $(call my-dir)
ifeq ($(HOST_OS),linux)
include $(CLEAR_VARS)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_MODULE_TAGS := optional
@@ -21,6 +22,7 @@ endif
# Build for device
include $(CLEAR_VARS)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_MODULE_TAGS := optional