public static boolean clickView(Instrumentation instr, final View view) {
    boolean result =
        runOnMainSyncWithTimeout(
            new Callable<Boolean>() {
              @Override
              public Boolean call() {
                return view.performClick();
              }
            });
    // this shouldn't be needed but without it or sleep, there isn't time for view refresh, etc.
    instr.waitForIdleSync();
    return result;
  }
Timeout (milliseconds) when waiting for the results of a UI action performed by the code under
test.
javatests/com/google/android/apps/authenticator/testing/TestUtilities.java