Merge "CCodec: harden against nullptr/out-of-memory"
diff --git a/media/codec2/hidl/1.0/utils/types.cpp b/media/codec2/hidl/1.0/utils/types.cpp
index c053bc1..a128a9d 100644
--- a/media/codec2/hidl/1.0/utils/types.cpp
+++ b/media/codec2/hidl/1.0/utils/types.cpp
@@ -1693,11 +1693,11 @@
if (result != OK) {
ALOGW("attachToBufferQueue -- attachBuffer failed. Error code = %d",
static_cast<int>(result));
- return false;
+ return result;
}
ALOGV("attachToBufferQueue -- attachBuffer returned slot %d",
static_cast<int>(*bqSlot));
- return true;
+ return OK;
}
bool getBufferQueueAssignment(const C2ConstGraphicBlock& block,
@@ -1779,7 +1779,7 @@
static_cast<int>(bqSlot),
static_cast<unsigned>(generation));
_C2BlockFactory::AssignBlockToBufferQueue(
- data, getHgbp(igbp), bqId, bqSlot, true);
+ data, getHgbp(igbp), generation, bqId, bqSlot, true);
return true;
}
diff --git a/media/codec2/hidl/client/client.cpp b/media/codec2/hidl/client/client.cpp
index f5cc9ff..cd374b0 100644
--- a/media/codec2/hidl/client/client.cpp
+++ b/media/codec2/hidl/client/client.cpp
@@ -1186,7 +1186,7 @@
uint32_t outputGeneration = mOutputGeneration;
mOutputBufferQueueMutex.unlock();
- status_t status = !attachToBufferQueue(block,
+ status_t status = attachToBufferQueue(block,
outputIgbp,
outputGeneration,
&bqSlot);
@@ -1218,14 +1218,15 @@
return NO_INIT;
}
- if (bqId != outputBqId) {
- ALOGV("queueToOutputSurface -- bufferqueue ids mismatch.");
- return DEAD_OBJECT;
- }
-
- if (generation != outputGeneration) {
- ALOGV("queueToOutputSurface -- generation numbers mismatch.");
- return DEAD_OBJECT;
+ if (bqId != outputBqId || generation != outputGeneration) {
+ if (!holdBufferQueueBlock(block, mOutputIgbp, mOutputBqId, mOutputGeneration)) {
+ ALOGE("queueToOutputSurface -- migration fialed");
+ return DEAD_OBJECT;
+ }
+ if (!getBufferQueueAssignment(block, &generation, &bqId, &bqSlot)) {
+ ALOGE("queueToOutputSurface -- corrupted bq assignment");
+ return UNKNOWN_ERROR;
+ }
}
status_t status = outputIgbp->queueBuffer(static_cast<int>(bqSlot),
diff --git a/services/audiopolicy/engineconfigurable/wrapper/ParameterManagerWrapper.cpp b/services/audiopolicy/engineconfigurable/wrapper/ParameterManagerWrapper.cpp
index 1934fa4..09faa4c 100644
--- a/services/audiopolicy/engineconfigurable/wrapper/ParameterManagerWrapper.cpp
+++ b/services/audiopolicy/engineconfigurable/wrapper/ParameterManagerWrapper.cpp
@@ -65,6 +65,8 @@
const char *const ParameterManagerWrapper::mPolicyPfwDefaultConfFileName =
"/etc/parameter-framework/ParameterFrameworkConfigurationPolicy.xml";
+const char *const ParameterManagerWrapper::mPolicyPfwVendorConfFileName =
+ "/vendor/etc/parameter-framework/ParameterFrameworkConfigurationPolicy.xml";
static const char *const gInputDeviceCriterionName = "AvailableInputDevices";
static const char *const gOutputDeviceCriterionName = "AvailableOutputDevices";
@@ -96,7 +98,11 @@
: mPfwConnectorLogger(new ParameterMgrPlatformConnectorLogger)
{
// Connector
- mPfwConnector = new CParameterMgrPlatformConnector(mPolicyPfwDefaultConfFileName);
+ if (access(mPolicyPfwVendorConfFileName, R_OK) == 0) {
+ mPfwConnector = new CParameterMgrPlatformConnector(mPolicyPfwVendorConfFileName);
+ } else {
+ mPfwConnector = new CParameterMgrPlatformConnector(mPolicyPfwDefaultConfFileName);
+ }
// Logger
mPfwConnector->setLogger(mPfwConnectorLogger);
diff --git a/services/audiopolicy/engineconfigurable/wrapper/include/ParameterManagerWrapper.h b/services/audiopolicy/engineconfigurable/wrapper/include/ParameterManagerWrapper.h
index 1a634a1..cd39b6f 100644
--- a/services/audiopolicy/engineconfigurable/wrapper/include/ParameterManagerWrapper.h
+++ b/services/audiopolicy/engineconfigurable/wrapper/include/ParameterManagerWrapper.h
@@ -199,6 +199,7 @@
struct parameterManagerElementSupported;
static const char *const mPolicyPfwDefaultConfFileName; /**< Default Policy PFW top file name.*/
+ static const char *const mPolicyPfwVendorConfFileName; /**< Vendor Policy PFW top file name.*/
};
} // namespace audio_policy
diff --git a/services/audiopolicy/service/AudioPolicyService.cpp b/services/audiopolicy/service/AudioPolicyService.cpp
index 416817f..a39477d 100644
--- a/services/audiopolicy/service/AudioPolicyService.cpp
+++ b/services/audiopolicy/service/AudioPolicyService.cpp
@@ -880,9 +880,8 @@
if (it == mA11yUids.end()) {
continue;
}
- if (uid.second.second == ActivityManager::PROCESS_STATE_TOP ||
- uid.second.second == ActivityManager::PROCESS_STATE_FOREGROUND_SERVICE ||
- uid.second.second == ActivityManager::PROCESS_STATE_BOUND_FOREGROUND_SERVICE) {
+ if (uid.second.second >= ActivityManager::PROCESS_STATE_TOP
+ && uid.second.second <= ActivityManager::PROCESS_STATE_BOUND_FOREGROUND_SERVICE) {
return true;
}
}