Buggy code:
public class PhoneUsageDatabase { public static final String MUSIC_PACKAGE_NAME = "music_package" ; private static final String LOG_TAG = PhoneUsageDatabase . class . getSimpleName ( ) ; private Context mContext ; PhoneUsageDbHelper mDbHelper = null ; SQLiteDatabase mDatabase = null ; public PhoneUsageDatabase ( Context context ) { } public void exportDatabse ( String databaseName ) { } public void insertMusicEntry ( UsageInfo mValues ) { } public ArrayList < UsageInfo > getMusicEntryInInterval ( String date , long start_time , long end_time , boolean isShowExtendDurationIntervals ) { } public ArrayList < UsageInfo > getApplicationEntryInInterval ( String packageName , String date , long start_time , long end_time , boolean isShowExtendDurationIntervals ) { } public HashMap < Long , UsageInfo > getAppIntervalsBetweenDates ( String packageName , Calendar startCalendar , Calendar endCalendar ) { String startDate = Utils . getDateFromMiliSeconds ( startCalendar . getTimeInMillis ( ) ) ; String endDate = Utils . getDateFromMiliSeconds ( endCalendar . getTimeInMillis ( ) ) ; String indexCreate = ( ( ( ( ( ( "CREATE<seq2seq4repair_space>INDEX<seq2seq4repair_space>IF<seq2seq4repair_space>NOT<seq2seq4repair_space>EXISTS<seq2seq4repair_space>" + ( "date<seq2seq4repair_space>" + "ON<seq2seq4repair_space>" ) ) + ( Table . TABLE_NAME ) ) + "(" ) + ( Columns . COLUMN_DATE ) ) + "," ) + ( Columns . COLUMN_APP_NAME ) ) + ")" ; mDatabase . execSQL ( indexCreate ) ; String selection = ( ( ( ( ( ( ( ( ( Columns . COLUMN_APP_NAME ) + "=<seq2seq4repair_space>'" ) + packageName ) + "'<seq2seq4repair_space>AND<seq2seq4repair_space>" ) + ( Columns . COLUMN_DATE ) ) + "<seq2seq4repair_space>BETWEEN<seq2seq4repair_space>'" ) + startDate ) + "'<seq2seq4repair_space>AND<seq2seq4repair_space>'" ) + endDate ) + "'" ; HashMap < Long , UsageInfo > map = new HashMap < > ( ) ; Cursor cursor = mDatabase . query ( TABLE_NAME , null , selection , null , null , null , null ) ; Log . v ( PhoneUsageDatabase . LOG_TAG , ( "Cursor<seq2seq4repair_space>count<seq2seq4repair_space>is:<seq2seq4repair_space>" + ( cursor . getCount ( ) ) ) ) ; if ( ( cursor != null ) && ( ( cursor . getCount ( ) ) > 0 ) ) { cursor . moveToFirst ( ) ; int startIntervalIndex = cursor . getColumnIndex ( COLUMN_START_INTERVAL_TIME ) ; int endIntervalIndex = cursor . getColumnIndex ( COLUMN_END_INTERVAL_TIME ) ; int durationIndex = cursor . getColumnIndex ( COLUMN_INTERVAL_DURATION ) ; do { long startTime = System . nanoTime ( ) ; UsageInfo info = new UsageInfo ( ) ; info . setmIntervalStartTime ( cursor . getLong ( startIntervalIndex ) ) ; info . setmIntervalEndTime ( cursor . getLong ( endIntervalIndex ) ) ; info . setmIntervalDuration ( cursor . getLong ( durationIndex ) ) ; <START_BUG> map . put ( info . getmIntervalDuration ( ) , info ) ; <END_BUG> Log . v ( PhoneUsageDatabase . LOG_TAG , ( ( "This<seq2seq4repair_space>loop<seq2seq4repair_space>cursor<seq2seq4repair_space>iteration<seq2seq4repair_space>took<seq2seq4repair_space>:<seq2seq4repair_space>" + ( Utils . getTimeInSecFromNano ( ( ( System . nanoTime ( ) ) - startTime ) ) ) ) + "<seq2seq4repair_space>ms." ) ) ; } while ( cursor . moveToNext ( ) ) ; } cursor . close ( ) ; return map ; } public void insertApplicationEntry ( String pkgname , UsageInfo mValues ) { } public HashMap < String , Long > getAppDurationForGivenTimes ( Context context , Calendar startCalendar , Calendar endCalendar ) { } public HashMap < String , Long > getApplicationEndTimeStampsForMentionedTimeBeforeToday ( Context context , Calendar startCalendar , Calendar endCalendar ) { } public ArrayList < UsageInfo > getMusicIntervalsBetweenDates ( Context context , Calendar startCalendar , Calendar endCalendar ) { } public long getTotalDurationOfAppInInternal ( String packageName , String date , long start_time , long end_time , boolean isShowExtendDurationIntervals ) { } public long getTotalDurationOfAllAppsByDate ( String date ) { } public long getTotalDurationOfApplicationOfAppByDate ( String packageName , String date ) { } public ArrayList < String > getAllPackagesUsedByDate ( String date ) { } }

Fix:
map . put ( info . getmIntervalStartTime ( ) , info ) ;