Whitelist system apps when using bw_happy_box.

BUG: 27506285
BUG: 26685616
Change-Id: I8352ebbab1778c85e0a1da79a0acede5aea144a1
diff --git a/server/BandwidthController.cpp b/server/BandwidthController.cpp
index b674ee5..84b1914 100644
--- a/server/BandwidthController.cpp
+++ b/server/BandwidthController.cpp
@@ -351,9 +351,12 @@
     snprintf(cmd, sizeof(cmd), "-A bw_penalty_box -j bw_happy_box");
     res |= runIpxtablesCmd(cmd, IptJumpNoAdd);
 
+    /* Whitelist all system apps. */
+    snprintf(cmd, sizeof(cmd),
+            "-A bw_happy_box -m owner --uid-owner %d-%d -j RETURN", 0, MAX_SYSTEM_UID);
+    res |= runIpxtablesCmd(cmd, IptJumpNoAdd);
+
     /* Reject. Defaulting to prot-unreachable */
-    snprintf(cmd, sizeof(cmd), "-D bw_happy_box -j REJECT");
-    runIpxtablesCmd(cmd, IptJumpNoAdd);
     snprintf(cmd, sizeof(cmd), "-A bw_happy_box -j REJECT");
     res |= runIpxtablesCmd(cmd, IptJumpNoAdd);