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

am: e659404917

Change-Id: If6c7c1690d6331447c8739a866c587a85479e8c9
This commit is contained in:
Salvador Martinez
2019-05-20 17:55:13 -07:00
committed by android-build-merger

View File

@@ -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))
}
}
}