OSDN Git Service

log: Polish security record logging structures
authorChris Manton <cmanton@google.com>
Mon, 3 May 2021 23:39:12 +0000 (16:39 -0700)
committerChris Manton <cmanton@google.com>
Wed, 12 May 2021 17:10:32 +0000 (10:10 -0700)
Bug: 183374320
Test: gd/cert/run
Tag: #refactor

Change-Id: If22f738ca7aae645007b72512b25d8ad11a45620

stack/btm/security_device_record.h
stack/include/bt_types.h

index 78afc60..a2c5944 100644 (file)
@@ -189,7 +189,7 @@ typedef enum : uint8_t {
 } tBTM_SM4_BIT;
 
 inline std::string class_of_device_text(const DEV_CLASS& cod) {
-  return base::StringPrintf("0x%01x%01x%01x", cod[2], cod[1], cod[0]);
+  return base::StringPrintf("0x%02x%02x%02x", cod[2], cod[1], cod[0]);
 }
 
 /*
@@ -424,10 +424,10 @@ struct tBTM_SEC_DEV_REC {
 
   std::string ToString() const {
     return base::StringPrintf(
-        "%s %6s SecureConn:%s cod:%s remote_info:%s sm4:0x%02x name:\"%s\"",
+        "%s %6s cod:%s remote_info:%-14s sm4:0x%02x SecureConn:%c name:\"%s\"",
         PRIVATE_ADDRESS(bd_addr), DeviceTypeText(device_type).c_str(),
-        logbool(remote_supports_secure_connections).c_str(),
         class_of_device_text(dev_class).c_str(),
-        remote_version_info.ToString().c_str(), sm4, sec_bd_name);
+        remote_version_info.ToString().c_str(), sm4,
+        (remote_supports_secure_connections) ? 'T' : 'F', sec_bd_name);
   }
 };
index 6d673e2..6091811 100644 (file)
@@ -548,7 +548,7 @@ inline std::string DeviceTypeText(tBT_DEVICE_TYPE type) {
     case BT_DEVICE_TYPE_BLE:
       return std::string("BLE");
     case BT_DEVICE_TYPE_DUMO:
-      return std::string("BR_EDR and BLE");
+      return std::string("DUAL");
     default:
       return std::string("Unknown");
   }