OMXNodeInstance: Allow dynamic native handle mode for input buffers
Some camera implementation uses Dynamic native handle to send input
buffers to OMX HAL. Therefore, these buffers should be allowed.
Bug: 77486542
Bug: 80174666
Bug: 80210572
Bug: 80252747
Test: sts-tradefed run sts -m StsHostTestCases -t android.security.sts.Poc18_06#testPocBug_77486542
Test: adb shell am instrument -e size small -w 'android.media.cts/android.support.test.runner.AndroidJUnitRunner'
Test: adb shell am instrument -e class android.hardware.cts.CameraTest -w 'android.camera.cts/android.support.test.runner.AndroidJUnitRunner'
Test: adb shell am instrument -e class android.hardware.multiprocess.camera.cts.CameraEvictionTest -w 'android.camera.cts/android.support.test.runner.AndroidJUnitRunner'
Test: Exercise secure playback with Play Movies app.
Test: Record video with Camera app and play it back with Photos app
Change-Id: I1e4eb72e070f4e60ff4df94f9b9d161361828477
(cherry picked from commit bda339098d273066fe50d4cb77503bac5ea4ede0)
diff --git a/media/libstagefright/omx/OMXNodeInstance.cpp b/media/libstagefright/omx/OMXNodeInstance.cpp
index 4f38dee..a9fbd71 100644
--- a/media/libstagefright/omx/OMXNodeInstance.cpp
+++ b/media/libstagefright/omx/OMXNodeInstance.cpp
@@ -1077,7 +1077,8 @@
}
case OMXBuffer::kBufferTypeSharedMem: {
- if (mPortMode[portIndex] != IOMX::kPortModePresetByteBuffer) {
+ if (mPortMode[portIndex] != IOMX::kPortModePresetByteBuffer
+ && mPortMode[portIndex] != IOMX::kPortModeDynamicANWBuffer) {
break;
}
return useBuffer_l(portIndex, omxBuffer.mMem, NULL, buffer);
@@ -1092,7 +1093,8 @@
case OMXBuffer::kBufferTypeHidlMemory: {
if (mPortMode[portIndex] != IOMX::kPortModePresetByteBuffer
- && mPortMode[portIndex] != IOMX::kPortModeDynamicANWBuffer) {
+ && mPortMode[portIndex] != IOMX::kPortModeDynamicANWBuffer
+ && mPortMode[portIndex] != IOMX::kPortModeDynamicNativeHandle) {
break;
}
sp<IHidlMemory> hidlMemory = mapMemory(omxBuffer.mHidlMemory);
@@ -1107,7 +1109,8 @@
break;
}
- ALOGE("b/77486542");
+ ALOGE("b/77486542 : bufferType = %d vs. portMode = %d",
+ omxBuffer.mBufferType, mPortMode[portIndex]);
android_errorWriteLog(0x534e4554, "77486542");
return INVALID_OPERATION;
}