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

Commit ade071d6 authored by Salvador Martinez's avatar Salvador Martinez Committed by Android (Google) Code Review
Browse files

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

parents ae61369c 5b84fde6
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -77,5 +77,17 @@ class Estimate(
            Settings.Global.putLong(resolver, Settings.Global.BATTERY_ESTIMATES_LAST_UPDATE_TIME,
                    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))
        }
    }
}