diff --git a/automotive/vehicle/2.0/default/common/src/VehicleHalManager.cpp b/automotive/vehicle/2.0/default/common/src/VehicleHalManager.cpp index b5de262518..393d3ecc5e 100644 --- a/automotive/vehicle/2.0/default/common/src/VehicleHalManager.cpp +++ b/automotive/vehicle/2.0/default/common/src/VehicleHalManager.cpp @@ -218,7 +218,7 @@ void VehicleHalManager::onHalPropertySetError(StatusCode errorCode, const auto& clients = mSubscriptionManager.getSubscribedClients(property, SubscribeFlags::EVENTS_FROM_CAR); - for (auto client : clients) { + for (const auto& client : clients) { client->getCallback()->onPropertySetError(errorCode, property, areaId); } } @@ -312,7 +312,7 @@ bool VehicleHalManager::checkReadPermission(const VehiclePropConfig &config) con void VehicleHalManager::handlePropertySetEvent(const VehiclePropValue& value) { auto clients = mSubscriptionManager.getSubscribedClients(value.prop, SubscribeFlags::EVENTS_FROM_ANDROID); - for (auto client : clients) { + for (const auto& client : clients) { client->getCallback()->onPropertySet(value); } } diff --git a/automotive/vehicle/2.0/default/tests/SubscriptionManager_test.cpp b/automotive/vehicle/2.0/default/tests/SubscriptionManager_test.cpp index ab2013d08c..23ab6bc9fe 100644 --- a/automotive/vehicle/2.0/default/tests/SubscriptionManager_test.cpp +++ b/automotive/vehicle/2.0/default/tests/SubscriptionManager_test.cpp @@ -66,7 +66,7 @@ public: static std::list> extractCallbacks( const std::list>& clients) { std::list> callbacks; - for (auto c : clients) { + for (const auto& c : clients) { callbacks.push_back(c->getCallback()); } return callbacks; diff --git a/camera/device/3.2/default/CameraDevice.cpp b/camera/device/3.2/default/CameraDevice.cpp index dfbb9768a4..297e7781e6 100644 --- a/camera/device/3.2/default/CameraDevice.cpp +++ b/camera/device/3.2/default/CameraDevice.cpp @@ -262,7 +262,7 @@ Return CameraDevice::open(const sp& callback, open_ session->getInterface()->interfaceChain([]( ::android::hardware::hidl_vec<::android::hardware::hidl_string> interfaceChain) { ALOGV("Session interface chain:"); - for (auto iface : interfaceChain) { + for (const auto& iface : interfaceChain) { ALOGV(" %s", iface.c_str()); } }); diff --git a/camera/device/3.3/default/CameraDevice.cpp b/camera/device/3.3/default/CameraDevice.cpp index ce5e1de239..b4d279e32c 100644 --- a/camera/device/3.3/default/CameraDevice.cpp +++ b/camera/device/3.3/default/CameraDevice.cpp @@ -49,7 +49,7 @@ sp CameraDevice::createSession(camera session->getInterface()->interfaceChain([]( ::android::hardware::hidl_vec<::android::hardware::hidl_string> interfaceChain) { ALOGV("Session interface chain:"); - for (auto iface : interfaceChain) { + for (const auto& iface : interfaceChain) { ALOGV(" %s", iface.c_str()); } }); diff --git a/camera/device/3.4/default/CameraDevice.cpp b/camera/device/3.4/default/CameraDevice.cpp index d73833a9c3..bc443deb35 100644 --- a/camera/device/3.4/default/CameraDevice.cpp +++ b/camera/device/3.4/default/CameraDevice.cpp @@ -49,7 +49,7 @@ sp CameraDevice::createSession(camera session->getInterface()->interfaceChain([]( ::android::hardware::hidl_vec<::android::hardware::hidl_string> interfaceChain) { ALOGV("Session interface chain:"); - for (auto iface : interfaceChain) { + for (const auto& iface : interfaceChain) { ALOGV(" %s", iface.c_str()); } }); diff --git a/contexthub/1.0/vts/functional/VtsHalContexthubV1_0TargetTest.cpp b/contexthub/1.0/vts/functional/VtsHalContexthubV1_0TargetTest.cpp index 7492152095..629477aa99 100644 --- a/contexthub/1.0/vts/functional/VtsHalContexthubV1_0TargetTest.cpp +++ b/contexthub/1.0/vts/functional/VtsHalContexthubV1_0TargetTest.cpp @@ -83,7 +83,7 @@ std::vector getHubIds() { sp hubApi = ::testing::VtsHalHidlTargetTestBase::getService(); if (hubApi != nullptr) { - for (ContextHub hub : getHubsSync(hubApi)) { + for (const ContextHub& hub : getHubsSync(hubApi)) { hubIds.push_back(hub.hubId); } } @@ -206,7 +206,7 @@ TEST_F(ContexthubHidlTestBase, TestGetHubs) { hidl_vec hubs = getHubsSync(hubApi); ALOGD("System reports %zu hubs", hubs.size()); - for (ContextHub hub : hubs) { + for (const ContextHub& hub : hubs) { ALOGD("Checking hub ID %" PRIu32, hub.hubId); EXPECT_FALSE(hub.name.empty()); diff --git a/drm/1.0/vts/functional/drm_hal_vendor_test.cpp b/drm/1.0/vts/functional/drm_hal_vendor_test.cpp index d03b2af377..20a2ca4af7 100644 --- a/drm/1.0/vts/functional/drm_hal_vendor_test.cpp +++ b/drm/1.0/vts/functional/drm_hal_vendor_test.cpp @@ -177,7 +177,7 @@ class DrmHalVendorFactoryTest : public testing::TestWithParam { TEST_P(DrmHalVendorFactoryTest, ValidateConfigurations) { const char* kVendorStr = "Vendor module "; size_t count = 0; - for (auto config : contentConfigurations) { + for (const auto& config : contentConfigurations) { ASSERT_TRUE(config.name.size() > 0) << kVendorStr << "has no name"; ASSERT_TRUE(config.serverUrl.size() > 0) << kVendorStr << "has no serverUrl"; @@ -186,7 +186,7 @@ TEST_P(DrmHalVendorFactoryTest, ValidateConfigurations) { ASSERT_TRUE(config.mimeType.size() > 0) << kVendorStr << "has no mime type"; ASSERT_TRUE(config.keys.size() >= 1) << kVendorStr << "has no keys"; - for (auto key : config.keys) { + for (const auto& key : config.keys) { ASSERT_TRUE(key.keyId.size() > 0) << kVendorStr << " has zero length keyId"; ASSERT_TRUE(key.keyId.size() > 0) << kVendorStr @@ -245,7 +245,7 @@ TEST_P(DrmHalVendorFactoryTest, InvalidContentTypeNotSupported) { */ TEST_P(DrmHalVendorFactoryTest, ValidContentTypeSupported) { RETURN_IF_SKIPPED; - for (auto config : contentConfigurations) { + for (const auto& config : contentConfigurations) { EXPECT_TRUE(drmFactory->isContentTypeSupported(config.mimeType)); } } @@ -610,7 +610,7 @@ TEST_P(DrmHalVendorPluginTest, RemoveKeysNewSession) { */ TEST_P(DrmHalVendorPluginTest, RestoreKeys) { RETURN_IF_SKIPPED; - for (auto config : contentConfigurations) { + for (const auto& config : contentConfigurations) { if (config.policy.allowOffline) { auto sessionId = openSession(); hidl_vec keySetId = @@ -645,7 +645,7 @@ TEST_P(DrmHalVendorPluginTest, RestoreKeysNull) { */ TEST_P(DrmHalVendorPluginTest, RestoreKeysClosedSession) { RETURN_IF_SKIPPED; - for (auto config : contentConfigurations) { + for (const auto& config : contentConfigurations) { if (config.policy.allowOffline) { auto sessionId = openSession(); hidl_vec keySetId = @@ -1022,8 +1022,8 @@ TEST_P(DrmHalVendorPluginTest, RequiresSecureDecoderInvalidMimeType) { */ TEST_P(DrmHalVendorPluginTest, RequiresSecureDecoderConfig) { RETURN_IF_SKIPPED; - for (auto config : contentConfigurations) { - for (auto key : config.keys) { + for (const auto& config : contentConfigurations) { + for (const auto& key : config.keys) { if (key.isSecure) { EXPECT_TRUE(cryptoPlugin->requiresSecureDecoderComponent(config.mimeType)); break; @@ -1471,7 +1471,7 @@ TEST_P(DrmHalVendorDecryptTest, QueryKeyStatusWithNoKeys) { */ TEST_P(DrmHalVendorDecryptTest, QueryKeyStatus) { RETURN_IF_SKIPPED; - for (auto config : contentConfigurations) { + for (const auto& config : contentConfigurations) { auto sessionId = openSession(); loadKeys(sessionId, config); auto keyStatus = queryKeyStatus(sessionId); @@ -1485,8 +1485,8 @@ TEST_P(DrmHalVendorDecryptTest, QueryKeyStatus) { */ TEST_P(DrmHalVendorDecryptTest, ClearSegmentTest) { RETURN_IF_SKIPPED; - for (auto config : contentConfigurations) { - for (auto key : config.keys) { + for (const auto& config : contentConfigurations) { + for (const auto& key : config.keys) { const size_t kSegmentSize = 1024; vector iv(AES_BLOCK_SIZE, 0); const Pattern noPattern = {0, 0}; @@ -1513,8 +1513,8 @@ TEST_P(DrmHalVendorDecryptTest, ClearSegmentTest) { */ TEST_P(DrmHalVendorDecryptTest, EncryptedAesCtrSegmentTest) { RETURN_IF_SKIPPED; - for (auto config : contentConfigurations) { - for (auto key : config.keys) { + for (const auto& config : contentConfigurations) { + for (const auto& key : config.keys) { const size_t kSegmentSize = 1024; vector iv(AES_BLOCK_SIZE, 0); const Pattern noPattern = {0, 0}; @@ -1540,8 +1540,8 @@ TEST_P(DrmHalVendorDecryptTest, EncryptedAesCtrSegmentTest) { */ TEST_P(DrmHalVendorDecryptTest, EncryptedAesCtrSegmentTestNoKeys) { RETURN_IF_SKIPPED; - for (auto config : contentConfigurations) { - for (auto key : config.keys) { + for (const auto& config : contentConfigurations) { + for (const auto& key : config.keys) { vector iv(AES_BLOCK_SIZE, 0); const Pattern noPattern = {0, 0}; const vector subSamples = {{.numBytesOfClearData = 256, @@ -1567,8 +1567,8 @@ TEST_P(DrmHalVendorDecryptTest, EncryptedAesCtrSegmentTestNoKeys) { */ TEST_P(DrmHalVendorDecryptTest, AttemptDecryptWithKeysRemoved) { RETURN_IF_SKIPPED; - for (auto config : contentConfigurations) { - for (auto key : config.keys) { + for (const auto& config : contentConfigurations) { + for (const auto& key : config.keys) { vector iv(AES_BLOCK_SIZE, 0); const Pattern noPattern = {0, 0}; const vector subSamples = {{.numBytesOfClearData = 256, diff --git a/drm/1.1/vts/functional/drm_hal_clearkey_test.cpp b/drm/1.1/vts/functional/drm_hal_clearkey_test.cpp index 1246616960..7dedd7f0b9 100644 --- a/drm/1.1/vts/functional/drm_hal_clearkey_test.cpp +++ b/drm/1.1/vts/functional/drm_hal_clearkey_test.cpp @@ -228,13 +228,13 @@ protected: const std::string& componentName, const VT& componentValue) { bool validAttribute = false; bool validComponent = false; - for (DrmMetricGroup::Attribute attribute : metric.attributes) { + for (const DrmMetricGroup::Attribute& attribute : metric.attributes) { if (attribute.name == attributeName && ValueEquals(attribute.type, attributeValue, attribute)) { validAttribute = true; } } - for (DrmMetricGroup::Value value : metric.values) { + for (const DrmMetricGroup::Value& value : metric.values) { if (value.componentName == componentName && ValueEquals(value.type, componentValue, value)) { validComponent = true; diff --git a/graphics/composer/2.1/utils/vts/ComposerVts.cpp b/graphics/composer/2.1/utils/vts/ComposerVts.cpp index 2f531b419f..6e668afdca 100644 --- a/graphics/composer/2.1/utils/vts/ComposerVts.cpp +++ b/graphics/composer/2.1/utils/vts/ComposerVts.cpp @@ -78,9 +78,9 @@ std::unique_ptr Composer::createClient() { ComposerClient::ComposerClient(const sp& client) : mClient(client) {} ComposerClient::~ComposerClient() { - for (auto it : mDisplayResources) { + for (const auto& it : mDisplayResources) { Display display = it.first; - DisplayResource& resource = it.second; + const DisplayResource& resource = it.second; for (auto layer : resource.layers) { EXPECT_EQ(Error::NONE, mClient->destroyLayer(display, layer))