Merge "Fix 5326463: rework sim state handling in lockscreen" into ics-factoryrom
diff --git a/libs/ui/Region.cpp b/libs/ui/Region.cpp
index a060a5f..5656088 100644
--- a/libs/ui/Region.cpp
+++ b/libs/ui/Region.cpp
@@ -479,6 +479,12 @@
const Region& lhs,
const Rect& rhs, int dx, int dy)
{
+ if (!rhs.isValid()) {
+ LOGE("Region::boolean_operation(op=%d) invalid Rect={%d,%d,%d,%d}",
+ op, rhs.left, rhs.top, rhs.right, rhs.bottom);
+ return;
+ }
+
#if VALIDATE_WITH_CORECG || VALIDATE_REGIONS
boolean_operation(op, dst, lhs, Region(rhs), dx, dy);
#else
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index edbc7b0..49d2c55 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))
{
@@ -578,7 +578,7 @@
uint32_t Layer::getTransformHint() const {
uint32_t orientation = 0;
if (!mFlinger->mDebugDisableTransformHint) {
- orientation = getOrientation();
+ orientation = getPlaneOrientation();
if (orientation & Transform::ROT_INVALID) {
orientation = 0;
}
diff --git a/services/surfaceflinger/LayerBase.cpp b/services/surfaceflinger/LayerBase.cpp
index e5ce814..7a47f62 100644
--- a/services/surfaceflinger/LayerBase.cpp
+++ b/services/surfaceflinger/LayerBase.cpp
@@ -45,6 +45,7 @@
mFlinger(flinger), mFiltering(false),
mNeedsFiltering(false), mInOverlay(false),
mOrientation(0),
+ mPlaneOrientation(0),
mTransactionFlags(0),
mPremultipliedAlpha(true), mName("unnamed"), mDebug(false),
mInvalidate(0)
@@ -256,6 +257,7 @@
// cache a few things...
mOrientation = tr.getOrientation();
+ mPlaneOrientation = planeTransform.getOrientation();
mTransform = tr;
mTransformedBounds = tr.makeBounds(w, h);
}
diff --git a/services/surfaceflinger/LayerBase.h b/services/surfaceflinger/LayerBase.h
index a14b397..268ba2d 100644
--- a/services/surfaceflinger/LayerBase.h
+++ b/services/surfaceflinger/LayerBase.h
@@ -221,6 +221,7 @@
inline State& currentState() { return mCurrentState; }
int32_t getOrientation() const { return mOrientation; }
+ int32_t getPlaneOrientation() const { return mPlaneOrientation; }
protected:
const GraphicPlane& graphicPlane(int dpy) const;
@@ -254,6 +255,7 @@
protected:
// cached during validateVisibility()
int32_t mOrientation;
+ int32_t mPlaneOrientation;
Transform mTransform;
GLfloat mVertices[4][2];
Rect mTransformedBounds;
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 0ef03bb..2be6d18 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -986,19 +986,20 @@
void SurfaceFlinger::composeSurfaces(const Region& dirty)
{
- if (UNLIKELY(!mWormholeRegion.isEmpty())) {
+ const DisplayHardware& hw(graphicPlane(0).displayHardware());
+ HWComposer& hwc(hw.getHwComposer());
+
+ const size_t fbLayerCount = hwc.getLayerCount(HWC_FRAMEBUFFER);
+ if (UNLIKELY(fbLayerCount && !mWormholeRegion.isEmpty())) {
// should never happen unless the window manager has a bug
// draw something...
drawWormhole();
}
- const DisplayHardware& hw(graphicPlane(0).displayHardware());
- HWComposer& hwc(hw.getHwComposer());
- hwc_layer_t* const cur(hwc.getLayers());
-
/*
* and then, render the layers targeted at the framebuffer
*/
+ hwc_layer_t* const cur(hwc.getLayers());
const Vector< sp<LayerBase> >& layers(mVisibleLayersSortedByZ);
size_t count = layers.size();
for (size_t i=0 ; i<count ; i++) {