question: void calculateCounters ( ) { if ( ! isDBAvailable ( ) ) return ; long time = System . currentTimeMillis ( ) ; int total = 0 ; write . lock ( ) ; try { countResetFeedsAndCategories ( ) ; total += countFeedsWithUnread ( ) ; countCategoriesWithUnread ( ) ; countSpecialCategories ( total ) ; } finally { write . unlock ( ) ; } Log . i ( TAG , String . format ( "Recalculated counters, total unread: %s (took %sms)" , total , ( System . currentTimeMillis ( ) - time ) ) ) ; }
target:  Set unread counters for feeds and categories according to real amount of unread articles. Split up the tasks in single transactions so we can do other work in between.