Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e6594049 authored by Salvador Martinez's avatar Salvador Martinez Committed by android-build-merger
Browse files

Merge "Add function to query last estimate time to Estimate" into qt-dev

am: ade071d6

Change-Id: Ie07ee30ac46969e326d914c198955e59f5a1ef18
parents b87abd1b ade071d6
Loading
Loading
Loading
Loading
+12 −0
Original line number Original line Diff line number Diff line
@@ -77,5 +77,17 @@ class Estimate(
            Settings.Global.putLong(resolver, Settings.Global.BATTERY_ESTIMATES_LAST_UPDATE_TIME,
            Settings.Global.putLong(resolver, Settings.Global.BATTERY_ESTIMATES_LAST_UPDATE_TIME,
                    System.currentTimeMillis())
                    System.currentTimeMillis())
        }
        }

        /**
         * Returns when the estimate was last updated as an Instant
         */
        @JvmStatic
        fun getLastCacheUpdateTime(context: Context): Instant {
            return Instant.ofEpochMilli(
                    Settings.Global.getLong(
                            context.contentResolver,
                            Settings.Global.BATTERY_ESTIMATES_LAST_UPDATE_TIME,
                            -1))
        }
    }
    }
}
}