AudioEffect: add device descriptor to AudioEffect constructor

Add the possibility to specify a target audio device when
creating an audio effect by passing its type and address to
AudioEffect constructor.
When doing so, the session ID must be AUDIO_SESSION_DEVICE.

Bug: 136294538
Test: make
Change-Id: I2a2eba340d3c2537285c091e9a53f305ff161a2b
Merged-In: I2a2eba340d3c2537285c091e9a53f305ff161a2b
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 544b00f..19499e2 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -3294,6 +3294,7 @@
         int32_t priority,
         audio_io_handle_t io,
         audio_session_t sessionId,
+        const AudioDeviceTypeAddr& device __unused,
         const String16& opPackageName,
         pid_t pid,
         status_t *status,
@@ -3352,6 +3353,11 @@
             lStatus = PERMISSION_DENIED;
             goto Exit;
         }
+        if (io != AUDIO_IO_HANDLE_NONE) {
+            ALOGE("%s: io handle should not be specified for device effect", __func__);
+            lStatus = BAD_VALUE;
+            goto Exit;
+        }
         //TODO: add check on device ID when added to arguments
     } else {
         // general sessionId.