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

Commit 7dec6037 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

parents 3362e799 53f48c4a
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) {