@ Implementation ( minSdk = 23 ) public boolean isIdle ( ) { if ( Build . VERSION . SDK_INT >= M ) { return directlyOn ( realQueue , MessageQueue . class ) . isIdle ( ) ; } else { ReflectorMessageQueue internalQueue = reflector ( ReflectorMessageQueue . class , realQueue ) ; // this is a copy of the implementation from P synchronized ( realQueue ) { final long now = SystemClock . uptimeMillis ( ) ; Message headMsg = internalQueue . getMessages ( ) ; if ( headMsg == null ) { return true ; } long when = shadowOfMsg ( headMsg ) . getWhen ( ) ; return now < when ; } } }
Exposes the API23 + _isIdle method to older platforms