diff options
| -rw-r--r-- | core/api/current.txt | 1 | ||||
| -rw-r--r-- | core/java/android/view/ViewTreeObserver.java | 6 | ||||
| -rw-r--r-- | core/java/android/view/flags/view_tree_observer_flags.aconfig | 9 |
3 files changed, 15 insertions, 1 deletions
diff --git a/core/api/current.txt b/core/api/current.txt index 4cd6d6f03ee8..fbc8eefdd945 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -55423,6 +55423,7 @@ package android.view { method public void dispatchOnDraw(); method public void dispatchOnGlobalLayout(); method public boolean dispatchOnPreDraw(); + method @FlaggedApi("android.view.flags.enable_dispatch_on_scroll_changed") public void dispatchOnScrollChanged(); method public boolean isAlive(); method public void registerFrameCommitCallback(@NonNull Runnable); method @Deprecated public void removeGlobalOnLayoutListener(android.view.ViewTreeObserver.OnGlobalLayoutListener); diff --git a/core/java/android/view/ViewTreeObserver.java b/core/java/android/view/ViewTreeObserver.java index 3b444c44c368..fc66e49ff6b0 100644 --- a/core/java/android/view/ViewTreeObserver.java +++ b/core/java/android/view/ViewTreeObserver.java @@ -16,6 +16,9 @@ package android.view; +import static android.view.flags.Flags.FLAG_ENABLE_DISPATCH_ON_SCROLL_CHANGED; + +import android.annotation.FlaggedApi; import android.annotation.NonNull; import android.annotation.Nullable; import android.compat.annotation.UnsupportedAppUsage; @@ -1258,8 +1261,9 @@ public final class ViewTreeObserver { /** * Notifies registered listeners that something has scrolled. */ + @FlaggedApi(FLAG_ENABLE_DISPATCH_ON_SCROLL_CHANGED) @UnsupportedAppUsage - final void dispatchOnScrollChanged() { + public final void dispatchOnScrollChanged() { // NOTE: because of the use of CopyOnWriteArrayList, we *must* use an iterator to // perform the dispatching. The iterator is a safe guard against listeners that // could mutate the list by calling the various add/remove methods. This prevents diff --git a/core/java/android/view/flags/view_tree_observer_flags.aconfig b/core/java/android/view/flags/view_tree_observer_flags.aconfig new file mode 100644 index 000000000000..82f3300a87cb --- /dev/null +++ b/core/java/android/view/flags/view_tree_observer_flags.aconfig @@ -0,0 +1,9 @@ +package: "android.view.flags" +container: "system" + +flag { + name: "enable_dispatch_on_scroll_changed" + namespace: "toolkit" + description: "Feature flag for enabling the dispatchOnScrollChanged method in ViewTreeObserver." + bug: "238109286" +}
\ No newline at end of file |