Add interface to query the mmap support.
Currently, the mmap support is defined in system property. But the
system property only indicates if the mmap is supported or not. It
doesn't indicate on which device mmap is supported. In that case, adding
an interface to query the mmap support can help make things clear.
Test: atest AAudioTests
Test: Run OboeTester TEST OUTPUT
Test: Verify that MMAP is showed as enabled if supported
Test: Try toggling MMAP on and off when opening streams
Bug: 193275465
Change-Id: Iac289c1a02e6e2ab4076ab6f2b5045efecad97ac
diff --git a/services/audioflinger/PropertyUtils.h b/services/audioflinger/PropertyUtils.h
new file mode 100644
index 0000000..38cbf92
--- /dev/null
+++ b/services/audioflinger/PropertyUtils.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <android/media/AudioMMapPolicyType.h>
+#include <android/media/AudioMMapPolicyInfo.h>
+
+namespace android {
+
+status_t getMmapPolicyInfosFromSystemProperty(
+ media::AudioMMapPolicyType policyType,
+ std::vector<media::AudioMMapPolicyInfo> *policyInfos);
+
+} // namespace android