Skip to content

Commit

Permalink
Stable API - Convert to Kotlin and make internal `NotThreadSafeViewHi…
Browse files Browse the repository at this point in the history
…erarchyUpdateDebugListener` (#47371)

Summary:
Pull Request resolved: #47371

This interface should have not been exposed in the first place.
I'm converting it to Kotlin + making it `internal`.
I found no meaningful usage in OSS so I expect no breakages.

Changelog:
[Android] [Breaking] - Stable API - Convert to Kotlin and make internal `NotThreadSafeViewHierarchyUpdateDebugListener`

Reviewed By: javache

Differential Revision: D65420912

fbshipit-source-id: 5afdb013f588a5698b4e7467a7f1096c24d1733e
  • Loading branch information
cortinico authored and facebook-github-bot committed Nov 5, 2024
1 parent 1f62529 commit 287e200
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 16 deletions.
5 changes: 0 additions & 5 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -5658,11 +5658,6 @@ public final class com/facebook/react/uimanager/common/ViewUtil {
public static final fun isRootTag (I)Z
}

public abstract interface class com/facebook/react/uimanager/debug/NotThreadSafeViewHierarchyUpdateDebugListener {
public abstract fun onViewHierarchyUpdateEnqueued ()V
public abstract fun onViewHierarchyUpdateFinished ()V
}

public abstract interface class com/facebook/react/uimanager/events/BatchEventDispatchedListener {
public abstract fun onBatchEventDispatched ()V
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,8 @@ public void onCatalystInstanceDestroyed() {
mViewManagers.invalidate();
}

// NOTE: When converted to Kotlin this method should be `internal` due to
// visibility restriction for `NotThreadSafeViewHierarchyUpdateDebugListener`
public void setViewHierarchyUpdateDebugListener(
@Nullable NotThreadSafeViewHierarchyUpdateDebugListener listener) {
mOperationsQueue.setViewHierarchyUpdateDebugListener(listener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,8 @@ public void onBatchComplete() {
}
}

// NOTE: When converted to Kotlin this method should be `internal` due to
// visibility restriction for `NotThreadSafeViewHierarchyUpdateDebugListener`
public void setViewHierarchyUpdateDebugListener(
@Nullable NotThreadSafeViewHierarchyUpdateDebugListener listener) {
mUIImplementation.setViewHierarchyUpdateDebugListener(listener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,8 @@ public UIViewOperationQueue(
return mNativeViewHierarchyManager;
}

// NOTE: When converted to Kotlin this method should be `internal` due to
// visibility restriction for `NotThreadSafeViewHierarchyUpdateDebugListener`
public void setViewHierarchyUpdateDebugListener(
@Nullable NotThreadSafeViewHierarchyUpdateDebugListener listener) {
mViewHierarchyUpdateDebugListener = listener;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,22 @@
* LICENSE file in the root directory of this source tree.
*/

package com.facebook.react.uimanager.debug;
package com.facebook.react.uimanager.debug

import com.facebook.react.common.annotations.DeprecatedInNewArchitecture;
import com.facebook.react.uimanager.UIManagerModule;
import com.facebook.react.common.annotations.DeprecatedInNewArchitecture

/**
* A listener that is notified about view hierarchy update events. This listener should only be used
* for debug purposes and should not affect application state.
*
* <p>NB: while onViewHierarchyUpdateFinished will always be called from the UI thread, there are no
* NB: while [onViewHierarchyUpdateFinished] will always be called from the UI thread, there are no
* guarantees what thread onViewHierarchyUpdateEnqueued is called on.
*/
@DeprecatedInNewArchitecture
public interface NotThreadSafeViewHierarchyUpdateDebugListener {

/**
* Called when {@link UIManagerModule} enqueues a UI batch to be dispatched to the main thread.
*/
void onViewHierarchyUpdateEnqueued();
internal interface NotThreadSafeViewHierarchyUpdateDebugListener {
/** Called when `UIManagerModule` enqueues a UI batch to be dispatched to the main thread. */
fun onViewHierarchyUpdateEnqueued()

/** Called from the main thread after a UI batch has been applied to all root views. */
void onViewHierarchyUpdateFinished();
fun onViewHierarchyUpdateFinished()
}

0 comments on commit 287e200

Please sign in to comment.