title: Android usage stats returns weird results
body: <p>I am looking at my results from using:</p>
  
  <pre><code>List&lt;UsageStats&gt; usageStatsList = usm.queryUsageStats(UsageStatsManager.INTERVAL_DAILY,  startTime,endTime);
  </code></pre>
  
  <p>where startTime in just after midnight, and endTime is just before midnight the same day.</p>
  
  <p>Example result:</p>
  
  <p>Pkg: com.android.chrome
  ForegroundTime: 6412 seconds 
  Time last used: Thu Apr 19 22:31:17 PDT 2018</p>
  
  <hr>
  
  <p>Pkg: com.instagram.android
  ForegroundTime: 5415 seconds 
  Time last used: Thu Apr 19 23:11:22 PDT 2018</p>
  
  <hr>
  
  <p>Pkg: com.android.chrome
  ForegroundTime: 5304 seconds 
  Time last used: Thu Apr 19 03:00:49 PDT 2018</p>
  
  <hr>
  
  <p>Pkg: com.instagram.android
  ForegroundTime: 5202 seconds 
  Time last used: Thu Apr 19 03:00:45 PDT 2018</p>
  
  <p>As you can see, it returns the same package twice for some things, with different time last used, even though both time last used were during the 24hr interval I specified. </p>
  
  <p>I have looked at a bunch of other results here:
  <a href="https://stackoverflow.com/questions/30386789/android-usagestatsmanager-producing-wrong-output">Android UsageStatsManager producing wrong output?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/26431795/how-to-use-usagestatsmanager">How to use UsageStatsManager?</a></p>
  
  <p>but can't seem to fix my problem. </p>
  
  <p>Does anyone know why it behaves this way? It seems to be time dependent? And the time last used always says 3am for some packages, despite me being fast asleep at that time?</p>