Loading core/java/android/view/WindowManagerGlobal.java +6 −2 Original line number Diff line number Diff line Loading @@ -329,13 +329,17 @@ public final class WindowManagerGlobal { /** * Adds a listener that will be notified whenever {@link #getWindowViews()} changes. The * current value is provided immediately. If it was registered previously then this is ano op. * current value is provided immediately using the provided {@link Executor}. If this * {@link Consumer} was registered previously, then this is a no op. */ public void addWindowViewsListener(@NonNull Executor executor, @NonNull Consumer<List<View>> consumer) { synchronized (mLock) { if (mWindowViewsListenerGroup.isConsumerPresent(consumer)) { return; } mWindowViewsListenerGroup.addListener(executor, consumer); mWindowViewsListenerGroup.accept(getWindowViews()); executor.execute(() -> consumer.accept(getWindowViews())); } } Loading core/java/android/view/inspector/WindowInspector.java +3 −2 Original line number Diff line number Diff line Loading @@ -42,8 +42,9 @@ public final class WindowInspector { } /** * Adds a listener that is notified whenever the list of global window views changes. If a * {@link Consumer} is already registered this method is a no op. * Adds a listener that is notified whenever the value of {@link #getGlobalWindowViews()} * changes. The current value is provided immediately using the provided {@link Executor}. * If this {@link Consumer} is already registered, then this method is a no op. * @see #getGlobalWindowViews() */ @FlaggedApi(android.view.flags.Flags.FLAG_ROOT_VIEW_CHANGED_LISTENER) Loading core/java/android/view/translation/ListenerGroup.java +2 −2 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ public class ListenerGroup<T> { * is a no op. */ public void addListener(@NonNull Executor executor, @NonNull Consumer<T> consumer) { if (isContained(consumer)) { if (isConsumerPresent(consumer)) { return; } mListeners.add(new ListenerWrapper<>(executor, consumer)); Loading @@ -69,7 +69,7 @@ public class ListenerGroup<T> { * Returns {@code true} if the {@link Consumer} is present in the list, {@code false} * otherwise. */ private boolean isContained(Consumer<T> consumer) { public boolean isConsumerPresent(Consumer<T> consumer) { return computeIndex(consumer) > -1; } Loading Loading
core/java/android/view/WindowManagerGlobal.java +6 −2 Original line number Diff line number Diff line Loading @@ -329,13 +329,17 @@ public final class WindowManagerGlobal { /** * Adds a listener that will be notified whenever {@link #getWindowViews()} changes. The * current value is provided immediately. If it was registered previously then this is ano op. * current value is provided immediately using the provided {@link Executor}. If this * {@link Consumer} was registered previously, then this is a no op. */ public void addWindowViewsListener(@NonNull Executor executor, @NonNull Consumer<List<View>> consumer) { synchronized (mLock) { if (mWindowViewsListenerGroup.isConsumerPresent(consumer)) { return; } mWindowViewsListenerGroup.addListener(executor, consumer); mWindowViewsListenerGroup.accept(getWindowViews()); executor.execute(() -> consumer.accept(getWindowViews())); } } Loading
core/java/android/view/inspector/WindowInspector.java +3 −2 Original line number Diff line number Diff line Loading @@ -42,8 +42,9 @@ public final class WindowInspector { } /** * Adds a listener that is notified whenever the list of global window views changes. If a * {@link Consumer} is already registered this method is a no op. * Adds a listener that is notified whenever the value of {@link #getGlobalWindowViews()} * changes. The current value is provided immediately using the provided {@link Executor}. * If this {@link Consumer} is already registered, then this method is a no op. * @see #getGlobalWindowViews() */ @FlaggedApi(android.view.flags.Flags.FLAG_ROOT_VIEW_CHANGED_LISTENER) Loading
core/java/android/view/translation/ListenerGroup.java +2 −2 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ public class ListenerGroup<T> { * is a no op. */ public void addListener(@NonNull Executor executor, @NonNull Consumer<T> consumer) { if (isContained(consumer)) { if (isConsumerPresent(consumer)) { return; } mListeners.add(new ListenerWrapper<>(executor, consumer)); Loading @@ -69,7 +69,7 @@ public class ListenerGroup<T> { * Returns {@code true} if the {@link Consumer} is present in the list, {@code false} * otherwise. */ private boolean isContained(Consumer<T> consumer) { public boolean isConsumerPresent(Consumer<T> consumer) { return computeIndex(consumer) > -1; } Loading