Strict-related commands porting

Test: built, flashed, booted
      system/netd/tests/runtests.sh passes

Change-Id: Ibff8b050915c65e44cd37bb835943b8582fc003a
diff --git a/server/NetdNativeService.cpp b/server/NetdNativeService.cpp
index c155ac1..d5e5800 100644
--- a/server/NetdNativeService.cpp
+++ b/server/NetdNativeService.cpp
@@ -775,5 +775,29 @@
     gLog.log(entry.returns(res).withAutomaticDuration());
     return statusFromErrcode(res);
 }
+
+binder::Status NetdNativeService::strictUidCleartextPenalty(int32_t uid, int32_t policyPenalty) {
+    NETD_LOCKING_RPC(NETWORK_STACK, gCtls->strictCtrl.lock);
+    auto entry = gLog.newEntry().prettyFunction(__PRETTY_FUNCTION__).arg(uid).arg(policyPenalty);
+    StrictPenalty penalty;
+    switch (policyPenalty) {
+        case INetd::PENALTY_POLICY_REJECT:
+            penalty = REJECT;
+            break;
+        case INetd::PENALTY_POLICY_LOG:
+            penalty = LOG;
+            break;
+        case INetd::PENALTY_POLICY_ACCEPT:
+            penalty = ACCEPT;
+            break;
+        default:
+            return statusFromErrcode(-EINVAL);
+            break;
+    }
+    int res = gCtls->strictCtrl.setUidCleartextPenalty((uid_t) uid, penalty);
+    gLog.log(entry.returns(res).withAutomaticDuration());
+    return statusFromErrcode(res);
+}
+
 }  // namespace net
 }  // namespace android