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);
}

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 ) ; }
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 .
