Beispiel #1
0
  /**
   * Returns whether the specified event time falls between the start and finish times of the
   * specified action.
   *
   * @param action The action to check.
   * @param eventTime The event time to check.
   * @return {@code true} if the event time falls between the start and finish times of the
   *     specified action.
   */
  public boolean hasActionAtTime(int action, long eventTime) {
    final long startTime = mActionStartMap.get(action);
    final boolean hasStarted = (startTime > 0);
    if (!hasStarted || (startTime > eventTime)) {
      // The action hasn't started, or started after the event.
      return false;
    }

    final long finishTime = mActionFinishMap.get(action);
    final boolean hasFinished = (finishTime >= startTime);
    if (hasFinished && (finishTime < eventTime)) {
      // The action finished before the event.
      return false;
    }

    return true;
  }
Beispiel #2
0
 /**
  * Stores the finish time for an action. This should be called immediately after {@link
  * AccessibilityNodeInfoCompat#performAction}.
  *
  * @param action The action that was performed.
  */
 public void after(int action) {
   mActionFinishMap.put(action, SystemClock.uptimeMillis());
 }
Beispiel #3
0
 /**
  * Stores the start time for an action. This should be called immediately before {@link
  * AccessibilityNodeInfoCompat#performAction}.
  *
  * @param action The action that will be performed.
  */
 public void before(int action) {
   mActionStartMap.put(action, SystemClock.uptimeMillis());
 }