Remove unnecessary framework allocations
These allocations were frequently triggered by the home screen. This change
removes dozens of allocations during page scrolls on home.
Change-Id: I7289efa28ecf5bd62459042b10062aa9cf0432dd
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index d1d036c..0837cf4 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -9187,7 +9187,7 @@
}
public final boolean getLocalVisibleRect(Rect r) {
- Point offset = new Point();
+ final Point offset = mAttachInfo != null ? mAttachInfo.mPoint : new Point();
if (getGlobalVisibleRect(r, offset)) {
r.offset(-offset.x, -offset.y); // make r local
return true;
@@ -17007,6 +17007,11 @@
final boolean mDebugLayout = SystemProperties.getBoolean(DEBUG_LAYOUT_PROPERTY, false);
/**
+ * Point used to compute visible regions.
+ */
+ final Point mPoint = new Point();
+
+ /**
* Creates a new set of attachment information with the specified
* events handler and thread.
*