Buggy code:
public class CacheManagingDrawTask extends DrawTask { private static final int MAX_CACHE_SCREEN_SIZE = 3 ; private int mMaxCacheSize = 2 ; private CacheManagingDrawTask . CacheManager mCacheManager ; private DanmakuTimer mCacheTimer ; public CacheManagingDrawTask ( DanmakuTimer timer , Context context , AbsDisplayer < ? > disp , TaskListener taskListener , int maxCacheSize ) { } @ Override protected void initTimer ( DanmakuTimer timer ) { } @ Override public void addDanmaku ( BaseDanmaku danmaku ) { } @ Override public RenderingState draw ( AbsDisplayer < ? > displayer ) { } @ Override public void reset ( ) { } @ Override public void seek ( long mills ) { } @ Override public void start ( ) { } @ Override public void quit ( ) { } @ Override public void prepare ( ) { } public class CacheManager { @ SuppressWarnings ( "unused" ) private static final String TAG = "CacheManager" ; public HandlerThread mThread ; Danmakus mCaches = new Danmakus ( Danmakus . ST_BY_LIST ) ; DrawingCachePoolManager mCachePoolManager = new DrawingCachePoolManager ( ) ; Pool < DrawingCache > mCachePool = Pools . finitePool ( mCachePoolManager , 500 ) ; private int mMaxSize ; private int mRealSize ; private int mScreenSize = 3 ; private CacheManagingDrawTask . CacheManager . CacheHandler mHandler ; public CacheManager ( int maxSize , int screenSize ) { } public void seek ( long mills ) { } public void addDanmaku ( BaseDanmaku danmaku ) { } public void begin ( ) { } public void end ( ) { } public void resume ( ) { } public float getPoolPercent ( ) { } public synchronized boolean isPoolFull ( ) { } private synchronized void evictAll ( ) { } private synchronized void evictAllNotInScreen ( ) { } private synchronized void evictAllNotInScreen ( boolean removeAllReferences ) { } protected void entryRemoved ( boolean evicted , BaseDanmaku oldValue , BaseDanmaku newValue ) { } protected int sizeOf ( BaseDanmaku value ) { } private void clearCachePool ( ) { } private synchronized boolean push ( BaseDanmaku item , int itemSize ) { } private synchronized void clearTimeOutCaches ( ) { } private synchronized void clearTimeOutCaches ( long time ) { } private synchronized BaseDanmaku findReuseableCache ( BaseDanmaku refDanmaku , boolean strictMode ) { } int danmakuAddedCount = 0 ; public class CacheHandler extends Handler { private static final int PREPARE = 1 ; public static final int ADD_DANMAKKU = 2 ; public static final int BUILD_CACHES = 3 ; public static final int CLEAR_TIMEOUT_CACHES = 4 ; public static final int SEEK = 5 ; public static final int QUIT = 6 ; public static final int CLEAR_ALL_CACHES = 7 ; public static final int CLEAR_OUTSIDE_CACHES = 8 ; public static final int CLEAR_OUTSIDE_CACHES_AND_RESET = 9 ; public static final int DISPATCH_ACTIONS = 16 ; private boolean mPause ; private boolean buildSuccess ; private boolean mSeekedFlag ; private boolean mCanelFlag ; public CacheHandler ( Looper looper ) { } public void requestCancelCaching ( ) { } @ Override public void handleMessage ( Message msg ) { int what = msg . what ; switch ( what ) { case CacheManagingDrawTask . CacheManager . CacheHandler . PREPARE : evictAllNotInScreen ( ) ; for ( int i = 0 ; i < 200 ; i ++ ) { mCachePool . release ( new DrawingCache ( ) ) ; } case CacheManagingDrawTask . CacheManager . CacheHandler . DISPATCH_ACTIONS : long delayed = dispatchAction ( ) ; if ( delayed <= 0 ) { delayed = DanmakuFactory . MAX_DANMAKU_DURATION ; } sendEmptyMessageDelayed ( CacheManagingDrawTask . CacheManager . CacheHandler . DISPATCH_ACTIONS , delayed ) ; break ; case CacheManagingDrawTask . CacheManager . CacheHandler . BUILD_CACHES : removeMessages ( CacheManagingDrawTask . CacheManager . CacheHandler . BUILD_CACHES ) ; <START_BUG> boolean repositioned = ( ( mTaskListener ) != null ) || ( mSeekedFlag ) ; <END_BUG> prepareCaches ( repositioned ) ; if ( repositioned ) mSeekedFlag = false ; if ( ( ( mTaskListener ) != null ) && ( ( mReadyState ) == false ) ) { mTaskListener . ready ( ) ; mReadyState = true ; } break ; case CacheManagingDrawTask . CacheManager . CacheHandler . ADD_DANMAKKU : synchronized ( danmakuList ) { BaseDanmaku item = ( ( BaseDanmaku ) ( msg . obj ) ) ; if ( item . isTimeOut ( ) ) { break ; } if ( ! ( item . hasDrawingCache ( ) ) ) { buildCache ( item ) ; } if ( item . isLive ) { mCacheTimer . update ( ( ( mTimer . currMillisecond ) + ( ( DanmakuFactory . MAX_DANMAKU_DURATION ) * ( mScreenSize ) ) ) ) ; } CacheManagingDrawTask . super . addDanmaku ( item ) ; } break ; case CacheManagingDrawTask . CacheManager . CacheHandler . CLEAR_TIMEOUT_CACHES : clearTimeOutCaches ( ) ; break ; case CacheManagingDrawTask . CacheManager . CacheHandler . SEEK : Long seekMills = ( ( Long ) ( msg . obj ) ) ; if ( seekMills != null ) { mCacheTimer . update ( seekMills . longValue ( ) ) ; mSeekedFlag = true ; evictAllNotInScreen ( ) ; resume ( ) ; } break ; case CacheManagingDrawTask . CacheManager . CacheHandler . QUIT : removeCallbacksAndMessages ( null ) ; mPause = true ; evictAll ( ) ; clearCachePool ( ) ; this . getLooper ( ) . quit ( ) ; break ; case CacheManagingDrawTask . CacheManager . CacheHandler . CLEAR_ALL_CACHES : evictAll ( ) ; reset ( ) ; mCacheTimer . update ( currMillisecond ) ; mSeekedFlag = true ; clearFlag = 5 ; break ; case CacheManagingDrawTask . CacheManager . CacheHandler . CLEAR_OUTSIDE_CACHES : evictAllNotInScreen ( true ) ; mCacheTimer . update ( currMillisecond ) ; break ; case CacheManagingDrawTask . CacheManager . CacheHandler . CLEAR_OUTSIDE_CACHES_AND_RESET : evictAllNotInScreen ( true ) ; reset ( ) ; mCacheTimer . update ( currMillisecond ) ; requestClear ( ) ; break ; } } private long dispatchAction ( ) { }

Fix:
boolean repositioned = ( ( ( mTaskListener ) != null ) && ( ( mReadyState ) == false ) ) || ( mSeekedFlag ) ;