summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Robert Carr <racarr@google.com> 2016-02-01 13:08:15 -0800
committer Robert Carr <racarr@google.com> 2016-02-01 13:08:15 -0800
commite1034cc39a574c3e8dc481810fb8f24571c41d70 (patch)
tree9ce3781abab098750b6d7d00b3d03777ca04d1a4
parentd11c15d418d776d1db33f7664fad2671de0e6669 (diff)
Ensure Surface matrix set even when size unchanged.
Simple error preventing transform matrices from being updated when the size isn't changed. Bug: 26454664 Bug: 25287371 Change-Id: I0e1a71ceda725e26d49786593665cf0865213c91
-rw-r--r--services/core/java/com/android/server/wm/WindowStateAnimator.java5
-rw-r--r--services/core/java/com/android/server/wm/WindowSurfaceController.java23
2 files changed, 23 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java
index cffcc5db36ff..bc46e36e4ab4 100644
--- a/services/core/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java
@@ -1216,10 +1216,11 @@ class WindowStateAnimator {
calculateSurfaceBounds(w, w.getAttrs());
mSurfaceController.setPositionInTransaction(mTmpSize.left, mTmpSize.top, recoveringMemory);
+
+ mSurfaceController.setMatrixInTransaction(mDsDx * w.mHScale, mDtDx * w.mVScale,
+ mDsDy * w.mHScale, mDtDy * w.mVScale, recoveringMemory);
mSurfaceResized = mSurfaceController.setSizeInTransaction(
mTmpSize.width(), mTmpSize.height(),
- mDsDx * w.mHScale, mDtDx * w.mVScale,
- mDsDy * w.mHScale, mDtDy * w.mVScale,
recoveringMemory);
if (mSurfaceResized) {
diff --git a/services/core/java/com/android/server/wm/WindowSurfaceController.java b/services/core/java/com/android/server/wm/WindowSurfaceController.java
index 5674ca2a7109..e14cfdf9aac0 100644
--- a/services/core/java/com/android/server/wm/WindowSurfaceController.java
+++ b/services/core/java/com/android/server/wm/WindowSurfaceController.java
@@ -190,8 +190,27 @@ class WindowSurfaceController {
}
}
- boolean setSizeInTransaction(int width, int height, float dsdx, float dtdx, float dsdy, float dtdy,
+ void setMatrixInTransaction(float dsdx, float dtdx, float dsdy, float dtdy,
boolean recoveringMemory) {
+ try {
+ if (SHOW_TRANSACTIONS) logSurface(
+ "MATRIX [" + dsdx + "," + dtdx + "," + dsdy + "," + dtdy + "]", null);
+ mSurfaceControl.setMatrix(
+ dsdx, dtdx, dsdy, dtdy);
+ } catch (RuntimeException e) {
+ // If something goes wrong with the surface (such
+ // as running out of memory), don't take down the
+ // entire system.
+ Slog.e(TAG, "Error setting matrix on surface surface" + title
+ + " MATRIX [" + dsdx + "," + dtdx + "," + dsdy + "," + dtdy + "]", null);
+ if (!recoveringMemory) {
+ mAnimator.reclaimSomeSurfaceMemory("matrix", true);
+ }
+ }
+ return;
+ }
+
+ boolean setSizeInTransaction(int width, int height, boolean recoveringMemory) {
final boolean surfaceResized = mSurfaceW != width || mSurfaceH != height;
if (surfaceResized) {
mSurfaceW = width;
@@ -201,8 +220,6 @@ class WindowSurfaceController {
if (SHOW_TRANSACTIONS) logSurface(
"SIZE " + width + "x" + height, null);
mSurfaceControl.setSize(width, height);
- mSurfaceControl.setMatrix(
- dsdx, dtdx, dsdy, dtdy);
} catch (RuntimeException e) {
// If something goes wrong with the surface (such
// as running out of memory), don't take down the