Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 83892ecb authored by Andreas Gampe's avatar Andreas Gampe Committed by Android (Google) Code Review
Browse files

Merge "resolved conflicts for merge of 487ae9b8 to lmp-mr1-dev-plus-aosp" into...

Merge "resolved conflicts for merge of 487ae9b8 to lmp-mr1-dev-plus-aosp" into lmp-mr1-dev-plus-aosp
parents 284ab646 dc9c109a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -247,8 +247,8 @@ enum {
#define Res_MAKEINTERNAL(entry) (0x01000000 | (entry&0xFFFF))
#define Res_MAKEARRAY(entry) (0x02000000 | (entry&0xFFFF))

#define Res_MAXPACKAGE 255
#define Res_MAXTYPE 255
static const size_t Res_MAXPACKAGE = 255;
static const size_t Res_MAXTYPE = 255;

/**
 * Representation of a value in a resource, supplying type
+8 −5
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ 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

@@ -71,6 +72,8 @@ LOCAL_SHARED_LIBRARIES := \
    libutils \
    libz

LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code

include $(BUILD_SHARED_LIBRARY)


+8 −2
Original line number Diff line number Diff line
@@ -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);
    }
}

/*
+15 −5
Original line number Diff line number Diff line
@@ -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.
@@ -153,14 +155,18 @@ AssetManager::AssetManager(CacheMode cacheMode)
      mCacheMode(cacheMode), mCacheValid(false)
{
    int count = android_atomic_inc(&gCount) + 1;
    //ALOGI("Creating AssetManager %p #%d\n", this, count);
    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;
@@ -1864,7 +1870,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 +1966,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;
    }
+17 −13
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@

namespace android {

static const bool DEBUG = false;
static const bool kIsDebug = false;

/*
 * File Format (v1):
@@ -62,7 +62,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 +79,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 +112,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 +126,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 +134,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 +152,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 +167,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 +189,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 +342,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=%d m_pos=0x%x m_dataEndPos=0x%x 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 %d bytes", size);
    }
    int amt = read(m_fd, data, size);
    if (amt < 0) {
        m_status = errno;
Loading