Slightly restructure the data saver iptables rules.
1. Make bw_costly_shared jump to bw_happy_box after
bw_penalty_box. This allows the framework to manipulate
whitelists and blacklists independently.
2. Make bw_happy box always whitelist system apps. Because
bw_penalty_box is consulted before bw_happy_box, the
framework can always blacklist certain system apps (e.g.,
the media server) by putting them in the blacklist.
3. Add a method to add/remove a reject at the end of
bw_costly_shared. This will allow the framework to
enable/disable data saver by changing only one rule.
Bug: 26685616
Bug: 27506285
Change-Id: I67bff7c3c9ff5eb3f84fb84550cdf49f153e1b68
diff --git a/server/BandwidthController.h b/server/BandwidthController.h
index c653e2f..3975303 100644
--- a/server/BandwidthController.h
+++ b/server/BandwidthController.h
@@ -55,6 +55,7 @@
int enableBandwidthControl(bool force);
int disableBandwidthControl(void);
+ int enableDataSaver(bool enable);
int setInterfaceSharedQuota(const char *iface, int64_t bytes);
int getInterfaceSharedQuota(int64_t *bytes);
@@ -196,18 +197,6 @@
std::list<QuotaInfo> quotaIfaces;
-private:
- static const char *IPT_FLUSH_COMMANDS[];
- static const char *IPT_CLEANUP_COMMANDS[];
- static const char *IPT_SETUP_COMMANDS[];
- static const char *IPT_BASIC_ACCOUNTING_COMMANDS[];
-
- /* Alphabetical */
- static const char ALERT_GLOBAL_NAME[];
- static const int MAX_CMD_ARGS;
- static const int MAX_CMD_LEN;
- static const int MAX_IFACENAME_LEN;
- static const int MAX_IPT_OUTPUT_LINE_LEN;
};
#endif