From 73f0b2af197ed925ea76efd0b2f009843189ba19 Mon Sep 17 00:00:00 2001 From: Mark Renouf Date: Fri, 5 May 2023 12:32:06 -0400 Subject: [PATCH] scroll capture: Recover gracefully when anchor view is lost When manipulating a RecyclerView, the position of a visible child view is used as a feedback signal for scroll tracking. If the view remains detached after scrolling, view operations fail and crash the application. Detect this condition and return an empty result. If the RecyclerView moved during this request, the remaining tiles will be offset by the same amount. This will manifest as a missing section of content. Logging has been added to identify and track this bug. Test: manual repro w/test app; see bug Bug: 239050369 Change-Id: I5a0a62aaad10ffa7838d7902fd9c5f4f84b52ce6 --- .../android/internal/view/RecyclerViewCaptureHelper.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/java/com/android/internal/view/RecyclerViewCaptureHelper.java b/core/java/com/android/internal/view/RecyclerViewCaptureHelper.java index 8192ffd102308..f4e9e3064f3d1 100644 --- a/core/java/com/android/internal/view/RecyclerViewCaptureHelper.java +++ b/core/java/com/android/internal/view/RecyclerViewCaptureHelper.java @@ -105,6 +105,13 @@ public class RecyclerViewCaptureHelper implements ScrollCaptureViewHelper