Let lock_guard deduce its template argument

No functional change, this is a cleanup.

With C++17, it's no longer necessary to specify the teplate argument
when it can be deduced from the types of constructor arguments. This
allows de-cluttering our locking statements.

To avoid typos, this patch was mechanically generated:

  perl -p -i -e 's/std::lock_guard<std::mutex>/std::lock_guard/g' \
    $(find . -name '*.cpp' -o -name '*.h')

Change-Id: Ibb15d9a6c5b1c861d81353e47d25474eb1d4c2df
diff --git a/server/TrafficController.cpp b/server/TrafficController.cpp
index bb7a0ad..0ecffa2 100644
--- a/server/TrafficController.cpp
+++ b/server/TrafficController.cpp
@@ -144,7 +144,7 @@
 }
 
 Status TrafficController::initMaps() {
-    std::lock_guard<std::mutex> ownerMapGuard(mOwnerMatchMutex);
+    std::lock_guard ownerMapGuard(mOwnerMatchMutex);
     RETURN_IF_NOT_OK(
         mCookieTagMap.getOrCreate(COOKIE_UID_MAP_SIZE, COOKIE_TAG_MAP_PATH, BPF_MAP_TYPE_HASH));
 
@@ -416,7 +416,7 @@
 
 Status TrafficController::updateOwnerMapEntry(UidOwnerMatchType match, uid_t uid, FirewallRule rule,
                                               FirewallType type) {
-    std::lock_guard<std::mutex> guard(mOwnerMatchMutex);
+    std::lock_guard guard(mOwnerMatchMutex);
     if ((rule == ALLOW && type == WHITELIST) || (rule == DENY && type == BLACKLIST)) {
         RETURN_IF_NOT_OK(addMatch(mUidOwnerMap, uid, match));
     } else if ((rule == ALLOW && type == BLACKLIST) || (rule == DENY && type == WHITELIST)) {
@@ -470,7 +470,7 @@
 Status TrafficController::updateUidOwnerMap(const std::vector<std::string>& appStrUids,
                                             BandwidthController::IptJumpOp jumpHandling,
                                             BandwidthController::IptOp op) {
-    std::lock_guard<std::mutex> guard(mOwnerMatchMutex);
+    std::lock_guard guard(mOwnerMatchMutex);
     UidOwnerMatchType match = jumpOpToMatch(jumpHandling);
     if (match == NO_MATCH) {
         return statusFromErrno(
@@ -527,7 +527,7 @@
 
 Status TrafficController::replaceUidsInMap(const UidOwnerMatchType match,
                                            const std::vector<int32_t>& uids) {
-    std::lock_guard<std::mutex> guard(mOwnerMatchMutex);
+    std::lock_guard guard(mOwnerMatchMutex);
     std::set<int32_t> uidSet(uids.begin(), uids.end());
     std::vector<uint32_t> uidsToDelete;
     auto getUidsToDelete = [&uidsToDelete, &uidSet](const uint32_t& key,
@@ -579,7 +579,7 @@
 }
 
 int TrafficController::toggleUidOwnerMap(ChildChain chain, bool enable) {
-    std::lock_guard<std::mutex> guard(mOwnerMatchMutex);
+    std::lock_guard guard(mOwnerMatchMutex);
     uint32_t key = CONFIGURATION_KEY;
     auto oldConfiguration = mConfigurationMap.readValue(key);
     if (!isOk(oldConfiguration)) {
@@ -648,7 +648,7 @@
 const String16 TrafficController::DUMP_KEYWORD = String16("trafficcontroller");
 
 void TrafficController::dump(DumpWriter& dw, bool verbose) {
-    std::lock_guard<std::mutex> ownerMapGuard(mOwnerMatchMutex);
+    std::lock_guard ownerMapGuard(mOwnerMatchMutex);
     ScopedIndent indentTop(dw);
     dw.println("TrafficController");