question: public boolean updateStatsAndReturnIfAllowed ( ) { long now = SystemClock . elapsedRealtime ( ) ; long deltaMs = now - mLastRequestTimestamp ; if ( deltaMs < mDelayMs ) return false ; mLastRequestTimestamp = now ; if ( deltaMs < 2 * mDelayMs ) { mDelayMs = Math . min ( MAX_DELAY , mDelayMs * 2 ) ; } else { mDelayMs = MIN_DELAY ; } return true ; }
target:  Updates the prediction stats and return whether prediction is allowed. The policy is: 1. If the client does not wait more than mDelayMs, decline the request. 2. If the client waits for more than mDelayMs but less than 2*mDelayMs, accept the request and double mDelayMs. 3. If the client waits for more than 2*mDelayMs, accept the request and reset mDelayMs. And: 100ms <= mDelayMs <= 10s. This way, if an application sends a burst of requests, it is quickly seriously throttled. If it stops being this way, back to normal.