Buggy code:
public class TripPopulator { private static final String TAG = "TripPopulator" ; private static final int UPDATE_INTERVAL = 1000 ; private final Object waitLock = new Object ( ) ; private boolean dismissLock = false ; private final ListView list ; private final TextView hint ; private final ProgressBar progress ; private final ArrayAdapter < Trip > adapter ; private final List < Trip > activeTrips = new CopyOnWriteArrayList < Trip > ( ) ; private final Handler uiHandler ; private TripPopulator . UpdateRunner updateRunner ; private Thread updateThread ; private boolean running = false ; private long lastDismissTutorialShow = 0 ; private final SwipeDismissListViewTouchListener dismissListener ; private final Context c ; private final List < ServiceRequest > serviceRequests = new CopyOnWriteArrayList < ServiceRequest > ( ) ; public TripPopulator ( ListView list , TextView hint , ProgressBar progress , Context c ) { } public void StartPopulating ( ) { } public void StopPopulating ( ) { } void rawSetServiceRequests ( Collection < ServiceRequest > requests ) { } public void SetServiceRequests ( Collection < ServiceRequest > requests ) { } protected class UpdateRunner implements Runnable { boolean run = true ; final Map < ServiceRequest , Collection < Prediction > > trackedMap = new HashMap < ServiceRequest , Collection < Prediction > > ( ) ; long timeSpentUpdating = 0 ; long numberOfUpdates = 0 ; long timeSpentUpdatingUI = 0 ; @ Override public void run ( ) { } void updateTrackedMap ( ) { } private void addNewStops ( ) { } private void removeOldStops ( ) { } void cullInvalidTrips ( ) { } List < Trip > sortTrips ( Collection < Trip > trips ) { } private boolean couldServiceRequestsHavePending ( ) { } private void updateListView ( ) { final List < Trip > sorted = sortTrips ( activeTrips ) ; uiHandler . post ( new Runnable ( ) { @ Override public void run ( ) { long start = Tracking . startTime ( ) ; adapter . clear ( ) ; for ( Trip t : sorted ) { if ( t . isValid ( ) ) { adapter . add ( t ) ; } } if ( ( activeTrips . size ( ) ) == 0 ) { hint . setVisibility ( VISIBLE ) ; <START_BUG> if ( ( ( serviceRequests . size ( ) ) != 0 ) && ( couldServiceRequestsHavePending ( ) ) ) { <END_BUG> progress . setVisibility ( VISIBLE ) ; progress . setProgress ( 1 ) ; } else { progress . setVisibility ( INVISIBLE ) ; } } else { if ( ( hint . getVisibility ( ) ) == ( View . VISIBLE ) ) { hint . setVisibility ( INVISIBLE ) ; uiHandler . postDelayed ( new Runnable ( ) { @ Override public void run ( ) { if ( TripPopulator . this . running ) { Toast . makeText ( c , "Tap<seq2seq4repair_space>an<seq2seq4repair_space>arrival<seq2seq4repair_space>to<seq2seq4repair_space>set<seq2seq4repair_space>a<seq2seq4repair_space>notification<seq2seq4repair_space>for<seq2seq4repair_space>it" , LENGTH_LONG ) . show ( ) ; } } } , 3000 ) ; uiHandler . postDelayed ( new Runnable ( ) { @ Override public void run ( ) { if ( TripPopulator . this . running ) { Toast . makeText ( c , "Swipe<seq2seq4repair_space>an<seq2seq4repair_space>arrival<seq2seq4repair_space>to<seq2seq4repair_space>dismiss<seq2seq4repair_space>it" , LENGTH_LONG ) . show ( ) ; } } } , 5000 ) ; } progress . setVisibility ( INVISIBLE ) ; } long l = Tracking . timeSpent ( start ) ; timeSpentUpdatingUI += l ; } } ) ; } final Comparator < Trip > tripPriorityComparator = new Comparator < Trip > ( ) { @ Override public int compare ( Trip lhs , Trip rhs ) { } } ; final TripUpdateCallback tripUpdateCallback = new TripUpdateCallback ( ) { @ Override public void tripUpdated ( final Trip trip ) { } } ; } }

Fix:
if ( ( serviceRequests . size ( ) ) != 0 ) {