Merge changes I56779420,I044e44e1,Ic5adfa29,Ied541ab8
* changes:
SurfaceTexture: add some GL->GL tests.
SurfaceTexture: fix up a comment.
SurfaceTexture: add getTransformMatrix tests.
SurfaceTexture: fix a getTransformMatrix crash.
diff --git a/include/utils/ResourceTypes.h b/include/utils/ResourceTypes.h
index 8a92cd6..612ff93 100644
--- a/include/utils/ResourceTypes.h
+++ b/include/utils/ResourceTypes.h
@@ -1988,7 +1988,8 @@
String16* outName,
const String16* defType = NULL,
const String16* defPackage = NULL,
- const char** outErrorMsg = NULL);
+ const char** outErrorMsg = NULL,
+ bool* outPublicOnly = NULL);
static bool stringToInt(const char16_t* s, size_t len, Res_value* outValue);
static bool stringToFloat(const char16_t* s, size_t len, Res_value* outValue);
diff --git a/include/utils/threads.h b/include/utils/threads.h
index 41e5766..0bd69cf 100644
--- a/include/utils/threads.h
+++ b/include/utils/threads.h
@@ -526,6 +526,7 @@
Thread& operator=(const Thread&);
static int _threadLoop(void* user);
const bool mCanCallJava;
+ // always hold mLock when reading or writing
thread_id_t mThread;
mutable Mutex mLock;
Condition mThreadExitedCondition;
diff --git a/libs/utils/ResourceTypes.cpp b/libs/utils/ResourceTypes.cpp
index 4a6a3db..cb6c246 100644
--- a/libs/utils/ResourceTypes.cpp
+++ b/libs/utils/ResourceTypes.cpp
@@ -2663,6 +2663,9 @@
goto nope;
}
}
+ if (outTypeSpecFlags) {
+ *outTypeSpecFlags = ResTable_typeSpec::SPEC_PUBLIC;
+ }
return m->id;
nope:
;
@@ -2677,6 +2680,9 @@
index);
return 0;
}
+ if (outTypeSpecFlags) {
+ *outTypeSpecFlags = ResTable_typeSpec::SPEC_PUBLIC;
+ }
return Res_MAKEARRAY(index);
}
}
@@ -2687,6 +2693,8 @@
return 0;
}
+ bool fakePublic = false;
+
// Figure out the package and type we are looking in...
const char16_t* packageEnd = NULL;
@@ -2698,7 +2706,13 @@
else if (*p == '/') typeEnd = p;
p++;
}
- if (*name == '@') name++;
+ if (*name == '@') {
+ name++;
+ if (*name == '*') {
+ fakePublic = true;
+ name++;
+ }
+ }
if (name >= nameEnd) {
return 0;
}
@@ -2803,6 +2817,9 @@
if (dtohl(entry->key.index) == (size_t)ei) {
if (outTypeSpecFlags) {
*outTypeSpecFlags = typeConfigs->typeSpecFlags[i];
+ if (fakePublic) {
+ *outTypeSpecFlags |= ResTable_typeSpec::SPEC_PUBLIC;
+ }
}
return Res_MAKEID(group->id-1, ti, i);
}
@@ -2819,7 +2836,8 @@
String16* outName,
const String16* defType,
const String16* defPackage,
- const char** outErrorMsg)
+ const char** outErrorMsg,
+ bool* outPublicOnly)
{
const char16_t* packageEnd = NULL;
const char16_t* typeEnd = NULL;
@@ -2836,6 +2854,16 @@
p = refStr;
if (*p == '@') p++;
+ if (outPublicOnly != NULL) {
+ *outPublicOnly = true;
+ }
+ if (*p == '*') {
+ p++;
+ if (outPublicOnly != NULL) {
+ *outPublicOnly = false;
+ }
+ }
+
if (packageEnd) {
*outPackage = String16(p, packageEnd-p);
p = packageEnd+1;
diff --git a/libs/utils/StreamingZipInflater.cpp b/libs/utils/StreamingZipInflater.cpp
index 5a162cc..00498bd 100644
--- a/libs/utils/StreamingZipInflater.cpp
+++ b/libs/utils/StreamingZipInflater.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#define LOG_NDEBUG 1
+//#define LOG_NDEBUG 0
#define LOG_TAG "szipinf"
#include <utils/Log.h>
@@ -77,7 +77,7 @@
}
void StreamingZipInflater::initInflateState() {
- LOGD("Initializing inflate state");
+ LOGV("Initializing inflate state");
memset(&mInflateState, 0, sizeof(mInflateState));
mInflateState.zalloc = Z_NULL;
@@ -152,13 +152,13 @@
mInflateState.avail_out = mOutBufSize;
/*
- LOGD("Inflating to outbuf: avail_in=%u avail_out=%u next_in=%p next_out=%p",
+ LOGV("Inflating to outbuf: avail_in=%u avail_out=%u next_in=%p next_out=%p",
mInflateState.avail_in, mInflateState.avail_out,
mInflateState.next_in, mInflateState.next_out);
*/
int result = Z_OK;
if (mStreamNeedsInit) {
- LOGD("Initializing zlib to inflate");
+ LOGV("Initializing zlib to inflate");
result = inflateInit2(&mInflateState, -MAX_WBITS);
mStreamNeedsInit = false;
}
@@ -192,7 +192,7 @@
size_t toRead = min_of(mInBufSize, mInTotalSize - mInNextChunkOffset);
if (toRead > 0) {
ssize_t didRead = ::read(mFd, mInBuf, toRead);
- //LOGD("Reading input chunk, size %08x didread %08x", toRead, didRead);
+ //LOGV("Reading input chunk, size %08x didread %08x", toRead, didRead);
if (didRead < 0) {
// TODO: error
LOGE("Error reading asset data");
diff --git a/libs/utils/Threads.cpp b/libs/utils/Threads.cpp
index 8b5da0e..c748228 100644
--- a/libs/utils/Threads.cpp
+++ b/libs/utils/Threads.cpp
@@ -168,6 +168,9 @@
return 0;
}
+ // Note that *threadID is directly available to the parent only, as it is
+ // assigned after the child starts. Use memory barrier / lock if the child
+ // or other threads also need access.
if (threadId != NULL) {
*threadId = (android_thread_id_t)thread; // XXX: this is not portable
}
@@ -718,7 +721,6 @@
res = androidCreateRawThreadEtc(_threadLoop,
this, name, priority, stack, &mThread);
}
- // The new thread wakes up at _threadLoop, but immediately blocks on mLock
if (res == false) {
mStatus = UNKNOWN_ERROR; // something happened!
@@ -742,11 +744,6 @@
{
Thread* const self = static_cast<Thread*>(user);
- // force a memory barrier before reading any fields, in particular mHoldSelf
- {
- Mutex::Autolock _l(self->mLock);
- }
-
sp<Thread> strong(self->mHoldSelf);
wp<Thread> weak(strong);
self->mHoldSelf.clear();
@@ -816,6 +813,7 @@
status_t Thread::requestExitAndWait()
{
+ Mutex::Autolock _l(mLock);
if (mThread == getThreadId()) {
LOGW(
"Thread (this=%p): don't call waitForExit() from this "
@@ -825,9 +823,8 @@
return WOULD_BLOCK;
}
- requestExit();
+ mExitPending = true;
- Mutex::Autolock _l(mLock);
while (mRunning == true) {
mThreadExitedCondition.wait(mLock);
}