Correct the expection of DeviceInfo size am: 72abbbd36d

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2513015

Change-Id: I8bdac7f84f2a4a7a7a3927a1b15be97a3da778d6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Tommy Chiu 2023-03-29 13:46:48 +00:00 committed by Automerger Merge Worker
commit 015b828def

View file

@ -467,16 +467,16 @@ ErrMsgOr<std::unique_ptr<cppbor::Map>> parseAndValidateDeviceInfo(
case 3: case 3:
if (isTeeDeviceInfo(*parsed) && parsed->size() != kNumTeeDeviceInfoEntries) { if (isTeeDeviceInfo(*parsed) && parsed->size() != kNumTeeDeviceInfoEntries) {
error += fmt::format( error += fmt::format(
"Err: Incorrect number of device info entries. Expected {} but got" "Err: Incorrect number of device info entries. Expected {} but got "
"{}\n", "{}\n",
kNumTeeDeviceInfoEntries, parsed->size()); kNumTeeDeviceInfoEntries, parsed->size());
} }
// TEE IRPC instances require all entries to be present in DeviceInfo. Non-TEE instances // TEE IRPC instances require all entries to be present in DeviceInfo. Non-TEE instances
// may omit `os_version` // may omit `os_version`
if (!isTeeDeviceInfo(*parsed) && (parsed->size() != kNumTeeDeviceInfoEntries || if (!isTeeDeviceInfo(*parsed) && (parsed->size() != kNumTeeDeviceInfoEntries &&
parsed->size() != kNumTeeDeviceInfoEntries - 1)) { parsed->size() != kNumTeeDeviceInfoEntries - 1)) {
error += fmt::format( error += fmt::format(
"Err: Incorrect number of device info entries. Expected {} or {} but got" "Err: Incorrect number of device info entries. Expected {} or {} but got "
"{}\n", "{}\n",
kNumTeeDeviceInfoEntries - 1, kNumTeeDeviceInfoEntries, parsed->size()); kNumTeeDeviceInfoEntries - 1, kNumTeeDeviceInfoEntries, parsed->size());
} }