Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9adb600c authored by Levi Albuquerque's avatar Levi Albuquerque
Browse files

Make ViewTreeObserver.dispatchOnScrollChanged public.

To correctly support interop callbacks in Compose we need to allow dispatching onScrollChanged callbacks in the framework. In this change we're making dispatchOnScrollChanged public.

Bug: 238109286
Bug: 402138549
Flag: android.view.flags.enable_dispatch_on_scroll_changed
Test: atest ViewTreeObserverTest
Change-Id: I1fe0094f1976240027597578f51ccf5e70fa7fdf
parent 09558664
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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);
+5 −1
Original line number Diff line number Diff line
@@ -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
+9 −0
Original line number Diff line number Diff line
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