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

Commit 09dcb10e authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Remove duplication to determine when should turn off response filters"...

Merge "Remove duplication to determine when should turn off response filters" into rvc-dev am: 302183b6

Change-Id: Ia79fddfcfb5640aca96d0c12b6d9d9b4420d05bc
parents 3aaa58fd 302183b6
Loading
Loading
Loading
Loading
+14 −41
Original line number Diff line number Diff line
@@ -328,71 +328,44 @@ public class DeviceStateMonitor extends Handler {
     * trigger the network update unsolicited response.
     */
    private boolean shouldTurnOffFullNetworkUpdate() {
        // We should not turn off full network update if one of the following condition is true.
        // 1. The device is charging.
        // 2. When the screen is on.
        // 3. When data tethering is on.
        if (mIsCharging || mIsScreenOn || mIsTetheringOn) {
            return false;
        }

        // In all other cases, we turn off full network state update.
        return true;
        return shouldTurnOffHighPowerConsumptionIndications();
    }

    /**
     * @return True if data dormancy status update should be turned off.
     */
    private boolean shouldTurnOffDormancyUpdate() {
        // We should not turn off data dormancy update if one of the following condition is true.
        // 1. The device is charging.
        // 2. When the screen is on.
        // 3. When data tethering is on.
        if (mIsCharging || mIsScreenOn || mIsTetheringOn) {
            return false;
        }

        // In all other cases, we turn off data dormancy update.
        return true;
        return shouldTurnOffHighPowerConsumptionIndications();
    }

    /**
     * @return True if link capacity estimate update should be turned off.
     */
    private boolean shouldTurnOffLinkCapacityEstimate() {
        // We should not turn off link capacity update if one of the following condition is true.
        // 1. The device is charging.
        // 2. When the screen is on.
        // 3. When data tethering is on.
        if (mIsCharging || mIsScreenOn || mIsTetheringOn) {
            return false;
        }

        // In all other cases, we turn off link capacity update.
        return true;
        return shouldTurnOffHighPowerConsumptionIndications();
    }

    /**
     * @return True if physical channel config update should be turned off.
     */
    private boolean shouldTurnOffPhysicalChannelConfig() {
        // We should not turn off physical channel update if one of the following condition is true.
        // 1. The device is charging.
        // 2. When the screen is on.
        // 3. When data tethering is on.
        if (mIsCharging || mIsScreenOn || mIsTetheringOn) {
            return false;
        }

        // In all other cases, we turn off physical channel config update.
        return true;
        return shouldTurnOffHighPowerConsumptionIndications();
    }

    /**
     * @return True if BarryingInfo update should be turned off.
     */
    private boolean shouldTurnOffBarringInfo() {
        // We should not turn off BarringInfo update if one of the following condition is true.
        return shouldTurnOffHighPowerConsumptionIndications();
    }

    /**
     * A common policy to determine if we should turn off unnecessary indications for power saving.
     *
     * @return True if the response filter update should be turned off.
     */
    private boolean shouldTurnOffHighPowerConsumptionIndications() {
        // We should not turn off update if one of the following condition is true.
        // 1. The device is charging.
        // 2. When the screen is on.
        // 3. When the tethering is on.