OSDN Git Service

am 9e4b5269: am 94aae9af: Little more on issue #17495264: tweak when we ignore initia...
authorDianne Hackborn <hackbod@google.com>
Tue, 16 Sep 2014 16:47:32 +0000 (16:47 +0000)
committerAndroid Git Automerger <android-git-automerger@android.com>
Tue, 16 Sep 2014 16:47:32 +0000 (16:47 +0000)
* commit '9e4b526951eaccc4aeb1d85a5d9e52a996a7b1d0':
  Little more on issue #17495264: tweak when we ignore initial times.

src/com/android/settings/fuelgauge/BatteryHistoryChart.java

index 2f36c5f..fbd0ea3 100644 (file)
@@ -569,7 +569,12 @@ public class BatteryHistoryChart extends View {
                     // able to create a good chart with that data, so just ignore the
                     // times we got before and pretend like our data extends back from
                     // the time we have now.
-                    if (rec.currentTime > (lastWallTime+(365*24*60*60*1000))) {
+                    // Also, if we are getting a time change and we are less than 5 minutes
+                    // since the start of the history real time, then also use this new
+                    // time to compute the base time, since whatever time we had before is
+                    // pretty much just noise.
+                    if (rec.currentTime > (lastWallTime+(180*24*60*60*1000L))
+                            || rec.time < (mHistStart+(5*60*1000L))) {
                         mStartWallTime = 0;
                     }
                     lastWallTime = rec.currentTime;