Skip some unnecessary allocations
- Move new matrix/rect construction to if the param is set on the builder, we only apply the params if the flags are set anyways and if the caller doesn't set those params then we are allocating new objects unnecessarily - Always recycle motion event Bug: 183756396 Test: Take memory profile when dragging pip Change-Id: Ie7457c8c508ee61bd27daeebe486c39a5cebe7d7
This commit is contained in:
@@ -191,7 +191,7 @@ public class SyncRtSurfaceTransactionApplier {
|
||||
* @return this Builder
|
||||
*/
|
||||
public Builder withMatrix(Matrix matrix) {
|
||||
this.matrix = matrix;
|
||||
this.matrix = new Matrix(matrix);
|
||||
flags |= FLAG_MATRIX;
|
||||
return this;
|
||||
}
|
||||
@@ -201,7 +201,7 @@ public class SyncRtSurfaceTransactionApplier {
|
||||
* @return this Builder
|
||||
*/
|
||||
public Builder withWindowCrop(Rect windowCrop) {
|
||||
this.windowCrop = windowCrop;
|
||||
this.windowCrop = new Rect(windowCrop);
|
||||
flags |= FLAG_WINDOW_CROP;
|
||||
return this;
|
||||
}
|
||||
@@ -272,8 +272,8 @@ public class SyncRtSurfaceTransactionApplier {
|
||||
this.flags = params;
|
||||
this.surface = surface;
|
||||
this.alpha = alpha;
|
||||
this.matrix = new Matrix(matrix);
|
||||
this.windowCrop = new Rect(windowCrop);
|
||||
this.matrix = matrix;
|
||||
this.windowCrop = windowCrop;
|
||||
this.layer = layer;
|
||||
this.cornerRadius = cornerRadius;
|
||||
this.backgroundBlurRadius = backgroundBlurRadius;
|
||||
|
||||
@@ -625,6 +625,7 @@ public class PipTouchHandler {
|
||||
}
|
||||
|
||||
mMenuController.handlePointerEvent(cloneEvent);
|
||||
cloneEvent.recycle();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -231,7 +231,7 @@ public class SyncRtSurfaceTransactionApplierCompat {
|
||||
* @return this Builder
|
||||
*/
|
||||
public Builder withMatrix(Matrix matrix) {
|
||||
this.matrix = matrix;
|
||||
this.matrix = new Matrix(matrix);
|
||||
flags |= FLAG_MATRIX;
|
||||
return this;
|
||||
}
|
||||
@@ -241,7 +241,7 @@ public class SyncRtSurfaceTransactionApplierCompat {
|
||||
* @return this Builder
|
||||
*/
|
||||
public Builder withWindowCrop(Rect windowCrop) {
|
||||
this.windowCrop = windowCrop;
|
||||
this.windowCrop = new Rect(windowCrop);
|
||||
flags |= FLAG_WINDOW_CROP;
|
||||
return this;
|
||||
}
|
||||
@@ -324,8 +324,8 @@ public class SyncRtSurfaceTransactionApplierCompat {
|
||||
this.flags = flags;
|
||||
this.surface = surface;
|
||||
this.alpha = alpha;
|
||||
this.matrix = new Matrix(matrix);
|
||||
this.windowCrop = windowCrop != null ? new Rect(windowCrop) : null;
|
||||
this.matrix = matrix;
|
||||
this.windowCrop = windowCrop;
|
||||
this.layer = layer;
|
||||
this.relativeTo = relativeTo;
|
||||
this.relativeLayer = relativeLayer;
|
||||
|
||||
Reference in New Issue
Block a user