question: public static void waitForBridgeAndUIIdle ( ReactBridgeIdleSignaler idleSignaler , final ReactContext reactContext , long timeoutMs ) { UiThreadUtil . assertNotOnUiThread ( ) ; long startTime = SystemClock . uptimeMillis ( ) ; waitInner ( idleSignaler , timeoutMs ) ; long timeToWait = Math . max ( 1 , timeoutMs - ( SystemClock . uptimeMillis ( ) - startTime ) ) ; waitForChoreographer ( timeToWait ) ; waitForJSIdle ( reactContext ) ; timeToWait = Math . max ( 1 , timeoutMs - ( SystemClock . uptimeMillis ( ) - startTime ) ) ; waitInner ( idleSignaler , timeToWait ) ; timeToWait = Math . max ( 1 , timeoutMs - ( SystemClock . uptimeMillis ( ) - startTime ) ) ; waitForChoreographer ( timeToWait ) ; }
target:  Waits for both the UI thread and bridge to be idle. It determines this by waiting for the bridge to become idle, then waiting for the UI thread to become idle, then checking if the bridge is idle again (if the bridge was idle before and is still idle after running the UI thread to idle, then there are no more events to process in either place). <p/> Also waits for any Choreographer callbacks to run after the initial sync since things like UI events are initiated from Choreographer callbacks.