am 85a61c4d: Merge "Only run "core" apps when encrypting device." into ics-factoryrom
* commit '85a61c4d6fedff2f1539e4cfff4b173ce0a28a3f':
Only run "core" apps when encrypting device.
diff --git a/include/utils/threads.h b/include/utils/threads.h
index c685625..ab3e8cd 100644
--- a/include/utils/threads.h
+++ b/include/utils/threads.h
@@ -143,6 +143,10 @@
// in either case errno is set. Thread ID zero means current thread.
extern int androidSetThreadPriority(pid_t tid, int prio);
+// Get the current priority of a particular thread. Returns one of the
+// ANDROID_PRIORITY constants or a negative result in case of error.
+extern int androidGetThreadPriority(pid_t tid);
+
// Get the current scheduling group of a particular thread. Normally returns
// one of the ANDROID_TGROUP constants other than ANDROID_TGROUP_DEFAULT.
// Returns ANDROID_TGROUP_DEFAULT if no pthread support (e.g. on host) or if
diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp
index 79a01a3..f2bc81e 100644
--- a/libs/gui/SurfaceTexture.cpp
+++ b/libs/gui/SurfaceTexture.cpp
@@ -595,7 +595,7 @@
Mutex::Autolock lock(mMutex);
if (mAbandoned) {
- LOGE("connect: SurfaceTexture has been abandoned!");
+ LOGE("disconnect: SurfaceTexture has been abandoned!");
return NO_INIT;
}
diff --git a/libs/utils/Threads.cpp b/libs/utils/Threads.cpp
index 02c380b..5dbcb75 100644
--- a/libs/utils/Threads.cpp
+++ b/libs/utils/Threads.cpp
@@ -368,6 +368,14 @@
return rc;
}
+int androidGetThreadPriority(pid_t tid) {
+#if defined(HAVE_PTHREADS)
+ return getpriority(PRIO_PROCESS, tid);
+#else
+ return ANDROID_PRIORITY_NORMAL;
+#endif
+}
+
int androidGetThreadSchedulingGroup(pid_t tid)
{
int ret = ANDROID_TGROUP_DEFAULT;
diff --git a/opengl/libs/EGL/egl_object.h b/opengl/libs/EGL/egl_object.h
index d2b7378..46f7139 100644
--- a/opengl/libs/EGL/egl_object.h
+++ b/opengl/libs/EGL/egl_object.h
@@ -130,7 +130,7 @@
if (window != NULL) {
native_window_set_buffers_format(window, 0);
if (native_window_api_disconnect(window, NATIVE_WINDOW_API_EGL)) {
- LOGE("EGLNativeWindowType %p disconnected failed", window);
+ LOGW("EGLNativeWindowType %p disconnect failed", window);
}
}
}
diff --git a/opengl/libs/GLES2_dbg/Android.mk b/opengl/libs/GLES2_dbg/Android.mk
index c2b1142..70853d8 100644
--- a/opengl/libs/GLES2_dbg/Android.mk
+++ b/opengl/libs/GLES2_dbg/Android.mk
@@ -31,6 +31,9 @@
LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
endif
+LOCAL_CFLAGS += -DLOG_TAG=\"libGLES2_dbg\"
+
+
# we need to access the private Bionic header <bionic_tls.h>
# on ARM platforms, we need to mirror the ARCH_ARM_HAVE_TLS_REGISTER
# behavior from the bionic Android.mk file
diff --git a/opengl/libs/GLES2_dbg/src/dbgcontext.cpp b/opengl/libs/GLES2_dbg/src/dbgcontext.cpp
index 9e77665..41061e1 100644
--- a/opengl/libs/GLES2_dbg/src/dbgcontext.cpp
+++ b/opengl/libs/GLES2_dbg/src/dbgcontext.cpp
@@ -30,13 +30,11 @@
}
DbgContext::DbgContext(const unsigned version, const gl_hooks_t * const hooks,
- const unsigned MAX_VERTEX_ATTRIBS, const GLenum readFormat,
- const GLenum readType)
+ const unsigned MAX_VERTEX_ATTRIBS)
: lzf_buf(NULL), lzf_readIndex(0), lzf_refSize(0), lzf_refBufSize(0)
, version(version), hooks(hooks)
, MAX_VERTEX_ATTRIBS(MAX_VERTEX_ATTRIBS)
- , readFormat(readFormat), readType(readType)
- , readBytesPerPixel(GetBytesPerPixel(readFormat, readType))
+ , readBytesPerPixel(4)
, captureSwap(0), captureDraw(0)
, vertexAttribs(new VertexAttrib[MAX_VERTEX_ATTRIBS])
, hasNonVBOAttribs(false), indexBuffers(NULL), indexBuffer(NULL)
@@ -67,11 +65,7 @@
assert(GL_NO_ERROR == hooks->gl.glGetError());
GLint MAX_VERTEX_ATTRIBS = 0;
hooks->gl.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &MAX_VERTEX_ATTRIBS);
- GLint readFormat, readType;
- hooks->gl.glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &readFormat);
- hooks->gl.glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &readType);
- DbgContext* dbg = new DbgContext(version, hooks, MAX_VERTEX_ATTRIBS, readFormat, readType);
-
+ DbgContext* dbg = new DbgContext(version, hooks, MAX_VERTEX_ATTRIBS);
glesv2debugger::Message msg, cmd;
msg.set_context_id(reinterpret_cast<int>(dbg));
msg.set_expect_response(false);
@@ -100,33 +94,31 @@
{
switch (type) {
case GL_UNSIGNED_SHORT_5_6_5:
- return 2;
case GL_UNSIGNED_SHORT_4_4_4_4:
- return 2;
case GL_UNSIGNED_SHORT_5_5_5_1:
return 2;
case GL_UNSIGNED_BYTE:
break;
default:
- assert(0);
+ LOGE("GetBytesPerPixel: unknown type %x", type);
}
switch (format) {
case GL_ALPHA:
- return 1;
case GL_LUMINANCE:
return 1;
- break;
case GL_LUMINANCE_ALPHA:
return 2;
case GL_RGB:
return 3;
case GL_RGBA:
+ case 0x80E1: // GL_BGRA_EXT
return 4;
default:
- assert(0);
- return 0;
+ LOGE("GetBytesPerPixel: unknown format %x", format);
}
+
+ return 1; // in doubt...
}
void DbgContext::Fetch(const unsigned index, std::string * const data) const
diff --git a/opengl/libs/GLES2_dbg/src/egl.cpp b/opengl/libs/GLES2_dbg/src/egl.cpp
index eb28d06..bbea3bd 100644
--- a/opengl/libs/GLES2_dbg/src/egl.cpp
+++ b/opengl/libs/GLES2_dbg/src/egl.cpp
@@ -41,11 +41,11 @@
void * pixels = dbg->GetReadPixelsBuffer(viewport[2] * viewport[3] *
dbg->readBytesPerPixel);
dbg->hooks->gl.glReadPixels(viewport[0], viewport[1], viewport[2],
- viewport[3], dbg->readFormat, dbg->readType, pixels);
+ viewport[3], GL_RGBA, GL_UNSIGNED_BYTE, pixels);
dbg->CompressReadPixelBuffer(msg.mutable_data());
msg.set_data_type(msg.ReferencedImage);
- msg.set_pixel_format(dbg->readFormat);
- msg.set_pixel_type(dbg->readType);
+ msg.set_pixel_format(GL_RGBA);
+ msg.set_pixel_type(GL_UNSIGNED_BYTE);
msg.set_image_width(viewport[2]);
msg.set_image_height(viewport[3]);
}
diff --git a/opengl/libs/GLES2_dbg/src/header.h b/opengl/libs/GLES2_dbg/src/header.h
index f2b1fa6..49f3847 100644
--- a/opengl/libs/GLES2_dbg/src/header.h
+++ b/opengl/libs/GLES2_dbg/src/header.h
@@ -87,7 +87,6 @@
const unsigned int version; // 0 is GLES1, 1 is GLES2
const gl_hooks_t * const hooks;
const unsigned int MAX_VERTEX_ATTRIBS;
- const GLenum readFormat, readType; // implementation supported glReadPixels
const unsigned int readBytesPerPixel;
unsigned int captureSwap; // number of eglSwapBuffers to glReadPixels
@@ -124,8 +123,7 @@
unsigned maxAttrib; // number of slots used by program
DbgContext(const unsigned version, const gl_hooks_t * const hooks,
- const unsigned MAX_VERTEX_ATTRIBS, const GLenum readFormat,
- const GLenum readType);
+ const unsigned MAX_VERTEX_ATTRIBS);
~DbgContext();
void Fetch(const unsigned index, std::string * const data) const;
diff --git a/opengl/libs/GLES2_dbg/src/vertex.cpp b/opengl/libs/GLES2_dbg/src/vertex.cpp
index 029ee3b..28a2420 100644
--- a/opengl/libs/GLES2_dbg/src/vertex.cpp
+++ b/opengl/libs/GLES2_dbg/src/vertex.cpp
@@ -77,7 +77,7 @@
pixels = dbg->GetReadPixelsBuffer(viewport[2] * viewport[3] *
dbg->readBytesPerPixel);
Debug_glReadPixels(viewport[0], viewport[1], viewport[2], viewport[3],
- dbg->readFormat, dbg->readType, pixels);
+ GL_RGBA, GL_UNSIGNED_BYTE, pixels);
}
break;
case glesv2debugger::Message_Function_SKIP:
@@ -134,19 +134,22 @@
msg.set_arg7(dbg->maxAttrib); // indicate capturing vertex data
std::string * const data = msg.mutable_data();
if (GL_UNSIGNED_BYTE == type) {
- if (dbg->indexBuffer)
+ if (dbg->indexBuffer) {
FetchIndexed(count, (unsigned char *)dbg->indexBuffer->data +
(unsigned long)indices, data, dbg);
- else
+ } else {
FetchIndexed(count, (unsigned char *)indices, data, dbg);
+ }
} else if (GL_UNSIGNED_SHORT == type) {
- if (dbg->indexBuffer)
+ if (dbg->indexBuffer) {
FetchIndexed(count, (unsigned short *)((char *)dbg->indexBuffer->data +
(unsigned long)indices), data, dbg);
- else
+ } else {
FetchIndexed(count, (unsigned short *)indices, data, dbg);
- } else
+ }
+ } else {
assert(0);
+ }
void * pixels = NULL;
int viewport[4] = {};
@@ -174,7 +177,7 @@
Send(msg, cmd);
expectResponse = cmd.expect_response();
// TODO: pack glReadPixels data with vertex data instead of
- // relying on sperate call for transport, this would allow
+ // relying on separate call for transport, this would allow
// auto generated message loop using EXTEND_Debug macro
if (dbg->captureDraw > 0) {
dbg->captureDraw--;
@@ -182,7 +185,7 @@
pixels = dbg->GetReadPixelsBuffer(viewport[2] * viewport[3] *
dbg->readBytesPerPixel);
Debug_glReadPixels(viewport[0], viewport[1], viewport[2], viewport[3],
- dbg->readFormat, dbg->readType, pixels);
+ GL_RGBA, GL_UNSIGNED_BYTE, pixels);
}
break;
case glesv2debugger::Message_Function_SKIP:
diff --git a/opengl/libs/GLES2_dbg/test/test_main.cpp b/opengl/libs/GLES2_dbg/test/test_main.cpp
index 058bea4..183bf8e 100644
--- a/opengl/libs/GLES2_dbg/test/test_main.cpp
+++ b/opengl/libs/GLES2_dbg/test/test_main.cpp
@@ -29,7 +29,7 @@
gl_hooks_t hooks;
DbgContextTest()
- : dbg(1, &hooks, 32, GL_RGBA, GL_UNSIGNED_BYTE) {
+ : dbg(1, &hooks, 32) {
// You can do set-up work for each test here.
hooks.gl.glGetError = GetError;
}
diff --git a/opengl/libs/GLES2_dbg/test/test_server.cpp b/opengl/libs/GLES2_dbg/test/test_server.cpp
index bbbe913..0ab87b0 100644
--- a/opengl/libs/GLES2_dbg/test/test_server.cpp
+++ b/opengl/libs/GLES2_dbg/test/test_server.cpp
@@ -151,7 +151,7 @@
virtual void SetUp() {
ServerFileTest::SetUp();
- dbg = new DbgContext(1, &hooks, 32, GL_RGBA, GL_UNSIGNED_BYTE);
+ dbg = new DbgContext(1, &hooks, 32);
ASSERT_NE((void *)NULL, dbg);
for (unsigned int i = 0; i < sizeof(hooks) / sizeof(void *); i++)
((void **)&hooks)[i] = reinterpret_cast<void *>(glNoop);
diff --git a/opengl/libs/GLES2_dbg/test/test_socket.cpp b/opengl/libs/GLES2_dbg/test/test_socket.cpp
index b2148ac..9f815e2 100644
--- a/opengl/libs/GLES2_dbg/test/test_socket.cpp
+++ b/opengl/libs/GLES2_dbg/test/test_socket.cpp
@@ -44,7 +44,7 @@
}
virtual void SetUp() {
- dbg = new DbgContext(1, &hooks, 32, GL_RGBA, GL_UNSIGNED_BYTE);
+ dbg = new DbgContext(1, &hooks, 32);
ASSERT_TRUE(dbg != NULL);
for (unsigned int i = 0; i < sizeof(hooks) / sizeof(void *); i++)
((void **)&hooks)[i] = (void *)glNoop;
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index edbc7b0..f85ce7f 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -404,7 +404,9 @@
void Layer::lockPageFlip(bool& recomputeVisibleRegions)
{
if (mQueuedFrames > 0) {
+ // Capture the old state of the layer for comparisons later
const bool oldOpacity = isOpaque();
+ sp<GraphicBuffer> oldActiveBuffer = mActiveBuffer;
// signal another event if we have more frames pending
if (android_atomic_dec(&mQueuedFrames) > 1) {
@@ -417,7 +419,8 @@
return;
}
- sp<GraphicBuffer> newFrontBuffer(mSurfaceTexture->getCurrentBuffer());
+ // update the active buffer
+ mActiveBuffer = mSurfaceTexture->getCurrentBuffer();
const Rect crop(mSurfaceTexture->getCurrentCrop());
const uint32_t transform(mSurfaceTexture->getCurrentTransform());
@@ -439,16 +442,16 @@
mFlinger->invalidateHwcGeometry();
}
- uint32_t bufWidth = newFrontBuffer->getWidth();
- uint32_t bufHeight = newFrontBuffer->getHeight();
- if (mActiveBuffer != NULL) {
- if (bufWidth != uint32_t(mActiveBuffer->width) ||
- bufHeight != uint32_t(mActiveBuffer->height)) {
+ uint32_t bufWidth = mActiveBuffer->getWidth();
+ uint32_t bufHeight = mActiveBuffer->getHeight();
+ if (oldActiveBuffer != NULL) {
+ if (bufWidth != uint32_t(oldActiveBuffer->width) ||
+ bufHeight != uint32_t(oldActiveBuffer->height)) {
mFlinger->invalidateHwcGeometry();
}
}
- mCurrentOpacity = getOpacityForFormat(newFrontBuffer->format);
+ mCurrentOpacity = getOpacityForFormat(mActiveBuffer->format);
if (oldOpacity != isOpaque()) {
recomputeVisibleRegions = true;
}
@@ -462,9 +465,6 @@
// FIXME: mPostedDirtyRegion = dirty & bounds
mPostedDirtyRegion.set(front.w, front.h);
- // update active buffer
- mActiveBuffer = newFrontBuffer;
-
if ((front.w != front.requested_w) ||
(front.h != front.requested_h))
{