Merge ee4618bc
Change-Id: Ie1dc6ad38e7c30636d80f6caef11cf6673144940
This commit is contained in:
commit
0190e4d0b1
@ -24,8 +24,8 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
//#undef LOGV
|
//#undef ALOGV
|
||||||
//#define LOGV(...) fprintf(stderr, __VA_ARGS__)
|
//#define ALOGV(...) fprintf(stderr, __VA_ARGS__)
|
||||||
|
|
||||||
namespace android {
|
namespace android {
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ void BpBinder::ObjectManager::detach(const void* objectID)
|
|||||||
void BpBinder::ObjectManager::kill()
|
void BpBinder::ObjectManager::kill()
|
||||||
{
|
{
|
||||||
const size_t N = mObjects.size();
|
const size_t N = mObjects.size();
|
||||||
LOGV("Killing %d objects in manager %p", N, this);
|
ALOGV("Killing %d objects in manager %p", N, this);
|
||||||
for (size_t i=0; i<N; i++) {
|
for (size_t i=0; i<N; i++) {
|
||||||
const entry_t& e = mObjects.valueAt(i);
|
const entry_t& e = mObjects.valueAt(i);
|
||||||
if (e.func != NULL) {
|
if (e.func != NULL) {
|
||||||
@ -92,7 +92,7 @@ BpBinder::BpBinder(int32_t handle)
|
|||||||
, mObitsSent(0)
|
, mObitsSent(0)
|
||||||
, mObituaries(NULL)
|
, mObituaries(NULL)
|
||||||
{
|
{
|
||||||
LOGV("Creating BpBinder %p handle %d\n", this, mHandle);
|
ALOGV("Creating BpBinder %p handle %d\n", this, mHandle);
|
||||||
|
|
||||||
extendObjectLifetime(OBJECT_LIFETIME_WEAK);
|
extendObjectLifetime(OBJECT_LIFETIME_WEAK);
|
||||||
IPCThreadState::self()->incWeakHandle(handle);
|
IPCThreadState::self()->incWeakHandle(handle);
|
||||||
@ -190,7 +190,7 @@ status_t BpBinder::linkToDeath(
|
|||||||
if (!mObituaries) {
|
if (!mObituaries) {
|
||||||
return NO_MEMORY;
|
return NO_MEMORY;
|
||||||
}
|
}
|
||||||
LOGV("Requesting death notification: %p handle %d\n", this, mHandle);
|
ALOGV("Requesting death notification: %p handle %d\n", this, mHandle);
|
||||||
getWeakRefs()->incWeak(this);
|
getWeakRefs()->incWeak(this);
|
||||||
IPCThreadState* self = IPCThreadState::self();
|
IPCThreadState* self = IPCThreadState::self();
|
||||||
self->requestDeathNotification(mHandle, this);
|
self->requestDeathNotification(mHandle, this);
|
||||||
@ -226,7 +226,7 @@ status_t BpBinder::unlinkToDeath(
|
|||||||
}
|
}
|
||||||
mObituaries->removeAt(i);
|
mObituaries->removeAt(i);
|
||||||
if (mObituaries->size() == 0) {
|
if (mObituaries->size() == 0) {
|
||||||
LOGV("Clearing death notification: %p handle %d\n", this, mHandle);
|
ALOGV("Clearing death notification: %p handle %d\n", this, mHandle);
|
||||||
IPCThreadState* self = IPCThreadState::self();
|
IPCThreadState* self = IPCThreadState::self();
|
||||||
self->clearDeathNotification(mHandle, this);
|
self->clearDeathNotification(mHandle, this);
|
||||||
self->flushCommands();
|
self->flushCommands();
|
||||||
@ -242,7 +242,7 @@ status_t BpBinder::unlinkToDeath(
|
|||||||
|
|
||||||
void BpBinder::sendObituary()
|
void BpBinder::sendObituary()
|
||||||
{
|
{
|
||||||
LOGV("Sending obituary for proxy %p handle %d, mObitsSent=%s\n",
|
ALOGV("Sending obituary for proxy %p handle %d, mObitsSent=%s\n",
|
||||||
this, mHandle, mObitsSent ? "true" : "false");
|
this, mHandle, mObitsSent ? "true" : "false");
|
||||||
|
|
||||||
mAlive = 0;
|
mAlive = 0;
|
||||||
@ -251,7 +251,7 @@ void BpBinder::sendObituary()
|
|||||||
mLock.lock();
|
mLock.lock();
|
||||||
Vector<Obituary>* obits = mObituaries;
|
Vector<Obituary>* obits = mObituaries;
|
||||||
if(obits != NULL) {
|
if(obits != NULL) {
|
||||||
LOGV("Clearing sent death notification: %p handle %d\n", this, mHandle);
|
ALOGV("Clearing sent death notification: %p handle %d\n", this, mHandle);
|
||||||
IPCThreadState* self = IPCThreadState::self();
|
IPCThreadState* self = IPCThreadState::self();
|
||||||
self->clearDeathNotification(mHandle, this);
|
self->clearDeathNotification(mHandle, this);
|
||||||
self->flushCommands();
|
self->flushCommands();
|
||||||
@ -260,7 +260,7 @@ void BpBinder::sendObituary()
|
|||||||
mObitsSent = 1;
|
mObitsSent = 1;
|
||||||
mLock.unlock();
|
mLock.unlock();
|
||||||
|
|
||||||
LOGV("Reporting death of proxy %p for %d recipients\n",
|
ALOGV("Reporting death of proxy %p for %d recipients\n",
|
||||||
this, obits ? obits->size() : 0);
|
this, obits ? obits->size() : 0);
|
||||||
|
|
||||||
if (obits != NULL) {
|
if (obits != NULL) {
|
||||||
@ -276,7 +276,7 @@ void BpBinder::sendObituary()
|
|||||||
void BpBinder::reportOneDeath(const Obituary& obit)
|
void BpBinder::reportOneDeath(const Obituary& obit)
|
||||||
{
|
{
|
||||||
sp<DeathRecipient> recipient = obit.recipient.promote();
|
sp<DeathRecipient> recipient = obit.recipient.promote();
|
||||||
LOGV("Reporting death to recipient: %p\n", recipient.get());
|
ALOGV("Reporting death to recipient: %p\n", recipient.get());
|
||||||
if (recipient == NULL) return;
|
if (recipient == NULL) return;
|
||||||
|
|
||||||
recipient->binderDied(this);
|
recipient->binderDied(this);
|
||||||
@ -288,7 +288,7 @@ void BpBinder::attachObject(
|
|||||||
object_cleanup_func func)
|
object_cleanup_func func)
|
||||||
{
|
{
|
||||||
AutoMutex _l(mLock);
|
AutoMutex _l(mLock);
|
||||||
LOGV("Attaching object %p to binder %p (manager=%p)", object, this, &mObjects);
|
ALOGV("Attaching object %p to binder %p (manager=%p)", object, this, &mObjects);
|
||||||
mObjects.attach(objectID, object, cleanupCookie, func);
|
mObjects.attach(objectID, object, cleanupCookie, func);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,7 +311,7 @@ BpBinder* BpBinder::remoteBinder()
|
|||||||
|
|
||||||
BpBinder::~BpBinder()
|
BpBinder::~BpBinder()
|
||||||
{
|
{
|
||||||
LOGV("Destroying BpBinder %p handle %d\n", this, mHandle);
|
ALOGV("Destroying BpBinder %p handle %d\n", this, mHandle);
|
||||||
|
|
||||||
IPCThreadState* ipc = IPCThreadState::self();
|
IPCThreadState* ipc = IPCThreadState::self();
|
||||||
|
|
||||||
@ -338,15 +338,15 @@ BpBinder::~BpBinder()
|
|||||||
|
|
||||||
void BpBinder::onFirstRef()
|
void BpBinder::onFirstRef()
|
||||||
{
|
{
|
||||||
LOGV("onFirstRef BpBinder %p handle %d\n", this, mHandle);
|
ALOGV("onFirstRef BpBinder %p handle %d\n", this, mHandle);
|
||||||
IPCThreadState* ipc = IPCThreadState::self();
|
IPCThreadState* ipc = IPCThreadState::self();
|
||||||
if (ipc) ipc->incStrongHandle(mHandle);
|
if (ipc) ipc->incStrongHandle(mHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BpBinder::onLastStrongRef(const void* id)
|
void BpBinder::onLastStrongRef(const void* id)
|
||||||
{
|
{
|
||||||
LOGV("onLastStrongRef BpBinder %p handle %d\n", this, mHandle);
|
ALOGV("onLastStrongRef BpBinder %p handle %d\n", this, mHandle);
|
||||||
IF_LOGV() {
|
IF_ALOGV() {
|
||||||
printRefs();
|
printRefs();
|
||||||
}
|
}
|
||||||
IPCThreadState* ipc = IPCThreadState::self();
|
IPCThreadState* ipc = IPCThreadState::self();
|
||||||
@ -355,7 +355,7 @@ void BpBinder::onLastStrongRef(const void* id)
|
|||||||
|
|
||||||
bool BpBinder::onIncStrongAttempted(uint32_t flags, const void* id)
|
bool BpBinder::onIncStrongAttempted(uint32_t flags, const void* id)
|
||||||
{
|
{
|
||||||
LOGV("onIncStrongAttempted BpBinder %p handle %d\n", this, mHandle);
|
ALOGV("onIncStrongAttempted BpBinder %p handle %d\n", this, mHandle);
|
||||||
IPCThreadState* ipc = IPCThreadState::self();
|
IPCThreadState* ipc = IPCThreadState::self();
|
||||||
return ipc ? ipc->attemptIncStrongHandle(mHandle) == NO_ERROR : false;
|
return ipc ? ipc->attemptIncStrongHandle(mHandle) == NO_ERROR : false;
|
||||||
}
|
}
|
||||||
|
@ -330,7 +330,7 @@ status_t Parcel::setDataSize(size_t size)
|
|||||||
err = continueWrite(size);
|
err = continueWrite(size);
|
||||||
if (err == NO_ERROR) {
|
if (err == NO_ERROR) {
|
||||||
mDataSize = size;
|
mDataSize = size;
|
||||||
LOGV("setDataSize Setting data size of %p to %d\n", this, mDataSize);
|
ALOGV("setDataSize Setting data size of %p to %d\n", this, mDataSize);
|
||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -534,10 +534,10 @@ status_t Parcel::finishWrite(size_t len)
|
|||||||
{
|
{
|
||||||
//printf("Finish write of %d\n", len);
|
//printf("Finish write of %d\n", len);
|
||||||
mDataPos += len;
|
mDataPos += len;
|
||||||
LOGV("finishWrite Setting data pos of %p to %d\n", this, mDataPos);
|
ALOGV("finishWrite Setting data pos of %p to %d\n", this, mDataPos);
|
||||||
if (mDataPos > mDataSize) {
|
if (mDataPos > mDataSize) {
|
||||||
mDataSize = mDataPos;
|
mDataSize = mDataPos;
|
||||||
LOGV("finishWrite Setting data size of %p to %d\n", this, mDataSize);
|
ALOGV("finishWrite Setting data size of %p to %d\n", this, mDataSize);
|
||||||
}
|
}
|
||||||
//printf("New pos=%d, size=%d\n", mDataPos, mDataSize);
|
//printf("New pos=%d, size=%d\n", mDataPos, mDataSize);
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
@ -730,7 +730,7 @@ status_t Parcel::writeBlob(size_t len, WritableBlob* outBlob)
|
|||||||
status_t status;
|
status_t status;
|
||||||
|
|
||||||
if (!mAllowFds || len <= IN_PLACE_BLOB_LIMIT) {
|
if (!mAllowFds || len <= IN_PLACE_BLOB_LIMIT) {
|
||||||
LOGV("writeBlob: write in place");
|
ALOGV("writeBlob: write in place");
|
||||||
status = writeInt32(0);
|
status = writeInt32(0);
|
||||||
if (status) return status;
|
if (status) return status;
|
||||||
|
|
||||||
@ -741,7 +741,7 @@ status_t Parcel::writeBlob(size_t len, WritableBlob* outBlob)
|
|||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGV("writeBlob: write to ashmem");
|
ALOGV("writeBlob: write to ashmem");
|
||||||
int fd = ashmem_create_region("Parcel Blob", len);
|
int fd = ashmem_create_region("Parcel Blob", len);
|
||||||
if (fd < 0) return NO_MEMORY;
|
if (fd < 0) return NO_MEMORY;
|
||||||
|
|
||||||
@ -865,7 +865,7 @@ status_t Parcel::read(void* outData, size_t len) const
|
|||||||
if ((mDataPos+PAD_SIZE(len)) >= mDataPos && (mDataPos+PAD_SIZE(len)) <= mDataSize) {
|
if ((mDataPos+PAD_SIZE(len)) >= mDataPos && (mDataPos+PAD_SIZE(len)) <= mDataSize) {
|
||||||
memcpy(outData, mData+mDataPos, len);
|
memcpy(outData, mData+mDataPos, len);
|
||||||
mDataPos += PAD_SIZE(len);
|
mDataPos += PAD_SIZE(len);
|
||||||
LOGV("read Setting data pos of %p to %d\n", this, mDataPos);
|
ALOGV("read Setting data pos of %p to %d\n", this, mDataPos);
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
return NOT_ENOUGH_DATA;
|
return NOT_ENOUGH_DATA;
|
||||||
@ -876,7 +876,7 @@ const void* Parcel::readInplace(size_t len) const
|
|||||||
if ((mDataPos+PAD_SIZE(len)) >= mDataPos && (mDataPos+PAD_SIZE(len)) <= mDataSize) {
|
if ((mDataPos+PAD_SIZE(len)) >= mDataPos && (mDataPos+PAD_SIZE(len)) <= mDataSize) {
|
||||||
const void* data = mData+mDataPos;
|
const void* data = mData+mDataPos;
|
||||||
mDataPos += PAD_SIZE(len);
|
mDataPos += PAD_SIZE(len);
|
||||||
LOGV("readInplace Setting data pos of %p to %d\n", this, mDataPos);
|
ALOGV("readInplace Setting data pos of %p to %d\n", this, mDataPos);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -987,7 +987,7 @@ const char* Parcel::readCString() const
|
|||||||
if (eos) {
|
if (eos) {
|
||||||
const size_t len = eos - str;
|
const size_t len = eos - str;
|
||||||
mDataPos += PAD_SIZE(len+1);
|
mDataPos += PAD_SIZE(len+1);
|
||||||
LOGV("readCString Setting data pos of %p to %d\n", this, mDataPos);
|
ALOGV("readCString Setting data pos of %p to %d\n", this, mDataPos);
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1102,7 +1102,7 @@ status_t Parcel::readBlob(size_t len, ReadableBlob* outBlob) const
|
|||||||
if (status) return status;
|
if (status) return status;
|
||||||
|
|
||||||
if (!useAshmem) {
|
if (!useAshmem) {
|
||||||
LOGV("readBlob: read in place");
|
ALOGV("readBlob: read in place");
|
||||||
const void* ptr = readInplace(len);
|
const void* ptr = readInplace(len);
|
||||||
if (!ptr) return BAD_VALUE;
|
if (!ptr) return BAD_VALUE;
|
||||||
|
|
||||||
@ -1110,7 +1110,7 @@ status_t Parcel::readBlob(size_t len, ReadableBlob* outBlob) const
|
|||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGV("readBlob: read from ashmem");
|
ALOGV("readBlob: read from ashmem");
|
||||||
int fd = readFileDescriptor();
|
int fd = readFileDescriptor();
|
||||||
if (fd == int(BAD_TYPE)) return BAD_VALUE;
|
if (fd == int(BAD_TYPE)) return BAD_VALUE;
|
||||||
|
|
||||||
@ -1164,7 +1164,7 @@ const flat_binder_object* Parcel::readObject(bool nullMetaData) const
|
|||||||
// When transferring a NULL object, we don't write it into
|
// When transferring a NULL object, we don't write it into
|
||||||
// the object list, so we don't want to check for it when
|
// the object list, so we don't want to check for it when
|
||||||
// reading.
|
// reading.
|
||||||
LOGV("readObject Setting data pos of %p to %d\n", this, mDataPos);
|
ALOGV("readObject Setting data pos of %p to %d\n", this, mDataPos);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1174,7 +1174,7 @@ const flat_binder_object* Parcel::readObject(bool nullMetaData) const
|
|||||||
size_t opos = mNextObjectHint;
|
size_t opos = mNextObjectHint;
|
||||||
|
|
||||||
if (N > 0) {
|
if (N > 0) {
|
||||||
LOGV("Parcel %p looking for obj at %d, hint=%d\n",
|
ALOGV("Parcel %p looking for obj at %d, hint=%d\n",
|
||||||
this, DPOS, opos);
|
this, DPOS, opos);
|
||||||
|
|
||||||
// Start at the current hint position, looking for an object at
|
// Start at the current hint position, looking for an object at
|
||||||
@ -1188,10 +1188,10 @@ const flat_binder_object* Parcel::readObject(bool nullMetaData) const
|
|||||||
}
|
}
|
||||||
if (OBJS[opos] == DPOS) {
|
if (OBJS[opos] == DPOS) {
|
||||||
// Found it!
|
// Found it!
|
||||||
LOGV("Parcel found obj %d at index %d with forward search",
|
ALOGV("Parcel found obj %d at index %d with forward search",
|
||||||
this, DPOS, opos);
|
this, DPOS, opos);
|
||||||
mNextObjectHint = opos+1;
|
mNextObjectHint = opos+1;
|
||||||
LOGV("readObject Setting data pos of %p to %d\n", this, mDataPos);
|
ALOGV("readObject Setting data pos of %p to %d\n", this, mDataPos);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1201,10 +1201,10 @@ const flat_binder_object* Parcel::readObject(bool nullMetaData) const
|
|||||||
}
|
}
|
||||||
if (OBJS[opos] == DPOS) {
|
if (OBJS[opos] == DPOS) {
|
||||||
// Found it!
|
// Found it!
|
||||||
LOGV("Parcel found obj %d at index %d with backward search",
|
ALOGV("Parcel found obj %d at index %d with backward search",
|
||||||
this, DPOS, opos);
|
this, DPOS, opos);
|
||||||
mNextObjectHint = opos+1;
|
mNextObjectHint = opos+1;
|
||||||
LOGV("readObject Setting data pos of %p to %d\n", this, mDataPos);
|
ALOGV("readObject Setting data pos of %p to %d\n", this, mDataPos);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1260,7 +1260,7 @@ void Parcel::ipcSetDataReference(const uint8_t* data, size_t dataSize,
|
|||||||
mDataSize = mDataCapacity = dataSize;
|
mDataSize = mDataCapacity = dataSize;
|
||||||
//LOGI("setDataReference Setting data size of %p to %lu (pid=%d)\n", this, mDataSize, getpid());
|
//LOGI("setDataReference Setting data size of %p to %lu (pid=%d)\n", this, mDataSize, getpid());
|
||||||
mDataPos = 0;
|
mDataPos = 0;
|
||||||
LOGV("setDataReference Setting data pos of %p to %d\n", this, mDataPos);
|
ALOGV("setDataReference Setting data pos of %p to %d\n", this, mDataPos);
|
||||||
mObjects = const_cast<size_t*>(objects);
|
mObjects = const_cast<size_t*>(objects);
|
||||||
mObjectsSize = mObjectsCapacity = objectsCount;
|
mObjectsSize = mObjectsCapacity = objectsCount;
|
||||||
mNextObjectHint = 0;
|
mNextObjectHint = 0;
|
||||||
@ -1370,8 +1370,8 @@ status_t Parcel::restartWrite(size_t desired)
|
|||||||
}
|
}
|
||||||
|
|
||||||
mDataSize = mDataPos = 0;
|
mDataSize = mDataPos = 0;
|
||||||
LOGV("restartWrite Setting data size of %p to %d\n", this, mDataSize);
|
ALOGV("restartWrite Setting data size of %p to %d\n", this, mDataSize);
|
||||||
LOGV("restartWrite Setting data pos of %p to %d\n", this, mDataPos);
|
ALOGV("restartWrite Setting data pos of %p to %d\n", this, mDataPos);
|
||||||
|
|
||||||
free(mObjects);
|
free(mObjects);
|
||||||
mObjects = NULL;
|
mObjects = NULL;
|
||||||
@ -1445,7 +1445,7 @@ status_t Parcel::continueWrite(size_t desired)
|
|||||||
mData = data;
|
mData = data;
|
||||||
mObjects = objects;
|
mObjects = objects;
|
||||||
mDataSize = (mDataSize < desired) ? mDataSize : desired;
|
mDataSize = (mDataSize < desired) ? mDataSize : desired;
|
||||||
LOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize);
|
ALOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize);
|
||||||
mDataCapacity = desired;
|
mDataCapacity = desired;
|
||||||
mObjectsSize = mObjectsCapacity = objectsSize;
|
mObjectsSize = mObjectsCapacity = objectsSize;
|
||||||
mNextObjectHint = 0;
|
mNextObjectHint = 0;
|
||||||
@ -1485,11 +1485,11 @@ status_t Parcel::continueWrite(size_t desired)
|
|||||||
} else {
|
} else {
|
||||||
if (mDataSize > desired) {
|
if (mDataSize > desired) {
|
||||||
mDataSize = desired;
|
mDataSize = desired;
|
||||||
LOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize);
|
ALOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize);
|
||||||
}
|
}
|
||||||
if (mDataPos > desired) {
|
if (mDataPos > desired) {
|
||||||
mDataPos = desired;
|
mDataPos = desired;
|
||||||
LOGV("continueWrite Setting data pos of %p to %d\n", this, mDataPos);
|
ALOGV("continueWrite Setting data pos of %p to %d\n", this, mDataPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1508,8 +1508,8 @@ status_t Parcel::continueWrite(size_t desired)
|
|||||||
|
|
||||||
mData = data;
|
mData = data;
|
||||||
mDataSize = mDataPos = 0;
|
mDataSize = mDataPos = 0;
|
||||||
LOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize);
|
ALOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize);
|
||||||
LOGV("continueWrite Setting data pos of %p to %d\n", this, mDataPos);
|
ALOGV("continueWrite Setting data pos of %p to %d\n", this, mDataPos);
|
||||||
mDataCapacity = desired;
|
mDataCapacity = desired;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1523,8 +1523,8 @@ void Parcel::initState()
|
|||||||
mDataSize = 0;
|
mDataSize = 0;
|
||||||
mDataCapacity = 0;
|
mDataCapacity = 0;
|
||||||
mDataPos = 0;
|
mDataPos = 0;
|
||||||
LOGV("initState Setting data size of %p to %d\n", this, mDataSize);
|
ALOGV("initState Setting data size of %p to %d\n", this, mDataSize);
|
||||||
LOGV("initState Setting data pos of %p to %d\n", this, mDataPos);
|
ALOGV("initState Setting data pos of %p to %d\n", this, mDataPos);
|
||||||
mObjects = NULL;
|
mObjects = NULL;
|
||||||
mObjectsSize = 0;
|
mObjectsSize = 0;
|
||||||
mObjectsCapacity = 0;
|
mObjectsCapacity = 0;
|
||||||
|
@ -288,7 +288,7 @@ void ProcessState::spawnPooledThread(bool isMain)
|
|||||||
int32_t s = android_atomic_add(1, &mThreadPoolSeq);
|
int32_t s = android_atomic_add(1, &mThreadPoolSeq);
|
||||||
char buf[32];
|
char buf[32];
|
||||||
sprintf(buf, "Binder Thread #%d", s);
|
sprintf(buf, "Binder Thread #%d", s);
|
||||||
LOGV("Spawning new pooled thread, name=%s\n", buf);
|
ALOGV("Spawning new pooled thread, name=%s\n", buf);
|
||||||
sp<Thread> t = new PoolThread(isMain);
|
sp<Thread> t = new PoolThread(isMain);
|
||||||
t->run(buf);
|
t->run(buf);
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Macros for including the SurfaceTexture name in log messages
|
// Macros for including the SurfaceTexture name in log messages
|
||||||
#define ST_LOGV(x, ...) LOGV("[%s] "x, mName.string(), ##__VA_ARGS__)
|
#define ST_LOGV(x, ...) ALOGV("[%s] "x, mName.string(), ##__VA_ARGS__)
|
||||||
#define ST_LOGD(x, ...) LOGD("[%s] "x, mName.string(), ##__VA_ARGS__)
|
#define ST_LOGD(x, ...) LOGD("[%s] "x, mName.string(), ##__VA_ARGS__)
|
||||||
#define ST_LOGI(x, ...) LOGI("[%s] "x, mName.string(), ##__VA_ARGS__)
|
#define ST_LOGI(x, ...) LOGI("[%s] "x, mName.string(), ##__VA_ARGS__)
|
||||||
#define ST_LOGW(x, ...) LOGW("[%s] "x, mName.string(), ##__VA_ARGS__)
|
#define ST_LOGW(x, ...) LOGW("[%s] "x, mName.string(), ##__VA_ARGS__)
|
||||||
|
@ -136,13 +136,13 @@ int SurfaceTextureClient::setSwapInterval(int interval) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int SurfaceTextureClient::dequeueBuffer(android_native_buffer_t** buffer) {
|
int SurfaceTextureClient::dequeueBuffer(android_native_buffer_t** buffer) {
|
||||||
LOGV("SurfaceTextureClient::dequeueBuffer");
|
ALOGV("SurfaceTextureClient::dequeueBuffer");
|
||||||
Mutex::Autolock lock(mMutex);
|
Mutex::Autolock lock(mMutex);
|
||||||
int buf = -1;
|
int buf = -1;
|
||||||
status_t result = mSurfaceTexture->dequeueBuffer(&buf, mReqWidth, mReqHeight,
|
status_t result = mSurfaceTexture->dequeueBuffer(&buf, mReqWidth, mReqHeight,
|
||||||
mReqFormat, mReqUsage);
|
mReqFormat, mReqUsage);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
LOGV("dequeueBuffer: ISurfaceTexture::dequeueBuffer(%d, %d, %d, %d)"
|
ALOGV("dequeueBuffer: ISurfaceTexture::dequeueBuffer(%d, %d, %d, %d)"
|
||||||
"failed: %d", mReqWidth, mReqHeight, mReqFormat, mReqUsage,
|
"failed: %d", mReqWidth, mReqHeight, mReqFormat, mReqUsage,
|
||||||
result);
|
result);
|
||||||
return result;
|
return result;
|
||||||
@ -165,7 +165,7 @@ int SurfaceTextureClient::dequeueBuffer(android_native_buffer_t** buffer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int SurfaceTextureClient::cancelBuffer(android_native_buffer_t* buffer) {
|
int SurfaceTextureClient::cancelBuffer(android_native_buffer_t* buffer) {
|
||||||
LOGV("SurfaceTextureClient::cancelBuffer");
|
ALOGV("SurfaceTextureClient::cancelBuffer");
|
||||||
Mutex::Autolock lock(mMutex);
|
Mutex::Autolock lock(mMutex);
|
||||||
int i = getSlotFromBufferLocked(buffer);
|
int i = getSlotFromBufferLocked(buffer);
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
@ -205,18 +205,18 @@ int SurfaceTextureClient::getSlotFromBufferLocked(
|
|||||||
}
|
}
|
||||||
|
|
||||||
int SurfaceTextureClient::lockBuffer(android_native_buffer_t* buffer) {
|
int SurfaceTextureClient::lockBuffer(android_native_buffer_t* buffer) {
|
||||||
LOGV("SurfaceTextureClient::lockBuffer");
|
ALOGV("SurfaceTextureClient::lockBuffer");
|
||||||
Mutex::Autolock lock(mMutex);
|
Mutex::Autolock lock(mMutex);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SurfaceTextureClient::queueBuffer(android_native_buffer_t* buffer) {
|
int SurfaceTextureClient::queueBuffer(android_native_buffer_t* buffer) {
|
||||||
LOGV("SurfaceTextureClient::queueBuffer");
|
ALOGV("SurfaceTextureClient::queueBuffer");
|
||||||
Mutex::Autolock lock(mMutex);
|
Mutex::Autolock lock(mMutex);
|
||||||
int64_t timestamp;
|
int64_t timestamp;
|
||||||
if (mTimestamp == NATIVE_WINDOW_TIMESTAMP_AUTO) {
|
if (mTimestamp == NATIVE_WINDOW_TIMESTAMP_AUTO) {
|
||||||
timestamp = systemTime(SYSTEM_TIME_MONOTONIC);
|
timestamp = systemTime(SYSTEM_TIME_MONOTONIC);
|
||||||
LOGV("SurfaceTextureClient::queueBuffer making up timestamp: %.2f ms",
|
ALOGV("SurfaceTextureClient::queueBuffer making up timestamp: %.2f ms",
|
||||||
timestamp / 1000000.f);
|
timestamp / 1000000.f);
|
||||||
} else {
|
} else {
|
||||||
timestamp = mTimestamp;
|
timestamp = mTimestamp;
|
||||||
@ -234,7 +234,7 @@ int SurfaceTextureClient::queueBuffer(android_native_buffer_t* buffer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int SurfaceTextureClient::query(int what, int* value) const {
|
int SurfaceTextureClient::query(int what, int* value) const {
|
||||||
LOGV("SurfaceTextureClient::query");
|
ALOGV("SurfaceTextureClient::query");
|
||||||
{ // scope for the lock
|
{ // scope for the lock
|
||||||
Mutex::Autolock lock(mMutex);
|
Mutex::Autolock lock(mMutex);
|
||||||
switch (what) {
|
switch (what) {
|
||||||
@ -402,7 +402,7 @@ int SurfaceTextureClient::dispatchUnlockAndPost(va_list args) {
|
|||||||
|
|
||||||
|
|
||||||
int SurfaceTextureClient::connect(int api) {
|
int SurfaceTextureClient::connect(int api) {
|
||||||
LOGV("SurfaceTextureClient::connect");
|
ALOGV("SurfaceTextureClient::connect");
|
||||||
Mutex::Autolock lock(mMutex);
|
Mutex::Autolock lock(mMutex);
|
||||||
int err = mSurfaceTexture->connect(api,
|
int err = mSurfaceTexture->connect(api,
|
||||||
&mDefaultWidth, &mDefaultHeight, &mTransformHint);
|
&mDefaultWidth, &mDefaultHeight, &mTransformHint);
|
||||||
@ -413,7 +413,7 @@ int SurfaceTextureClient::connect(int api) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int SurfaceTextureClient::disconnect(int api) {
|
int SurfaceTextureClient::disconnect(int api) {
|
||||||
LOGV("SurfaceTextureClient::disconnect");
|
ALOGV("SurfaceTextureClient::disconnect");
|
||||||
Mutex::Autolock lock(mMutex);
|
Mutex::Autolock lock(mMutex);
|
||||||
freeAllBuffers();
|
freeAllBuffers();
|
||||||
int err = mSurfaceTexture->disconnect(api);
|
int err = mSurfaceTexture->disconnect(api);
|
||||||
@ -431,7 +431,7 @@ int SurfaceTextureClient::disconnect(int api) {
|
|||||||
|
|
||||||
int SurfaceTextureClient::setUsage(uint32_t reqUsage)
|
int SurfaceTextureClient::setUsage(uint32_t reqUsage)
|
||||||
{
|
{
|
||||||
LOGV("SurfaceTextureClient::setUsage");
|
ALOGV("SurfaceTextureClient::setUsage");
|
||||||
Mutex::Autolock lock(mMutex);
|
Mutex::Autolock lock(mMutex);
|
||||||
mReqUsage = reqUsage;
|
mReqUsage = reqUsage;
|
||||||
return OK;
|
return OK;
|
||||||
@ -439,7 +439,7 @@ int SurfaceTextureClient::setUsage(uint32_t reqUsage)
|
|||||||
|
|
||||||
int SurfaceTextureClient::setCrop(Rect const* rect)
|
int SurfaceTextureClient::setCrop(Rect const* rect)
|
||||||
{
|
{
|
||||||
LOGV("SurfaceTextureClient::setCrop");
|
ALOGV("SurfaceTextureClient::setCrop");
|
||||||
Mutex::Autolock lock(mMutex);
|
Mutex::Autolock lock(mMutex);
|
||||||
|
|
||||||
Rect realRect;
|
Rect realRect;
|
||||||
@ -457,7 +457,7 @@ int SurfaceTextureClient::setCrop(Rect const* rect)
|
|||||||
|
|
||||||
int SurfaceTextureClient::setBufferCount(int bufferCount)
|
int SurfaceTextureClient::setBufferCount(int bufferCount)
|
||||||
{
|
{
|
||||||
LOGV("SurfaceTextureClient::setBufferCount");
|
ALOGV("SurfaceTextureClient::setBufferCount");
|
||||||
Mutex::Autolock lock(mMutex);
|
Mutex::Autolock lock(mMutex);
|
||||||
|
|
||||||
status_t err = mSurfaceTexture->setBufferCount(bufferCount);
|
status_t err = mSurfaceTexture->setBufferCount(bufferCount);
|
||||||
@ -473,7 +473,7 @@ int SurfaceTextureClient::setBufferCount(int bufferCount)
|
|||||||
|
|
||||||
int SurfaceTextureClient::setBuffersDimensions(int w, int h)
|
int SurfaceTextureClient::setBuffersDimensions(int w, int h)
|
||||||
{
|
{
|
||||||
LOGV("SurfaceTextureClient::setBuffersDimensions");
|
ALOGV("SurfaceTextureClient::setBuffersDimensions");
|
||||||
Mutex::Autolock lock(mMutex);
|
Mutex::Autolock lock(mMutex);
|
||||||
|
|
||||||
if (w<0 || h<0)
|
if (w<0 || h<0)
|
||||||
@ -493,7 +493,7 @@ int SurfaceTextureClient::setBuffersDimensions(int w, int h)
|
|||||||
|
|
||||||
int SurfaceTextureClient::setBuffersFormat(int format)
|
int SurfaceTextureClient::setBuffersFormat(int format)
|
||||||
{
|
{
|
||||||
LOGV("SurfaceTextureClient::setBuffersFormat");
|
ALOGV("SurfaceTextureClient::setBuffersFormat");
|
||||||
Mutex::Autolock lock(mMutex);
|
Mutex::Autolock lock(mMutex);
|
||||||
|
|
||||||
if (format<0)
|
if (format<0)
|
||||||
@ -506,7 +506,7 @@ int SurfaceTextureClient::setBuffersFormat(int format)
|
|||||||
|
|
||||||
int SurfaceTextureClient::setScalingMode(int mode)
|
int SurfaceTextureClient::setScalingMode(int mode)
|
||||||
{
|
{
|
||||||
LOGV("SurfaceTextureClient::setScalingMode(%d)", mode);
|
ALOGV("SurfaceTextureClient::setScalingMode(%d)", mode);
|
||||||
Mutex::Autolock lock(mMutex);
|
Mutex::Autolock lock(mMutex);
|
||||||
// mode is validated on the server
|
// mode is validated on the server
|
||||||
status_t err = mSurfaceTexture->setScalingMode(mode);
|
status_t err = mSurfaceTexture->setScalingMode(mode);
|
||||||
@ -518,7 +518,7 @@ int SurfaceTextureClient::setScalingMode(int mode)
|
|||||||
|
|
||||||
int SurfaceTextureClient::setBuffersTransform(int transform)
|
int SurfaceTextureClient::setBuffersTransform(int transform)
|
||||||
{
|
{
|
||||||
LOGV("SurfaceTextureClient::setBuffersTransform");
|
ALOGV("SurfaceTextureClient::setBuffersTransform");
|
||||||
Mutex::Autolock lock(mMutex);
|
Mutex::Autolock lock(mMutex);
|
||||||
status_t err = mSurfaceTexture->setTransform(transform);
|
status_t err = mSurfaceTexture->setTransform(transform);
|
||||||
return err;
|
return err;
|
||||||
@ -526,7 +526,7 @@ int SurfaceTextureClient::setBuffersTransform(int transform)
|
|||||||
|
|
||||||
int SurfaceTextureClient::setBuffersTimestamp(int64_t timestamp)
|
int SurfaceTextureClient::setBuffersTimestamp(int64_t timestamp)
|
||||||
{
|
{
|
||||||
LOGV("SurfaceTextureClient::setBuffersTimestamp");
|
ALOGV("SurfaceTextureClient::setBuffersTimestamp");
|
||||||
Mutex::Autolock lock(mMutex);
|
Mutex::Autolock lock(mMutex);
|
||||||
mTimestamp = timestamp;
|
mTimestamp = timestamp;
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
|
@ -1399,12 +1399,12 @@ protected:
|
|||||||
// test.
|
// test.
|
||||||
void waitForFrame() {
|
void waitForFrame() {
|
||||||
Mutex::Autolock lock(mMutex);
|
Mutex::Autolock lock(mMutex);
|
||||||
LOGV("+waitForFrame");
|
ALOGV("+waitForFrame");
|
||||||
while (!mFrameAvailable) {
|
while (!mFrameAvailable) {
|
||||||
mFrameAvailableCondition.wait(mMutex);
|
mFrameAvailableCondition.wait(mMutex);
|
||||||
}
|
}
|
||||||
mFrameAvailable = false;
|
mFrameAvailable = false;
|
||||||
LOGV("-waitForFrame");
|
ALOGV("-waitForFrame");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow the producer to return from its swapBuffers call and continue
|
// Allow the producer to return from its swapBuffers call and continue
|
||||||
@ -1412,23 +1412,23 @@ protected:
|
|||||||
// thread once for every frame expected by the test.
|
// thread once for every frame expected by the test.
|
||||||
void finishFrame() {
|
void finishFrame() {
|
||||||
Mutex::Autolock lock(mMutex);
|
Mutex::Autolock lock(mMutex);
|
||||||
LOGV("+finishFrame");
|
ALOGV("+finishFrame");
|
||||||
mFrameFinished = true;
|
mFrameFinished = true;
|
||||||
mFrameFinishCondition.signal();
|
mFrameFinishCondition.signal();
|
||||||
LOGV("-finishFrame");
|
ALOGV("-finishFrame");
|
||||||
}
|
}
|
||||||
|
|
||||||
// This should be called by SurfaceTexture on the producer thread.
|
// This should be called by SurfaceTexture on the producer thread.
|
||||||
virtual void onFrameAvailable() {
|
virtual void onFrameAvailable() {
|
||||||
Mutex::Autolock lock(mMutex);
|
Mutex::Autolock lock(mMutex);
|
||||||
LOGV("+onFrameAvailable");
|
ALOGV("+onFrameAvailable");
|
||||||
mFrameAvailable = true;
|
mFrameAvailable = true;
|
||||||
mFrameAvailableCondition.signal();
|
mFrameAvailableCondition.signal();
|
||||||
while (!mFrameFinished) {
|
while (!mFrameFinished) {
|
||||||
mFrameFinishCondition.wait(mMutex);
|
mFrameFinishCondition.wait(mMutex);
|
||||||
}
|
}
|
||||||
mFrameFinished = false;
|
mFrameFinished = false;
|
||||||
LOGV("-onFrameAvailable");
|
ALOGV("-onFrameAvailable");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -1514,9 +1514,9 @@ TEST_F(SurfaceTextureGLThreadToGLTest,
|
|||||||
for (int i = 0; i < NUM_ITERATIONS; i++) {
|
for (int i = 0; i < NUM_ITERATIONS; i++) {
|
||||||
glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
|
glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
LOGV("+swapBuffers");
|
ALOGV("+swapBuffers");
|
||||||
swapBuffers();
|
swapBuffers();
|
||||||
LOGV("-swapBuffers");
|
ALOGV("-swapBuffers");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1525,9 +1525,9 @@ TEST_F(SurfaceTextureGLThreadToGLTest,
|
|||||||
|
|
||||||
for (int i = 0; i < NUM_ITERATIONS; i++) {
|
for (int i = 0; i < NUM_ITERATIONS; i++) {
|
||||||
mFC->waitForFrame();
|
mFC->waitForFrame();
|
||||||
LOGV("+updateTexImage");
|
ALOGV("+updateTexImage");
|
||||||
mST->updateTexImage();
|
mST->updateTexImage();
|
||||||
LOGV("-updateTexImage");
|
ALOGV("-updateTexImage");
|
||||||
mFC->finishFrame();
|
mFC->finishFrame();
|
||||||
|
|
||||||
// TODO: Add frame verification once RGB TEX_EXTERNAL_OES is supported!
|
// TODO: Add frame verification once RGB TEX_EXTERNAL_OES is supported!
|
||||||
@ -1543,9 +1543,9 @@ TEST_F(SurfaceTextureGLThreadToGLTest,
|
|||||||
for (int i = 0; i < NUM_ITERATIONS; i++) {
|
for (int i = 0; i < NUM_ITERATIONS; i++) {
|
||||||
glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
|
glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
LOGV("+swapBuffers");
|
ALOGV("+swapBuffers");
|
||||||
swapBuffers();
|
swapBuffers();
|
||||||
LOGV("-swapBuffers");
|
ALOGV("-swapBuffers");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1555,9 +1555,9 @@ TEST_F(SurfaceTextureGLThreadToGLTest,
|
|||||||
for (int i = 0; i < NUM_ITERATIONS; i++) {
|
for (int i = 0; i < NUM_ITERATIONS; i++) {
|
||||||
mFC->waitForFrame();
|
mFC->waitForFrame();
|
||||||
mFC->finishFrame();
|
mFC->finishFrame();
|
||||||
LOGV("+updateTexImage");
|
ALOGV("+updateTexImage");
|
||||||
mST->updateTexImage();
|
mST->updateTexImage();
|
||||||
LOGV("-updateTexImage");
|
ALOGV("-updateTexImage");
|
||||||
|
|
||||||
// TODO: Add frame verification once RGB TEX_EXTERNAL_OES is supported!
|
// TODO: Add frame verification once RGB TEX_EXTERNAL_OES is supported!
|
||||||
}
|
}
|
||||||
@ -1573,9 +1573,9 @@ TEST_F(SurfaceTextureGLThreadToGLTest,
|
|||||||
for (int i = 0; i < NUM_ITERATIONS; i++) {
|
for (int i = 0; i < NUM_ITERATIONS; i++) {
|
||||||
glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
|
glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
LOGV("+swapBuffers");
|
ALOGV("+swapBuffers");
|
||||||
swapBuffers();
|
swapBuffers();
|
||||||
LOGV("-swapBuffers");
|
ALOGV("-swapBuffers");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1624,9 +1624,9 @@ TEST_F(SurfaceTextureGLThreadToGLTest,
|
|||||||
for (int i = 0; i < NUM_ITERATIONS-3; i++) {
|
for (int i = 0; i < NUM_ITERATIONS-3; i++) {
|
||||||
mFC->waitForFrame();
|
mFC->waitForFrame();
|
||||||
mFC->finishFrame();
|
mFC->finishFrame();
|
||||||
LOGV("+updateTexImage");
|
ALOGV("+updateTexImage");
|
||||||
mST->updateTexImage();
|
mST->updateTexImage();
|
||||||
LOGV("-updateTexImage");
|
ALOGV("-updateTexImage");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -585,7 +585,7 @@ const void* _FileAsset::getBuffer(bool wordAligned)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGV("Asset %p allocating buffer size %d (smaller than threshold)", this, (int)allocLen);
|
ALOGV("Asset %p allocating buffer size %d (smaller than threshold)", this, (int)allocLen);
|
||||||
if (mLength > 0) {
|
if (mLength > 0) {
|
||||||
long oldPosn = ftell(mFp);
|
long oldPosn = ftell(mFp);
|
||||||
fseek(mFp, mStart, SEEK_SET);
|
fseek(mFp, mStart, SEEK_SET);
|
||||||
@ -597,7 +597,7 @@ const void* _FileAsset::getBuffer(bool wordAligned)
|
|||||||
fseek(mFp, oldPosn, SEEK_SET);
|
fseek(mFp, oldPosn, SEEK_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGV(" getBuffer: loaded into buffer\n");
|
ALOGV(" getBuffer: loaded into buffer\n");
|
||||||
|
|
||||||
mBuf = buf;
|
mBuf = buf;
|
||||||
return mBuf;
|
return mBuf;
|
||||||
@ -610,7 +610,7 @@ const void* _FileAsset::getBuffer(bool wordAligned)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGV(" getBuffer: mapped\n");
|
ALOGV(" getBuffer: mapped\n");
|
||||||
|
|
||||||
mMap = map;
|
mMap = map;
|
||||||
if (!wordAligned) {
|
if (!wordAligned) {
|
||||||
@ -648,13 +648,13 @@ const void* _FileAsset::ensureAlignment(FileMap* map)
|
|||||||
if ((((size_t)data)&0x3) == 0) {
|
if ((((size_t)data)&0x3) == 0) {
|
||||||
// We can return this directly if it is aligned on a word
|
// We can return this directly if it is aligned on a word
|
||||||
// boundary.
|
// boundary.
|
||||||
LOGV("Returning aligned FileAsset %p (%s).", this,
|
ALOGV("Returning aligned FileAsset %p (%s).", this,
|
||||||
getAssetSource());
|
getAssetSource());
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
// If not aligned on a word boundary, then we need to copy it into
|
// If not aligned on a word boundary, then we need to copy it into
|
||||||
// our own buffer.
|
// our own buffer.
|
||||||
LOGV("Copying FileAsset %p (%s) to buffer size %d to make it aligned.", this,
|
ALOGV("Copying FileAsset %p (%s) to buffer size %d to make it aligned.", this,
|
||||||
getAssetSource(), (int)mLength);
|
getAssetSource(), (int)mLength);
|
||||||
unsigned char* buf = new unsigned char[mLength];
|
unsigned char* buf = new unsigned char[mLength];
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
|
@ -167,7 +167,7 @@ bool AssetManager::addAssetPath(const String8& path, void** cookie)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGV("In %p Asset %s path: %s", this,
|
ALOGV("In %p Asset %s path: %s", this,
|
||||||
ap.type == kFileTypeDirectory ? "dir" : "zip", ap.path.string());
|
ap.type == kFileTypeDirectory ? "dir" : "zip", ap.path.string());
|
||||||
|
|
||||||
mAssetPaths.add(ap);
|
mAssetPaths.add(ap);
|
||||||
@ -498,7 +498,7 @@ Asset* AssetManager::open(const char* fileName, AccessMode mode)
|
|||||||
size_t i = mAssetPaths.size();
|
size_t i = mAssetPaths.size();
|
||||||
while (i > 0) {
|
while (i > 0) {
|
||||||
i--;
|
i--;
|
||||||
LOGV("Looking for asset '%s' in '%s'\n",
|
ALOGV("Looking for asset '%s' in '%s'\n",
|
||||||
assetName.string(), mAssetPaths.itemAt(i).path.string());
|
assetName.string(), mAssetPaths.itemAt(i).path.string());
|
||||||
Asset* pAsset = openNonAssetInPathLocked(assetName.string(), mode, mAssetPaths.itemAt(i));
|
Asset* pAsset = openNonAssetInPathLocked(assetName.string(), mode, mAssetPaths.itemAt(i));
|
||||||
if (pAsset != NULL) {
|
if (pAsset != NULL) {
|
||||||
@ -532,7 +532,7 @@ Asset* AssetManager::openNonAsset(const char* fileName, AccessMode mode)
|
|||||||
size_t i = mAssetPaths.size();
|
size_t i = mAssetPaths.size();
|
||||||
while (i > 0) {
|
while (i > 0) {
|
||||||
i--;
|
i--;
|
||||||
LOGV("Looking for non-asset '%s' in '%s'\n", fileName, mAssetPaths.itemAt(i).path.string());
|
ALOGV("Looking for non-asset '%s' in '%s'\n", fileName, mAssetPaths.itemAt(i).path.string());
|
||||||
Asset* pAsset = openNonAssetInPathLocked(
|
Asset* pAsset = openNonAssetInPathLocked(
|
||||||
fileName, mode, mAssetPaths.itemAt(i));
|
fileName, mode, mAssetPaths.itemAt(i));
|
||||||
if (pAsset != NULL) {
|
if (pAsset != NULL) {
|
||||||
@ -556,7 +556,7 @@ Asset* AssetManager::openNonAsset(void* cookie, const char* fileName, AccessMode
|
|||||||
loadFileNameCacheLocked();
|
loadFileNameCacheLocked();
|
||||||
|
|
||||||
if (which < mAssetPaths.size()) {
|
if (which < mAssetPaths.size()) {
|
||||||
LOGV("Looking for non-asset '%s' in '%s'\n", fileName,
|
ALOGV("Looking for non-asset '%s' in '%s'\n", fileName,
|
||||||
mAssetPaths.itemAt(which).path.string());
|
mAssetPaths.itemAt(which).path.string());
|
||||||
Asset* pAsset = openNonAssetInPathLocked(
|
Asset* pAsset = openNonAssetInPathLocked(
|
||||||
fileName, mode, mAssetPaths.itemAt(which));
|
fileName, mode, mAssetPaths.itemAt(which));
|
||||||
@ -621,7 +621,7 @@ const ResTable* AssetManager::getResTable(bool required) const
|
|||||||
bool shared = true;
|
bool shared = true;
|
||||||
const asset_path& ap = mAssetPaths.itemAt(i);
|
const asset_path& ap = mAssetPaths.itemAt(i);
|
||||||
Asset* idmap = openIdmapLocked(ap);
|
Asset* idmap = openIdmapLocked(ap);
|
||||||
LOGV("Looking for resource asset in '%s'\n", ap.path.string());
|
ALOGV("Looking for resource asset in '%s'\n", ap.path.string());
|
||||||
if (ap.type != kFileTypeDirectory) {
|
if (ap.type != kFileTypeDirectory) {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
// The first item is typically the framework resources,
|
// The first item is typically the framework resources,
|
||||||
@ -633,7 +633,7 @@ const ResTable* AssetManager::getResTable(bool required) const
|
|||||||
ass = const_cast<AssetManager*>(this)->
|
ass = const_cast<AssetManager*>(this)->
|
||||||
mZipSet.getZipResourceTableAsset(ap.path);
|
mZipSet.getZipResourceTableAsset(ap.path);
|
||||||
if (ass == NULL) {
|
if (ass == NULL) {
|
||||||
LOGV("loading resource table %s\n", ap.path.string());
|
ALOGV("loading resource table %s\n", ap.path.string());
|
||||||
ass = const_cast<AssetManager*>(this)->
|
ass = const_cast<AssetManager*>(this)->
|
||||||
openNonAssetInPathLocked("resources.arsc",
|
openNonAssetInPathLocked("resources.arsc",
|
||||||
Asset::ACCESS_BUFFER,
|
Asset::ACCESS_BUFFER,
|
||||||
@ -648,7 +648,7 @@ const ResTable* AssetManager::getResTable(bool required) const
|
|||||||
// If this is the first resource table in the asset
|
// If this is the first resource table in the asset
|
||||||
// manager, then we are going to cache it so that we
|
// manager, then we are going to cache it so that we
|
||||||
// can quickly copy it out for others.
|
// can quickly copy it out for others.
|
||||||
LOGV("Creating shared resources for %s", ap.path.string());
|
ALOGV("Creating shared resources for %s", ap.path.string());
|
||||||
sharedRes = new ResTable();
|
sharedRes = new ResTable();
|
||||||
sharedRes->add(ass, (void*)(i+1), false, idmap);
|
sharedRes->add(ass, (void*)(i+1), false, idmap);
|
||||||
sharedRes = const_cast<AssetManager*>(this)->
|
sharedRes = const_cast<AssetManager*>(this)->
|
||||||
@ -656,7 +656,7 @@ const ResTable* AssetManager::getResTable(bool required) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOGV("loading resource table %s\n", ap.path.string());
|
ALOGV("loading resource table %s\n", ap.path.string());
|
||||||
Asset* ass = const_cast<AssetManager*>(this)->
|
Asset* ass = const_cast<AssetManager*>(this)->
|
||||||
openNonAssetInPathLocked("resources.arsc",
|
openNonAssetInPathLocked("resources.arsc",
|
||||||
Asset::ACCESS_BUFFER,
|
Asset::ACCESS_BUFFER,
|
||||||
@ -668,12 +668,12 @@ const ResTable* AssetManager::getResTable(bool required) const
|
|||||||
mResources = rt = new ResTable();
|
mResources = rt = new ResTable();
|
||||||
updateResourceParamsLocked();
|
updateResourceParamsLocked();
|
||||||
}
|
}
|
||||||
LOGV("Installing resource asset %p in to table %p\n", ass, mResources);
|
ALOGV("Installing resource asset %p in to table %p\n", ass, mResources);
|
||||||
if (sharedRes != NULL) {
|
if (sharedRes != NULL) {
|
||||||
LOGV("Copying existing resources for %s", ap.path.string());
|
ALOGV("Copying existing resources for %s", ap.path.string());
|
||||||
rt->add(sharedRes);
|
rt->add(sharedRes);
|
||||||
} else {
|
} else {
|
||||||
LOGV("Parsing resources for %s", ap.path.string());
|
ALOGV("Parsing resources for %s", ap.path.string());
|
||||||
rt->add(ass, (void*)(i+1), !shared, idmap);
|
rt->add(ass, (void*)(i+1), !shared, idmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -725,7 +725,7 @@ Asset* AssetManager::openIdmapLocked(const struct asset_path& ap) const
|
|||||||
ass = const_cast<AssetManager*>(this)->
|
ass = const_cast<AssetManager*>(this)->
|
||||||
openAssetFromFileLocked(ap.idmap, Asset::ACCESS_BUFFER);
|
openAssetFromFileLocked(ap.idmap, Asset::ACCESS_BUFFER);
|
||||||
if (ass) {
|
if (ass) {
|
||||||
LOGV("loading idmap %s\n", ap.idmap.string());
|
ALOGV("loading idmap %s\n", ap.idmap.string());
|
||||||
} else {
|
} else {
|
||||||
LOGW("failed to load idmap %s\n", ap.idmap.string());
|
LOGW("failed to load idmap %s\n", ap.idmap.string());
|
||||||
}
|
}
|
||||||
@ -1019,7 +1019,7 @@ String8 AssetManager::createPathNameLocked(const asset_path& ap, const char* roo
|
|||||||
*/
|
*/
|
||||||
ZipFileRO* AssetManager::getZipFileLocked(const asset_path& ap)
|
ZipFileRO* AssetManager::getZipFileLocked(const asset_path& ap)
|
||||||
{
|
{
|
||||||
LOGV("getZipFileLocked() in %p\n", this);
|
ALOGV("getZipFileLocked() in %p\n", this);
|
||||||
|
|
||||||
return mZipSet.getZip(ap.path);
|
return mZipSet.getZip(ap.path);
|
||||||
}
|
}
|
||||||
@ -1086,12 +1086,12 @@ Asset* AssetManager::openAssetFromZipLocked(const ZipFileRO* pZipFile,
|
|||||||
|
|
||||||
if (method == ZipFileRO::kCompressStored) {
|
if (method == ZipFileRO::kCompressStored) {
|
||||||
pAsset = Asset::createFromUncompressedMap(dataMap, mode);
|
pAsset = Asset::createFromUncompressedMap(dataMap, mode);
|
||||||
LOGV("Opened uncompressed entry %s in zip %s mode %d: %p", entryName.string(),
|
ALOGV("Opened uncompressed entry %s in zip %s mode %d: %p", entryName.string(),
|
||||||
dataMap->getFileName(), mode, pAsset);
|
dataMap->getFileName(), mode, pAsset);
|
||||||
} else {
|
} else {
|
||||||
pAsset = Asset::createFromCompressedMap(dataMap, method,
|
pAsset = Asset::createFromCompressedMap(dataMap, method,
|
||||||
uncompressedLen, mode);
|
uncompressedLen, mode);
|
||||||
LOGV("Opened compressed entry %s in zip %s mode %d: %p", entryName.string(),
|
ALOGV("Opened compressed entry %s in zip %s mode %d: %p", entryName.string(),
|
||||||
dataMap->getFileName(), mode, pAsset);
|
dataMap->getFileName(), mode, pAsset);
|
||||||
}
|
}
|
||||||
if (pAsset == NULL) {
|
if (pAsset == NULL) {
|
||||||
@ -1146,10 +1146,10 @@ AssetDir* AssetManager::openDir(const char* dirName)
|
|||||||
i--;
|
i--;
|
||||||
const asset_path& ap = mAssetPaths.itemAt(i);
|
const asset_path& ap = mAssetPaths.itemAt(i);
|
||||||
if (ap.type == kFileTypeRegular) {
|
if (ap.type == kFileTypeRegular) {
|
||||||
LOGV("Adding directory %s from zip %s", dirName, ap.path.string());
|
ALOGV("Adding directory %s from zip %s", dirName, ap.path.string());
|
||||||
scanAndMergeZipLocked(pMergedInfo, ap, kAssetsRoot, dirName);
|
scanAndMergeZipLocked(pMergedInfo, ap, kAssetsRoot, dirName);
|
||||||
} else {
|
} else {
|
||||||
LOGV("Adding directory %s from dir %s", dirName, ap.path.string());
|
ALOGV("Adding directory %s from dir %s", dirName, ap.path.string());
|
||||||
scanAndMergeDirLocked(pMergedInfo, ap, kAssetsRoot, dirName);
|
scanAndMergeDirLocked(pMergedInfo, ap, kAssetsRoot, dirName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1200,10 +1200,10 @@ AssetDir* AssetManager::openNonAssetDir(void* cookie, const char* dirName)
|
|||||||
if (which < mAssetPaths.size()) {
|
if (which < mAssetPaths.size()) {
|
||||||
const asset_path& ap = mAssetPaths.itemAt(which);
|
const asset_path& ap = mAssetPaths.itemAt(which);
|
||||||
if (ap.type == kFileTypeRegular) {
|
if (ap.type == kFileTypeRegular) {
|
||||||
LOGV("Adding directory %s from zip %s", dirName, ap.path.string());
|
ALOGV("Adding directory %s from zip %s", dirName, ap.path.string());
|
||||||
scanAndMergeZipLocked(pMergedInfo, ap, NULL, dirName);
|
scanAndMergeZipLocked(pMergedInfo, ap, NULL, dirName);
|
||||||
} else {
|
} else {
|
||||||
LOGV("Adding directory %s from dir %s", dirName, ap.path.string());
|
ALOGV("Adding directory %s from dir %s", dirName, ap.path.string());
|
||||||
scanAndMergeDirLocked(pMergedInfo, ap, NULL, dirName);
|
scanAndMergeDirLocked(pMergedInfo, ap, NULL, dirName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1325,7 +1325,7 @@ bool AssetManager::scanAndMergeDirLocked(SortedVector<AssetDir::FileInfo>* pMerg
|
|||||||
|
|
||||||
matchIdx = AssetDir::FileInfo::findEntry(pMergedInfo, match);
|
matchIdx = AssetDir::FileInfo::findEntry(pMergedInfo, match);
|
||||||
if (matchIdx > 0) {
|
if (matchIdx > 0) {
|
||||||
LOGV("Excluding '%s' [%s]\n",
|
ALOGV("Excluding '%s' [%s]\n",
|
||||||
pMergedInfo->itemAt(matchIdx).getFileName().string(),
|
pMergedInfo->itemAt(matchIdx).getFileName().string(),
|
||||||
pMergedInfo->itemAt(matchIdx).getSourceName().string());
|
pMergedInfo->itemAt(matchIdx).getSourceName().string());
|
||||||
pMergedInfo->removeAt(matchIdx);
|
pMergedInfo->removeAt(matchIdx);
|
||||||
@ -1365,7 +1365,7 @@ SortedVector<AssetDir::FileInfo>* AssetManager::scanDirLocked(const String8& pat
|
|||||||
struct dirent* entry;
|
struct dirent* entry;
|
||||||
FileType fileType;
|
FileType fileType;
|
||||||
|
|
||||||
LOGV("Scanning dir '%s'\n", path.string());
|
ALOGV("Scanning dir '%s'\n", path.string());
|
||||||
|
|
||||||
dir = opendir(path.string());
|
dir = opendir(path.string());
|
||||||
if (dir == NULL)
|
if (dir == NULL)
|
||||||
@ -1782,7 +1782,7 @@ AssetManager::SharedZip::SharedZip(const String8& path, time_t modWhen)
|
|||||||
{
|
{
|
||||||
//LOGI("Creating SharedZip %p %s\n", this, (const char*)mPath);
|
//LOGI("Creating SharedZip %p %s\n", this, (const char*)mPath);
|
||||||
mZipFile = new ZipFileRO;
|
mZipFile = new ZipFileRO;
|
||||||
LOGV("+++ opening zip '%s'\n", mPath.string());
|
ALOGV("+++ opening zip '%s'\n", mPath.string());
|
||||||
if (mZipFile->open(mPath.string()) != NO_ERROR) {
|
if (mZipFile->open(mPath.string()) != NO_ERROR) {
|
||||||
LOGD("failed to open Zip archive '%s'\n", mPath.string());
|
LOGD("failed to open Zip archive '%s'\n", mPath.string());
|
||||||
delete mZipFile;
|
delete mZipFile;
|
||||||
@ -1811,7 +1811,7 @@ ZipFileRO* AssetManager::SharedZip::getZip()
|
|||||||
|
|
||||||
Asset* AssetManager::SharedZip::getResourceTableAsset()
|
Asset* AssetManager::SharedZip::getResourceTableAsset()
|
||||||
{
|
{
|
||||||
LOGV("Getting from SharedZip %p resource asset %p\n", this, mResourceTableAsset);
|
ALOGV("Getting from SharedZip %p resource asset %p\n", this, mResourceTableAsset);
|
||||||
return mResourceTableAsset;
|
return mResourceTableAsset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1833,7 +1833,7 @@ Asset* AssetManager::SharedZip::setResourceTableAsset(Asset* asset)
|
|||||||
|
|
||||||
ResTable* AssetManager::SharedZip::getResourceTable()
|
ResTable* AssetManager::SharedZip::getResourceTable()
|
||||||
{
|
{
|
||||||
LOGV("Getting from SharedZip %p resource table %p\n", this, mResourceTable);
|
ALOGV("Getting from SharedZip %p resource table %p\n", this, mResourceTable);
|
||||||
return mResourceTable;
|
return mResourceTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1867,7 +1867,7 @@ AssetManager::SharedZip::~SharedZip()
|
|||||||
}
|
}
|
||||||
if (mZipFile != NULL) {
|
if (mZipFile != NULL) {
|
||||||
delete mZipFile;
|
delete mZipFile;
|
||||||
LOGV("Closed '%s'\n", mPath.string());
|
ALOGV("Closed '%s'\n", mPath.string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,23 +48,23 @@ BlobCache::BlobCache(size_t maxKeySize, size_t maxValueSize, size_t maxTotalSize
|
|||||||
mRandState[1] = (now >> 16) & 0xFFFF;
|
mRandState[1] = (now >> 16) & 0xFFFF;
|
||||||
mRandState[2] = (now >> 32) & 0xFFFF;
|
mRandState[2] = (now >> 32) & 0xFFFF;
|
||||||
#endif
|
#endif
|
||||||
LOGV("initializing random seed using %lld", now);
|
ALOGV("initializing random seed using %lld", now);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlobCache::set(const void* key, size_t keySize, const void* value,
|
void BlobCache::set(const void* key, size_t keySize, const void* value,
|
||||||
size_t valueSize) {
|
size_t valueSize) {
|
||||||
if (mMaxKeySize < keySize) {
|
if (mMaxKeySize < keySize) {
|
||||||
LOGV("set: not caching because the key is too large: %d (limit: %d)",
|
ALOGV("set: not caching because the key is too large: %d (limit: %d)",
|
||||||
keySize, mMaxKeySize);
|
keySize, mMaxKeySize);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mMaxValueSize < valueSize) {
|
if (mMaxValueSize < valueSize) {
|
||||||
LOGV("set: not caching because the value is too large: %d (limit: %d)",
|
ALOGV("set: not caching because the value is too large: %d (limit: %d)",
|
||||||
valueSize, mMaxValueSize);
|
valueSize, mMaxValueSize);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mMaxTotalSize < keySize + valueSize) {
|
if (mMaxTotalSize < keySize + valueSize) {
|
||||||
LOGV("set: not caching because the combined key/value size is too "
|
ALOGV("set: not caching because the combined key/value size is too "
|
||||||
"large: %d (limit: %d)", keySize + valueSize, mMaxTotalSize);
|
"large: %d (limit: %d)", keySize + valueSize, mMaxTotalSize);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -93,7 +93,7 @@ void BlobCache::set(const void* key, size_t keySize, const void* value,
|
|||||||
clean();
|
clean();
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
LOGV("set: not caching new key/value pair because the "
|
ALOGV("set: not caching new key/value pair because the "
|
||||||
"total cache size limit would be exceeded: %d "
|
"total cache size limit would be exceeded: %d "
|
||||||
"(limit: %d)",
|
"(limit: %d)",
|
||||||
keySize + valueSize, mMaxTotalSize);
|
keySize + valueSize, mMaxTotalSize);
|
||||||
@ -102,7 +102,7 @@ void BlobCache::set(const void* key, size_t keySize, const void* value,
|
|||||||
}
|
}
|
||||||
mCacheEntries.add(CacheEntry(keyBlob, valueBlob));
|
mCacheEntries.add(CacheEntry(keyBlob, valueBlob));
|
||||||
mTotalSize = newTotalSize;
|
mTotalSize = newTotalSize;
|
||||||
LOGV("set: created new cache entry with %d byte key and %d byte value",
|
ALOGV("set: created new cache entry with %d byte key and %d byte value",
|
||||||
keySize, valueSize);
|
keySize, valueSize);
|
||||||
} else {
|
} else {
|
||||||
// Update the existing cache entry.
|
// Update the existing cache entry.
|
||||||
@ -115,7 +115,7 @@ void BlobCache::set(const void* key, size_t keySize, const void* value,
|
|||||||
clean();
|
clean();
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
LOGV("set: not caching new value because the total cache "
|
ALOGV("set: not caching new value because the total cache "
|
||||||
"size limit would be exceeded: %d (limit: %d)",
|
"size limit would be exceeded: %d (limit: %d)",
|
||||||
keySize + valueSize, mMaxTotalSize);
|
keySize + valueSize, mMaxTotalSize);
|
||||||
break;
|
break;
|
||||||
@ -123,7 +123,7 @@ void BlobCache::set(const void* key, size_t keySize, const void* value,
|
|||||||
}
|
}
|
||||||
mCacheEntries.editItemAt(index).setValue(valueBlob);
|
mCacheEntries.editItemAt(index).setValue(valueBlob);
|
||||||
mTotalSize = newTotalSize;
|
mTotalSize = newTotalSize;
|
||||||
LOGV("set: updated existing cache entry with %d byte key and %d byte "
|
ALOGV("set: updated existing cache entry with %d byte key and %d byte "
|
||||||
"value", keySize, valueSize);
|
"value", keySize, valueSize);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -133,7 +133,7 @@ void BlobCache::set(const void* key, size_t keySize, const void* value,
|
|||||||
size_t BlobCache::get(const void* key, size_t keySize, void* value,
|
size_t BlobCache::get(const void* key, size_t keySize, void* value,
|
||||||
size_t valueSize) {
|
size_t valueSize) {
|
||||||
if (mMaxKeySize < keySize) {
|
if (mMaxKeySize < keySize) {
|
||||||
LOGV("get: not searching because the key is too large: %d (limit %d)",
|
ALOGV("get: not searching because the key is too large: %d (limit %d)",
|
||||||
keySize, mMaxKeySize);
|
keySize, mMaxKeySize);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -141,7 +141,7 @@ size_t BlobCache::get(const void* key, size_t keySize, void* value,
|
|||||||
CacheEntry dummyEntry(dummyKey, NULL);
|
CacheEntry dummyEntry(dummyKey, NULL);
|
||||||
ssize_t index = mCacheEntries.indexOf(dummyEntry);
|
ssize_t index = mCacheEntries.indexOf(dummyEntry);
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
LOGV("get: no cache entry found for key of size %d", keySize);
|
ALOGV("get: no cache entry found for key of size %d", keySize);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,10 +150,10 @@ size_t BlobCache::get(const void* key, size_t keySize, void* value,
|
|||||||
sp<Blob> valueBlob(mCacheEntries[index].getValue());
|
sp<Blob> valueBlob(mCacheEntries[index].getValue());
|
||||||
size_t valueBlobSize = valueBlob->getSize();
|
size_t valueBlobSize = valueBlob->getSize();
|
||||||
if (valueBlobSize <= valueSize) {
|
if (valueBlobSize <= valueSize) {
|
||||||
LOGV("get: copying %d bytes to caller's buffer", valueBlobSize);
|
ALOGV("get: copying %d bytes to caller's buffer", valueBlobSize);
|
||||||
memcpy(value, valueBlob->getData(), valueBlobSize);
|
memcpy(value, valueBlob->getData(), valueBlobSize);
|
||||||
} else {
|
} else {
|
||||||
LOGV("get: caller's buffer is too small for value: %d (needs %d)",
|
ALOGV("get: caller's buffer is too small for value: %d (needs %d)",
|
||||||
valueSize, valueBlobSize);
|
valueSize, valueBlobSize);
|
||||||
}
|
}
|
||||||
return valueBlobSize;
|
return valueBlobSize;
|
||||||
|
@ -190,7 +190,7 @@ try_again:
|
|||||||
|
|
||||||
assert(mBasePtr != NULL);
|
assert(mBasePtr != NULL);
|
||||||
|
|
||||||
LOGV("MAP: base %p/%d data %p/%d\n",
|
ALOGV("MAP: base %p/%d data %p/%d\n",
|
||||||
mBasePtr, (int) mBaseLength, mDataPtr, (int) mDataLength);
|
mBasePtr, (int) mBaseLength, mDataPtr, (int) mDataLength);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -421,7 +421,7 @@ void RefBase::weakref_type::decWeak(const void* id)
|
|||||||
// destroy the object now.
|
// destroy the object now.
|
||||||
delete impl->mBase;
|
delete impl->mBase;
|
||||||
} else {
|
} else {
|
||||||
// LOGV("Freeing refs %p of old RefBase %p\n", this, impl->mBase);
|
// ALOGV("Freeing refs %p of old RefBase %p\n", this, impl->mBase);
|
||||||
delete impl;
|
delete impl;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -69,7 +69,7 @@ namespace android {
|
|||||||
|
|
||||||
static void printToLogFunc(void* cookie, const char* txt)
|
static void printToLogFunc(void* cookie, const char* txt)
|
||||||
{
|
{
|
||||||
LOGV("%s", txt);
|
ALOGV("%s", txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Standard C isspace() is only required to look at the low byte of its input, so
|
// Standard C isspace() is only required to look at the low byte of its input, so
|
||||||
@ -1867,7 +1867,7 @@ status_t ResTable::add(const void* data, size_t size, void* cookie,
|
|||||||
const bool notDeviceEndian = htods(0xf0) != 0xf0;
|
const bool notDeviceEndian = htods(0xf0) != 0xf0;
|
||||||
|
|
||||||
LOAD_TABLE_NOISY(
|
LOAD_TABLE_NOISY(
|
||||||
LOGV("Adding resources to ResTable: data=%p, size=0x%x, cookie=%p, asset=%p, copy=%d "
|
ALOGV("Adding resources to ResTable: data=%p, size=0x%x, cookie=%p, asset=%p, copy=%d "
|
||||||
"idmap=%p\n", data, size, cookie, asset, copyData, idmap));
|
"idmap=%p\n", data, size, cookie, asset, copyData, idmap));
|
||||||
|
|
||||||
if (copyData || notDeviceEndian) {
|
if (copyData || notDeviceEndian) {
|
||||||
@ -2122,7 +2122,7 @@ ssize_t ResTable::getResource(uint32_t resID, Res_value* outValue, bool mayBeBag
|
|||||||
resID, &overlayResID);
|
resID, &overlayResID);
|
||||||
if (retval == NO_ERROR && overlayResID != 0x0) {
|
if (retval == NO_ERROR && overlayResID != 0x0) {
|
||||||
// for this loop iteration, this is the type and entry we really want
|
// for this loop iteration, this is the type and entry we really want
|
||||||
LOGV("resource map 0x%08x -> 0x%08x\n", resID, overlayResID);
|
ALOGV("resource map 0x%08x -> 0x%08x\n", resID, overlayResID);
|
||||||
T = Res_GETTYPE(overlayResID);
|
T = Res_GETTYPE(overlayResID);
|
||||||
E = Res_GETENTRY(overlayResID);
|
E = Res_GETENTRY(overlayResID);
|
||||||
} else {
|
} else {
|
||||||
@ -2401,7 +2401,7 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag,
|
|||||||
resID, &overlayResID);
|
resID, &overlayResID);
|
||||||
if (retval == NO_ERROR && overlayResID != 0x0) {
|
if (retval == NO_ERROR && overlayResID != 0x0) {
|
||||||
// for this loop iteration, this is the type and entry we really want
|
// for this loop iteration, this is the type and entry we really want
|
||||||
LOGV("resource map 0x%08x -> 0x%08x\n", resID, overlayResID);
|
ALOGV("resource map 0x%08x -> 0x%08x\n", resID, overlayResID);
|
||||||
T = Res_GETTYPE(overlayResID);
|
T = Res_GETTYPE(overlayResID);
|
||||||
E = Res_GETENTRY(overlayResID);
|
E = Res_GETENTRY(overlayResID);
|
||||||
} else {
|
} else {
|
||||||
@ -2413,9 +2413,9 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag,
|
|||||||
const ResTable_type* type;
|
const ResTable_type* type;
|
||||||
const ResTable_entry* entry;
|
const ResTable_entry* entry;
|
||||||
const Type* typeClass;
|
const Type* typeClass;
|
||||||
LOGV("Getting entry pkg=%p, t=%d, e=%d\n", package, T, E);
|
ALOGV("Getting entry pkg=%p, t=%d, e=%d\n", package, T, E);
|
||||||
ssize_t offset = getEntry(package, T, E, &mParams, &type, &entry, &typeClass);
|
ssize_t offset = getEntry(package, T, E, &mParams, &type, &entry, &typeClass);
|
||||||
LOGV("Resulting offset=%d\n", offset);
|
ALOGV("Resulting offset=%d\n", offset);
|
||||||
if (offset <= 0) {
|
if (offset <= 0) {
|
||||||
// No {entry, appropriate config} pair found in package. If this
|
// No {entry, appropriate config} pair found in package. If this
|
||||||
// package is an overlay package (ip != 0), this simply means the
|
// package is an overlay package (ip != 0), this simply means the
|
||||||
@ -3898,9 +3898,9 @@ void ResTable::getConfigurations(Vector<ResTable_config>* configs) const
|
|||||||
void ResTable::getLocales(Vector<String8>* locales) const
|
void ResTable::getLocales(Vector<String8>* locales) const
|
||||||
{
|
{
|
||||||
Vector<ResTable_config> configs;
|
Vector<ResTable_config> configs;
|
||||||
LOGV("calling getConfigurations");
|
ALOGV("calling getConfigurations");
|
||||||
getConfigurations(&configs);
|
getConfigurations(&configs);
|
||||||
LOGV("called getConfigurations size=%d", (int)configs.size());
|
ALOGV("called getConfigurations size=%d", (int)configs.size());
|
||||||
const size_t I = configs.size();
|
const size_t I = configs.size();
|
||||||
for (size_t i=0; i<I; i++) {
|
for (size_t i=0; i<I; i++) {
|
||||||
char locale[6];
|
char locale[6];
|
||||||
@ -3924,13 +3924,13 @@ ssize_t ResTable::getEntry(
|
|||||||
const ResTable_type** outType, const ResTable_entry** outEntry,
|
const ResTable_type** outType, const ResTable_entry** outEntry,
|
||||||
const Type** outTypeClass) const
|
const Type** outTypeClass) const
|
||||||
{
|
{
|
||||||
LOGV("Getting entry from package %p\n", package);
|
ALOGV("Getting entry from package %p\n", package);
|
||||||
const ResTable_package* const pkg = package->package;
|
const ResTable_package* const pkg = package->package;
|
||||||
|
|
||||||
const Type* allTypes = package->getType(typeIndex);
|
const Type* allTypes = package->getType(typeIndex);
|
||||||
LOGV("allTypes=%p\n", allTypes);
|
ALOGV("allTypes=%p\n", allTypes);
|
||||||
if (allTypes == NULL) {
|
if (allTypes == NULL) {
|
||||||
LOGV("Skipping entry type index 0x%02x because type is NULL!\n", typeIndex);
|
ALOGV("Skipping entry type index 0x%02x because type is NULL!\n", typeIndex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ StreamingZipInflater::~StreamingZipInflater() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void StreamingZipInflater::initInflateState() {
|
void StreamingZipInflater::initInflateState() {
|
||||||
LOGV("Initializing inflate state");
|
ALOGV("Initializing inflate state");
|
||||||
|
|
||||||
memset(&mInflateState, 0, sizeof(mInflateState));
|
memset(&mInflateState, 0, sizeof(mInflateState));
|
||||||
mInflateState.zalloc = Z_NULL;
|
mInflateState.zalloc = Z_NULL;
|
||||||
@ -152,13 +152,13 @@ ssize_t StreamingZipInflater::read(void* outBuf, size_t count) {
|
|||||||
mInflateState.avail_out = mOutBufSize;
|
mInflateState.avail_out = mOutBufSize;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
LOGV("Inflating to outbuf: avail_in=%u avail_out=%u next_in=%p next_out=%p",
|
ALOGV("Inflating to outbuf: avail_in=%u avail_out=%u next_in=%p next_out=%p",
|
||||||
mInflateState.avail_in, mInflateState.avail_out,
|
mInflateState.avail_in, mInflateState.avail_out,
|
||||||
mInflateState.next_in, mInflateState.next_out);
|
mInflateState.next_in, mInflateState.next_out);
|
||||||
*/
|
*/
|
||||||
int result = Z_OK;
|
int result = Z_OK;
|
||||||
if (mStreamNeedsInit) {
|
if (mStreamNeedsInit) {
|
||||||
LOGV("Initializing zlib to inflate");
|
ALOGV("Initializing zlib to inflate");
|
||||||
result = inflateInit2(&mInflateState, -MAX_WBITS);
|
result = inflateInit2(&mInflateState, -MAX_WBITS);
|
||||||
mStreamNeedsInit = false;
|
mStreamNeedsInit = false;
|
||||||
}
|
}
|
||||||
@ -192,7 +192,7 @@ int StreamingZipInflater::readNextChunk() {
|
|||||||
size_t toRead = min_of(mInBufSize, mInTotalSize - mInNextChunkOffset);
|
size_t toRead = min_of(mInBufSize, mInTotalSize - mInNextChunkOffset);
|
||||||
if (toRead > 0) {
|
if (toRead > 0) {
|
||||||
ssize_t didRead = ::read(mFd, mInBuf, toRead);
|
ssize_t didRead = ::read(mFd, mInBuf, toRead);
|
||||||
//LOGV("Reading input chunk, size %08x didread %08x", toRead, didRead);
|
//ALOGV("Reading input chunk, size %08x didread %08x", toRead, didRead);
|
||||||
if (didRead < 0) {
|
if (didRead < 0) {
|
||||||
// TODO: error
|
// TODO: error
|
||||||
LOGE("Error reading asset data");
|
LOGE("Error reading asset data");
|
||||||
|
@ -346,7 +346,7 @@ void VectorImpl::release_storage()
|
|||||||
|
|
||||||
void* VectorImpl::_grow(size_t where, size_t amount)
|
void* VectorImpl::_grow(size_t where, size_t amount)
|
||||||
{
|
{
|
||||||
// LOGV("_grow(this=%p, where=%d, amount=%d) count=%d, capacity=%d",
|
// ALOGV("_grow(this=%p, where=%d, amount=%d) count=%d, capacity=%d",
|
||||||
// this, (int)where, (int)amount, (int)mCount, (int)capacity());
|
// this, (int)where, (int)amount, (int)mCount, (int)capacity());
|
||||||
|
|
||||||
LOG_ASSERT(where <= mCount,
|
LOG_ASSERT(where <= mCount,
|
||||||
@ -356,7 +356,7 @@ void* VectorImpl::_grow(size_t where, size_t amount)
|
|||||||
const size_t new_size = mCount + amount;
|
const size_t new_size = mCount + amount;
|
||||||
if (capacity() < new_size) {
|
if (capacity() < new_size) {
|
||||||
const size_t new_capacity = max(kMinVectorCapacity, ((new_size*3)+1)/2);
|
const size_t new_capacity = max(kMinVectorCapacity, ((new_size*3)+1)/2);
|
||||||
// LOGV("grow vector %p, new_capacity=%d", this, (int)new_capacity);
|
// ALOGV("grow vector %p, new_capacity=%d", this, (int)new_capacity);
|
||||||
if ((mStorage) &&
|
if ((mStorage) &&
|
||||||
(mCount==where) &&
|
(mCount==where) &&
|
||||||
(mFlags & HAS_TRIVIAL_COPY) &&
|
(mFlags & HAS_TRIVIAL_COPY) &&
|
||||||
@ -399,7 +399,7 @@ void VectorImpl::_shrink(size_t where, size_t amount)
|
|||||||
if (!mStorage)
|
if (!mStorage)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// LOGV("_shrink(this=%p, where=%d, amount=%d) count=%d, capacity=%d",
|
// ALOGV("_shrink(this=%p, where=%d, amount=%d) count=%d, capacity=%d",
|
||||||
// this, (int)where, (int)amount, (int)mCount, (int)capacity());
|
// this, (int)where, (int)amount, (int)mCount, (int)capacity());
|
||||||
|
|
||||||
LOG_ASSERT(where + amount <= mCount,
|
LOG_ASSERT(where + amount <= mCount,
|
||||||
@ -409,7 +409,7 @@ void VectorImpl::_shrink(size_t where, size_t amount)
|
|||||||
const size_t new_size = mCount - amount;
|
const size_t new_size = mCount - amount;
|
||||||
if (new_size*3 < capacity()) {
|
if (new_size*3 < capacity()) {
|
||||||
const size_t new_capacity = max(kMinVectorCapacity, new_size*2);
|
const size_t new_capacity = max(kMinVectorCapacity, new_size*2);
|
||||||
// LOGV("shrink vector %p, new_capacity=%d", this, (int)new_capacity);
|
// ALOGV("shrink vector %p, new_capacity=%d", this, (int)new_capacity);
|
||||||
if ((where == new_size) &&
|
if ((where == new_size) &&
|
||||||
(mFlags & HAS_TRIVIAL_COPY) &&
|
(mFlags & HAS_TRIVIAL_COPY) &&
|
||||||
(mFlags & HAS_TRIVIAL_DTOR))
|
(mFlags & HAS_TRIVIAL_DTOR))
|
||||||
|
@ -222,7 +222,7 @@ bool ZipFileRO::mapCentralDirectory(void)
|
|||||||
free(scanBuf);
|
free(scanBuf);
|
||||||
return false;
|
return false;
|
||||||
} else if (header != kLFHSignature) {
|
} else if (header != kLFHSignature) {
|
||||||
LOGV("Not a Zip archive (found 0x%08x)\n", header);
|
ALOGV("Not a Zip archive (found 0x%08x)\n", header);
|
||||||
free(scanBuf);
|
free(scanBuf);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -264,7 +264,7 @@ bool ZipFileRO::mapCentralDirectory(void)
|
|||||||
int i;
|
int i;
|
||||||
for (i = readAmount - kEOCDLen; i >= 0; i--) {
|
for (i = readAmount - kEOCDLen; i >= 0; i--) {
|
||||||
if (scanBuf[i] == 0x50 && get4LE(&scanBuf[i]) == kEOCDSignature) {
|
if (scanBuf[i] == 0x50 && get4LE(&scanBuf[i]) == kEOCDSignature) {
|
||||||
LOGV("+++ Found EOCD at buf+%d\n", i);
|
ALOGV("+++ Found EOCD at buf+%d\n", i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -299,7 +299,7 @@ bool ZipFileRO::mapCentralDirectory(void)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGV("+++ numEntries=%d dirSize=%d dirOffset=%d\n",
|
ALOGV("+++ numEntries=%d dirSize=%d dirOffset=%d\n",
|
||||||
numEntries, dirSize, dirOffset);
|
numEntries, dirSize, dirOffset);
|
||||||
|
|
||||||
mDirectoryMap = new FileMap();
|
mDirectoryMap = new FileMap();
|
||||||
@ -372,7 +372,7 @@ bool ZipFileRO::parseZipArchive(void)
|
|||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOGV("+++ zip good scan %d entries\n", numEntries);
|
ALOGV("+++ zip good scan %d entries\n", numEntries);
|
||||||
result = true;
|
result = true;
|
||||||
|
|
||||||
bail:
|
bail:
|
||||||
|
@ -95,7 +95,7 @@ using namespace android;
|
|||||||
if (zstream.avail_in == 0) {
|
if (zstream.avail_in == 0) {
|
||||||
getSize = (compRemaining > kReadBufSize) ?
|
getSize = (compRemaining > kReadBufSize) ?
|
||||||
kReadBufSize : compRemaining;
|
kReadBufSize : compRemaining;
|
||||||
LOGV("+++ reading %ld bytes (%ld left)\n",
|
ALOGV("+++ reading %ld bytes (%ld left)\n",
|
||||||
getSize, compRemaining);
|
getSize, compRemaining);
|
||||||
|
|
||||||
int cc = read(fd, readBuf, getSize);
|
int cc = read(fd, readBuf, getSize);
|
||||||
@ -207,7 +207,7 @@ bail:
|
|||||||
if (zstream.avail_in == 0) {
|
if (zstream.avail_in == 0) {
|
||||||
getSize = (compRemaining > kReadBufSize) ?
|
getSize = (compRemaining > kReadBufSize) ?
|
||||||
kReadBufSize : compRemaining;
|
kReadBufSize : compRemaining;
|
||||||
LOGV("+++ reading %ld bytes (%ld left)\n",
|
ALOGV("+++ reading %ld bytes (%ld left)\n",
|
||||||
getSize, compRemaining);
|
getSize, compRemaining);
|
||||||
|
|
||||||
int cc = fread(readBuf, 1, getSize, fp);
|
int cc = fread(readBuf, 1, getSize, fp);
|
||||||
|
Loading…
Reference in New Issue
Block a user