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

Commit ab5e21ec authored by ykhung's avatar ykhung Committed by Automerger Merge Worker
Browse files

Make the estimator cache logic is the same as SysUI flow am: 53f48c4a am: 7dec6037

parents 2247bb0a 7dec6037
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -451,12 +451,10 @@ public class BatteryUtils {

    @VisibleForTesting
    Estimate getEnhancedEstimate() {
        Estimate estimate = null;
        // Get enhanced prediction if available
        if (Duration.between(Estimate.getLastCacheUpdateTime(mContext), Instant.now())
                .compareTo(Duration.ofSeconds(10)) < 0) {
            estimate = Estimate.getCachedEstimateIfAvailable(mContext);
        } else if (mPowerUsageFeatureProvider != null &&
        // Align the same logic in the BatteryControllerImpl.updateEstimate()
        Estimate estimate = Estimate.getCachedEstimateIfAvailable(mContext);
        if (estimate == null &&
                mPowerUsageFeatureProvider != null &&
                mPowerUsageFeatureProvider.isEnhancedBatteryPredictionEnabled(mContext)) {
            estimate = mPowerUsageFeatureProvider.getEnhancedBatteryPrediction(mContext);
            if (estimate != null) {