private void doWatchdogCheck(){
  mHaveWatchdogScheduled=false;
  if (!mIsRunning) {
    return;
  }
  long now=mMonotonicClock.now();
  boolean hasNotDrawnWithinTimeout=mWaitingForDraw && now - mLastInvalidateTimeMs > WATCH_DOG_TIMER_MIN_TIMEOUT_MS;
  boolean hasNotAdvancedFrameWithinTimeout=mNextFrameTaskMs != -1 && now - mNextFrameTaskMs > WATCH_DOG_TIMER_MIN_TIMEOUT_MS;
  if (hasNotDrawnWithinTimeout || hasNotAdvancedFrameWithinTimeout) {
    dropCaches();
    doInvalidateSelf();
  }
 else {
    mScheduledExecutorServiceForUiThread.schedule(mWatchdogTask,WATCH_DOG_TIMER_POLL_INTERVAL_MS,TimeUnit.MILLISECONDS);
    mHaveWatchdogScheduled=true;
  }
}

private void doWatchdogCheck ( ) { mHaveWatchdogScheduled = false ; if ( ! mIsRunning ) { return ; } long now = mMonotonicClock . now ( ) ; boolean hasNotDrawnWithinTimeout = mWaitingForDraw && now - mLastInvalidateTimeMs > WATCH_DOG_TIMER_MIN_TIMEOUT_MS ; boolean hasNotAdvancedFrameWithinTimeout = mNextFrameTaskMs != - 1 && now - mNextFrameTaskMs > WATCH_DOG_TIMER_MIN_TIMEOUT_MS ; if ( hasNotDrawnWithinTimeout || hasNotAdvancedFrameWithinTimeout ) { dropCaches ( ) ; doInvalidateSelf ( ) ; } else { mScheduledExecutorServiceForUiThread . schedule ( mWatchdogTask , WATCH_DOG_TIMER_POLL_INTERVAL_MS , TimeUnit . MILLISECONDS ) ; mHaveWatchdogScheduled = true ; } }
checks to make sure we drop our caches if we haven ' t drawn in a while . there ' s no reliable way for a drawable to determine if it ' s still actively part of a view , so we use a heuristic instead .
