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

Commit d34b545b authored by Marcos Marado's avatar Marcos Marado Committed by Adnan Begovic
Browse files

Fix data cycle calculation when CYCLE_WEEKLY

The cycleDay is referred as a "day of month" (1-31) even when we change to
CYCLE_WEEKLY. The calculations are expecting a day of week (1-7).

Without this fix, we can fall into the (inconvenient) result of using a
completely wrong value for the cycle limit (and corresponding data calculation)
or the worse infinite loop that totally breaks data usage.

Change-Id: I41e0012805236b14f5e0d52ec39683fe6a96f3aa
parent abc03db5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -258,6 +258,7 @@ public class NetworkPolicyManager {
        if (cycleLength == CYCLE_MONTHLY) {
            snapToCycleDay(time, cycleDay);
        } else if (cycleLength == CYCLE_WEEKLY) {
            cycleDay = cycleDay % 7;
            time.monthDay += (cycleDay - time.weekDay);
            time.normalize(true);
        }