Add more variations of subscription plan to the fake subscription plan list.
Bug: 62349208
Test: bit FrameworksServicesTests:com.android.server.NetworkPolicyManagerServiceTest
Change-Id: I343ba1dc43d5319963fbac9455cc7b8c9c769ff0
diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
index f70486a..442c067 100644
--- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
+++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
@@ -2650,6 +2650,22 @@
.setDataUsage(1 * TrafficStats.GB_IN_BYTES,
ZonedDateTime.now().minusHours(36).toInstant().toEpochMilli())
.build());
+ plans.add(SubscriptionPlan.Builder
+ .createRecurringMonthly(ZonedDateTime.parse("2017-03-14T00:00:00.000Z"))
+ .setTitle("G-Mobile Happy")
+ .setDataLimit(SubscriptionPlan.BYTES_UNLIMITED,
+ SubscriptionPlan.LIMIT_BEHAVIOR_BILLED)
+ .setDataUsage(5 * TrafficStats.GB_IN_BYTES,
+ ZonedDateTime.now().minusHours(36).toInstant().toEpochMilli())
+ .build());
+ plans.add(SubscriptionPlan.Builder
+ .createRecurringMonthly(ZonedDateTime.parse("2017-03-14T00:00:00.000Z"))
+ .setTitle("G-Mobile, Charged after limit")
+ .setDataLimit(5 * TrafficStats.GB_IN_BYTES,
+ SubscriptionPlan.LIMIT_BEHAVIOR_BILLED)
+ .setDataUsage(5 * TrafficStats.GB_IN_BYTES,
+ ZonedDateTime.now().minusHours(36).toInstant().toEpochMilli())
+ .build());
} else if ("month_soft".equals(fake)) {
plans.add(SubscriptionPlan.Builder
.createRecurringMonthly(ZonedDateTime.parse("2007-03-14T00:00:00.000Z"))
@@ -2661,6 +2677,23 @@
.setDataUsage(1 * TrafficStats.GB_IN_BYTES,
ZonedDateTime.now().minusHours(1).toInstant().toEpochMilli())
.build());
+ plans.add(SubscriptionPlan.Builder
+ .createRecurringMonthly(ZonedDateTime.parse("2017-03-14T00:00:00.000Z"))
+ .setTitle("G-Mobile, Throttled after limit")
+ .setDataLimit(5 * TrafficStats.GB_IN_BYTES,
+ SubscriptionPlan.LIMIT_BEHAVIOR_THROTTLED)
+ .setDataUsage(5 * TrafficStats.GB_IN_BYTES,
+ ZonedDateTime.now().minusHours(1).toInstant().toEpochMilli())
+ .build());
+ plans.add(SubscriptionPlan.Builder
+ .createRecurringMonthly(ZonedDateTime.parse("2017-03-14T00:00:00.000Z"))
+ .setTitle("G-Mobile, No data connection after limit")
+ .setDataLimit(5 * TrafficStats.GB_IN_BYTES,
+ SubscriptionPlan.LIMIT_BEHAVIOR_DISABLED)
+ .setDataUsage(5 * TrafficStats.GB_IN_BYTES,
+ ZonedDateTime.now().minusHours(1).toInstant().toEpochMilli())
+ .build());
+
} else if ("month_none".equals(fake)) {
plans.add(SubscriptionPlan.Builder
.createRecurringMonthly(ZonedDateTime.parse("2007-03-14T00:00:00.000Z"))
@@ -2691,6 +2724,8 @@
ZonedDateTime.now().plusDays(20))
.setTitle("G-Mobile Nickel Nights")
.setSummary("5¢/GB between 1-5AM")
+ .setDataLimit(5 * TrafficStats.GB_IN_BYTES,
+ SubscriptionPlan.LIMIT_BEHAVIOR_THROTTLED)
.setDataUsage(15 * TrafficStats.MB_IN_BYTES,
ZonedDateTime.now().minusHours(30).toInstant().toEpochMilli())
.build());
@@ -2699,11 +2734,21 @@
ZonedDateTime.now().plusDays(20))
.setTitle("G-Mobile Bonus 3G")
.setSummary("Unlimited 3G data")
- .setDataLimit(5 * TrafficStats.GB_IN_BYTES,
+ .setDataLimit(1 * TrafficStats.GB_IN_BYTES,
SubscriptionPlan.LIMIT_BEHAVIOR_THROTTLED)
.setDataUsage(300 * TrafficStats.MB_IN_BYTES,
ZonedDateTime.now().minusHours(1).toInstant().toEpochMilli())
.build());
+ } else if ("unlimited".equals(fake)) {
+ plans.add(SubscriptionPlan.Builder
+ .createNonrecurring(ZonedDateTime.now().minusDays(20),
+ ZonedDateTime.now().plusDays(10))
+ .setTitle("G-Mobile Awesome")
+ .setDataLimit(SubscriptionPlan.BYTES_UNLIMITED,
+ SubscriptionPlan.LIMIT_BEHAVIOR_THROTTLED)
+ .setDataUsage(50 * TrafficStats.MB_IN_BYTES,
+ ZonedDateTime.now().minusHours(3).toInstant().toEpochMilli())
+ .build());
}
return plans.toArray(new SubscriptionPlan[plans.size()]);
}