Merge "Add feature for helping apps track how they've been launched" into mnc-ub-dev
diff --git a/v4/java/android/support/v4/widget/ExploreByTouchHelper.java b/v4/java/android/support/v4/widget/ExploreByTouchHelper.java
index 64f6634..2096034 100644
--- a/v4/java/android/support/v4/widget/ExploreByTouchHelper.java
+++ b/v4/java/android/support/v4/widget/ExploreByTouchHelper.java
@@ -63,6 +63,10 @@
     /** Default class name used for virtual views. */
     private static final String DEFAULT_CLASS_NAME = View.class.getName();
 
+    /** Default bounds used to determine if the client didn't set any. */
+    private static final Rect INVALID_PARENT_BOUNDS = new Rect(
+            Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE);
+
     // Temporary, reusable data structures.
     private final Rect mTempScreenRect = new Rect();
     private final Rect mTempParentRect = new Rect();
@@ -386,6 +390,7 @@
         // Ensure the client has good defaults.
         node.setEnabled(true);
         node.setClassName(DEFAULT_CLASS_NAME);
+        node.setBoundsInParent(INVALID_PARENT_BOUNDS);
 
         // Allow the client to populate the node.
         onPopulateNodeForVirtualView(virtualViewId, node);
@@ -397,7 +402,7 @@
         }
 
         node.getBoundsInParent(mTempParentRect);
-        if (mTempParentRect.isEmpty()) {
+        if (mTempParentRect.equals(INVALID_PARENT_BOUNDS)) {
             throw new RuntimeException("Callbacks must set parent bounds in "
                     + "populateNodeForVirtualViewId()");
         }