Merge "SurfaceTexture: report binder transaction failures" into ics-mr0
diff --git a/libs/gui/SensorManager.cpp b/libs/gui/SensorManager.cpp
index d719efb..4774a58 100644
--- a/libs/gui/SensorManager.cpp
+++ b/libs/gui/SensorManager.cpp
@@ -78,9 +78,23 @@
sp<SensorEventQueue> SensorManager::createEventQueue()
{
- sp<SensorEventQueue> result = new SensorEventQueue(
- mSensorServer->createSensorEventConnection());
- return result;
+ sp<SensorEventQueue> queue;
+
+ if (mSensorServer == NULL) {
+ LOGE("createEventQueue: mSensorSever is NULL");
+ return queue;
+ }
+
+ sp<ISensorEventConnection> connection =
+ mSensorServer->createSensorEventConnection();
+ if (connection == NULL) {
+ LOGE("createEventQueue: connection is NULL");
+ return queue;
+ }
+
+ queue = new SensorEventQueue(connection);
+
+ return queue;
}
// ----------------------------------------------------------------------------
diff --git a/libs/gui/tests/Surface_test.cpp b/libs/gui/tests/Surface_test.cpp
index ce587b3..693b7b8 100644
--- a/libs/gui/tests/Surface_test.cpp
+++ b/libs/gui/tests/Surface_test.cpp
@@ -75,7 +75,7 @@
}
// This test probably doesn't belong here.
-TEST_F(SurfaceTest, ScreenshotsOfProtectedBuffersFail) {
+TEST_F(SurfaceTest, ScreenshotsOfProtectedBuffersSucceed) {
sp<ANativeWindow> anw(mSurface);
// Verify the screenshot works with no protected buffers.
@@ -114,31 +114,8 @@
}
heap = 0;
w = h = fmt = 0;
- ASSERT_EQ(INVALID_OPERATION, sf->captureScreen(0, &heap, &w, &h, &fmt,
+ ASSERT_EQ(NO_ERROR, sf->captureScreen(0, &heap, &w, &h, &fmt,
64, 64, 0, 0x7fffffff));
- ASSERT_TRUE(heap == NULL);
-
- // XXX: This should not be needed, but it seems that the new buffers don't
- // correctly show up after the upcoming dequeue/lock/queue loop without it.
- // We should look into this at some point.
- ASSERT_EQ(NO_ERROR, native_window_set_buffer_count(anw.get(), 3));
-
- // Un-set the PROTECTED usage bit and verify that the screenshot works
- // again. Note that we have to change the buffers geometry to ensure that
- // the buffers get reallocated, as the new usage bits are a subset of the
- // old.
- ASSERT_EQ(NO_ERROR, native_window_set_usage(anw.get(), 0));
- ASSERT_EQ(NO_ERROR, native_window_set_buffers_geometry(anw.get(), 32, 32, 0));
- for (int i = 0; i < 4; i++) {
- // Loop to make sure SurfaceFlinger has retired a protected buffer.
- ASSERT_EQ(NO_ERROR, anw->dequeueBuffer(anw.get(), &buf));
- ASSERT_EQ(NO_ERROR, anw->lockBuffer(anw.get(), buf));
- ASSERT_EQ(NO_ERROR, anw->queueBuffer(anw.get(), buf));
- }
- heap = 0;
- w = h = fmt = 0;
- ASSERT_EQ(NO_ERROR, sf->captureScreen(0, &heap, &w, &h, &fmt, 64, 64, 0,
- 0x7fffffff));
ASSERT_TRUE(heap != NULL);
}
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 1441a54..7c0cd9b 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -451,7 +451,7 @@
}
const DisplayHardware& hw(graphicPlane(0).displayHardware());
- if (LIKELY(hw.canDraw() && !isFrozen())) {
+ if (LIKELY(hw.canDraw())) {
// repaint the framebuffer (if needed)
const int index = hw.getCurrentBufferIndex();
@@ -478,15 +478,13 @@
void SurfaceFlinger::postFramebuffer()
{
- if (!mSwapRegion.isEmpty()) {
- const DisplayHardware& hw(graphicPlane(0).displayHardware());
- const nsecs_t now = systemTime();
- mDebugInSwapBuffers = now;
- hw.flip(mSwapRegion);
- mLastSwapBufferTime = systemTime() - now;
- mDebugInSwapBuffers = 0;
- mSwapRegion.clear();
- }
+ const DisplayHardware& hw(graphicPlane(0).displayHardware());
+ const nsecs_t now = systemTime();
+ mDebugInSwapBuffers = now;
+ hw.flip(mSwapRegion);
+ mLastSwapBufferTime = systemTime() - now;
+ mDebugInSwapBuffers = 0;
+ mSwapRegion.clear();
}
void SurfaceFlinger::handleConsoleEvents()