audio_hw: close mmap file descriptor to fix leak
The file descriptor for MMAP shared memory was created
and passed to AudioFlinger but never closed.
Now the FD is closed when the stream is goes to standby.
Bug: 134381208
Test: Get HAL pid.
Test: adb shell ps | grep audio
Test: adb shell ls -l /proc/{halpid}/fd | wc
Test: Run Oboetester or other app that uses MMAP
Test: Completely close the app.
Test: adb shell ls -l /proc/{halpid}/fd | wc
Test: Count should NOT grow each time.
Change-Id: Ieaaf1c6bdc96e7ecf01cee23215fb39f79662111
diff --git a/hal/audio_hw.h b/hal/audio_hw.h
index 54ee72c..15cfa60 100644
--- a/hal/audio_hw.h
+++ b/hal/audio_hw.h
@@ -234,6 +234,7 @@
bool muted;
uint64_t written; /* total frames written, not cleared when entering standby */
int64_t mmap_time_offset_nanos; /* fudge factor to correct inaccuracies in DSP */
+ int mmap_shared_memory_fd; /* file descriptor associated with MMAP NOIRQ shared memory */
audio_io_handle_t handle;
int non_blocking;
@@ -293,6 +294,7 @@
int64_t frames_read; /* total frames read, not cleared when entering standby */
int64_t frames_muted; /* total frames muted, not cleared when entering standby */
int64_t mmap_time_offset_nanos; /* fudge factor to correct inaccuracies in DSP */
+ int mmap_shared_memory_fd; /* file descriptor associated with MMAP NOIRQ shared memory */
audio_io_handle_t capture_handle;
audio_input_flags_t flags;