am 07520c94: Merge "DimLayer : remove unnecessary surface transaction calls"
* commit '07520c944cfce3441621c6d08ca185d0efb3ea50': DimLayer : remove unnecessary surface transaction calls
This commit is contained in:
@@ -140,10 +140,9 @@ public class DimLayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param layer The new layer value.
|
* NOTE: Must be called with Surface transaction open.
|
||||||
* @param inTransaction Whether the call is made within a surface transaction.
|
|
||||||
*/
|
*/
|
||||||
void adjustSurface(int layer, boolean inTransaction) {
|
private void adjustBounds() {
|
||||||
final int dw, dh;
|
final int dw, dh;
|
||||||
final float xPos, yPos;
|
final float xPos, yPos;
|
||||||
if (!mStack.isFullscreen()) {
|
if (!mStack.isFullscreen()) {
|
||||||
@@ -163,29 +162,31 @@ public class DimLayer {
|
|||||||
yPos = -1 * dh / 6;
|
yPos = -1 * dh / 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mDimSurface.setPosition(xPos, yPos);
|
||||||
|
mDimSurface.setSize(dw, dh);
|
||||||
|
|
||||||
|
mLastBounds.set(mBounds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bounds The new bounds to set
|
||||||
|
* @param inTransaction Whether the call is made within a surface transaction.
|
||||||
|
*/
|
||||||
|
void setBounds(Rect bounds, boolean inTransaction) {
|
||||||
|
mBounds.set(bounds);
|
||||||
|
if (isDimming() && !mLastBounds.equals(bounds)) {
|
||||||
try {
|
try {
|
||||||
if (!inTransaction) {
|
if (!inTransaction) {
|
||||||
SurfaceControl.openTransaction();
|
SurfaceControl.openTransaction();
|
||||||
}
|
}
|
||||||
mDimSurface.setPosition(xPos, yPos);
|
adjustBounds();
|
||||||
mDimSurface.setSize(dw, dh);
|
|
||||||
mDimSurface.setLayer(layer);
|
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
Slog.w(TAG, "Failure setting size or layer", e);
|
Slog.w(TAG, "Failure setting size", e);
|
||||||
} finally {
|
} finally {
|
||||||
if (!inTransaction) {
|
if (!inTransaction) {
|
||||||
SurfaceControl.closeTransaction();
|
SurfaceControl.closeTransaction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mLastBounds.set(mBounds);
|
|
||||||
mLayer = layer;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Assumes that surface transactions are currently closed.
|
|
||||||
void setBounds(Rect bounds) {
|
|
||||||
mBounds.set(bounds);
|
|
||||||
if (isDimming() && !mLastBounds.equals(bounds)) {
|
|
||||||
adjustSurface(mLayer, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,9 +225,10 @@ public class DimLayer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mLastBounds.equals(mBounds) || mLayer != layer) {
|
if (!mLastBounds.equals(mBounds)) {
|
||||||
adjustSurface(layer, true);
|
adjustBounds();
|
||||||
}
|
}
|
||||||
|
setLayer(layer);
|
||||||
|
|
||||||
long curTime = SystemClock.uptimeMillis();
|
long curTime = SystemClock.uptimeMillis();
|
||||||
final boolean animating = isAnimating();
|
final boolean animating = isAnimating();
|
||||||
|
|||||||
@@ -126,8 +126,8 @@ public class TaskStack {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
mDimLayer.setBounds(bounds);
|
mDimLayer.setBounds(bounds, false);
|
||||||
mAnimationBackgroundSurface.setBounds(bounds);
|
mAnimationBackgroundSurface.setBounds(bounds, false);
|
||||||
mBounds.set(bounds);
|
mBounds.set(bounds);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user