Merge "Restore gnss@1.1 HAL capability bits removed in gnss@2.0 (hal)" into qt-dev
diff --git a/camera/device/3.4/default/CameraDeviceSession.cpp b/camera/device/3.4/default/CameraDeviceSession.cpp
index e00b3f8..03b6050 100644
--- a/camera/device/3.4/default/CameraDeviceSession.cpp
+++ b/camera/device/3.4/default/CameraDeviceSession.cpp
@@ -187,7 +187,6 @@
             mPhysicalCameraIdMap[id] = requestedConfiguration.streams[i].physicalCameraId;
             mStreamMap[id].data_space = mapToLegacyDataspace(
                     mStreamMap[id].data_space);
-            mStreamMap[id].physical_camera_id = mPhysicalCameraIdMap[id].c_str();
             mCirculatingBuffers.emplace(stream.mId, CirculatingBuffers{});
         } else {
             // width/height/format must not change, but usage/rotation might need to change
@@ -206,6 +205,11 @@
             mStreamMap[id].rotation = (int) requestedConfiguration.streams[i].v3_2.rotation;
             mStreamMap[id].usage = (uint32_t) requestedConfiguration.streams[i].v3_2.usage;
         }
+        // It is possible for the entry in 'mStreamMap' to get initialized by an older
+        // HIDL API. Make sure that the physical id is always initialized when using
+        // a more recent API call.
+        mStreamMap[id].physical_camera_id = mPhysicalCameraIdMap[id].c_str();
+
         (*streams)[i] = &mStreamMap[id];
     }
 
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index 5dfc783..814b88b 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -1364,19 +1364,20 @@
         }
 
         hidl_vec<StreamBuffer> tmpRetBuffers(bufReq.numBuffersRequested);
-        for (size_t i = 0; i < bufReq.numBuffersRequested; i++) {
+        for (size_t j = 0; j < bufReq.numBuffersRequested; j++) {
             hidl_handle buffer_handle;
             mParent->allocateGraphicBuffer(stream.width, stream.height,
                     android_convertGralloc1To0Usage(
                             halStream.producerUsage, halStream.consumerUsage),
                     halStream.overrideFormat, &buffer_handle);
 
-            tmpRetBuffers[i] = {stream.id, mNextBufferId, buffer_handle, BufferStatus::OK,
+            tmpRetBuffers[j] = {stream.id, mNextBufferId, buffer_handle, BufferStatus::OK,
                                 nullptr, nullptr};
             mOutstandingBufferIds[idx].insert(std::make_pair(mNextBufferId++, buffer_handle));
         }
         atLeastOneStreamOk = true;
-        bufRets[0].val.buffers(std::move(tmpRetBuffers));
+        bufRets[i].streamId = stream.id;
+        bufRets[i].val.buffers(std::move(tmpRetBuffers));
     }
 
     if (allStreamOk) {
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index 09cbc20..e48cc79 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -271,7 +271,16 @@
             <instance>default</instance>
         </interface>
     </hal>
-    <hal format="hidl" optional="false">
+    <hal format="hidl" optional="true">
+        <name>android.hardware.media.c2</name>
+        <version>1.0</version>
+        <interface>
+            <name>IComponentStore</name>
+            <regex-instance>default[0-9]*</regex-instance>
+            <regex-instance>vendor[0-9]*_software</regex-instance>
+        </interface>
+    </hal>
+    <hal format="hidl" optional="true">
         <name>android.hardware.media.omx</name>
         <version>1.0</version>
         <interface>
diff --git a/graphics/composer/2.1/utils/hal/include/composer-hal/2.1/ComposerResources.h b/graphics/composer/2.1/utils/hal/include/composer-hal/2.1/ComposerResources.h
index 1df496c..18d184e 100644
--- a/graphics/composer/2.1/utils/hal/include/composer-hal/2.1/ComposerResources.h
+++ b/graphics/composer/2.1/utils/hal/include/composer-hal/2.1/ComposerResources.h
@@ -44,7 +44,7 @@
         if (mMapper3) {
             return true;
         }
-        ALOGW_IF(!mMapper3, "failed to get mapper 3.0 service");
+        ALOGD_IF(!mMapper3, "failed to get mapper 3.0 service, falling back to mapper 2.0");
 
         mMapper2 = mapper::V2_0::IMapper::getService();
         ALOGE_IF(!mMapper2, "failed to get mapper 2.0 service");
diff --git a/graphics/composer/2.3/utils/passthrough/include/composer-passthrough/2.3/HwcHal.h b/graphics/composer/2.3/utils/passthrough/include/composer-passthrough/2.3/HwcHal.h
index 9d67e04..e2bed95 100644
--- a/graphics/composer/2.3/utils/passthrough/include/composer-passthrough/2.3/HwcHal.h
+++ b/graphics/composer/2.3/utils/passthrough/include/composer-passthrough/2.3/HwcHal.h
@@ -328,8 +328,8 @@
             if (error != HWC2_ERROR_NONE) {
                 return error;
             }
-            mChangedLayersCache[display].reserve(typesCount);
-            mCompositionTypesCache[display].reserve(typesCount);
+            mChangedLayersCache[display].resize(typesCount);
+            mCompositionTypesCache[display].resize(typesCount);
             error = BaseType2_1::getChangedCompositionTypesInternal(
                     display, &typesCount, mChangedLayersCache[display].data(),
                     mCompositionTypesCache[display].data());