Avoid create preprocessing effect for playback thread

Bug: 279816789
Test: run gts -m GtsAudioTestCases -t com.google.android.audio.gts.DeviceEffectTest
Test: Build panther and test audio with effects
Change-Id: I8e8956889527c26d88e42005cdcfeb756169d772
diff --git a/services/audioflinger/Effects.cpp b/services/audioflinger/Effects.cpp
index 19e4151..f324408 100644
--- a/services/audioflinger/Effects.cpp
+++ b/services/audioflinger/Effects.cpp
@@ -3407,12 +3407,20 @@
     } else if (patch.isSoftware() || patch.thread().promote() != nullptr) {
         sp <ThreadBase> thread;
         if (audio_port_config_has_input_direction(port)) {
+            if ((mDescriptor.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_POST_PROC) {
+                ALOGI("%s don't create postprocessing effect on record thread", __func__);
+                return NAME_NOT_FOUND;
+            }
             if (patch.isSoftware()) {
                 thread = patch.mRecord.thread();
             } else {
                 thread = patch.thread().promote();
             }
         } else {
+            if ((mDescriptor.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_PRE_PROC) {
+                ALOGI("%s don't create preprocessing effect on playback thread", __func__);
+                return NAME_NOT_FOUND;
+            }
             if (patch.isSoftware()) {
                 thread = patch.mPlayback.thread();
             } else {