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

Commit 340c6cf2 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

am: f4f9ae24

Change-Id: I93c93c1be4549a4ae2722860cbbfcd72555af377
parents c3536e4c f4f9ae24
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))
        }
    }
}