Move AudioMMapPolicy* from android.media to a.m.audio.common SAIDL

Bug: 193275465
Test: make
Change-Id: Ic0f5c1d82011d6372b69cf3e99c971c1efd6465b
diff --git a/media/Android.bp b/media/Android.bp
index b049cb6..aab1647 100644
--- a/media/Android.bp
+++ b/media/Android.bp
@@ -65,6 +65,9 @@
         "aidl/android/media/audio/common/AudioEncapsulationType.aidl",
         "aidl/android/media/audio/common/AudioFormatDescription.aidl",
         "aidl/android/media/audio/common/AudioFormatType.aidl",
+        "aidl/android/media/audio/common/AudioMMapPolicy.aidl",
+        "aidl/android/media/audio/common/AudioMMapPolicyInfo.aidl",
+        "aidl/android/media/audio/common/AudioMMapPolicyType.aidl",
         "aidl/android/media/audio/common/AudioMode.aidl",
         "aidl/android/media/audio/common/AudioOffloadInfo.aidl",
         "aidl/android/media/audio/common/AudioSource.aidl",
diff --git a/media/aidl/android/media/audio/common/AudioMMapPolicy.aidl b/media/aidl/android/media/audio/common/AudioMMapPolicy.aidl
new file mode 100644
index 0000000..bbb0402
--- /dev/null
+++ b/media/aidl/android/media/audio/common/AudioMMapPolicy.aidl
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+package android.media.audio.common;
+
+/**
+ * Audio MMAP policy describe how the aaudio MMAP feature is used.
+ * {@hide}
+ */
+@Backing(type="int")
+@VintfStability
+enum AudioMMapPolicy {
+    /**
+     * The policy is unspecified.
+     */
+    UNSPECIFIED = 0,
+    /**
+     * The MMAP feature is disabled and never used.
+     */
+    NEVER       = 1,
+    /**
+     * If MMAP feature works then uses it. Otherwise, fall back to something else.
+     */
+    AUTO        = 2,
+    /**
+     * The MMAP feature must be used. If not available then fail.
+     */
+    ALWAYS      = 3,
+}
diff --git a/media/aidl/android/media/audio/common/AudioMMapPolicyInfo.aidl b/media/aidl/android/media/audio/common/AudioMMapPolicyInfo.aidl
new file mode 100644
index 0000000..e8f948d
--- /dev/null
+++ b/media/aidl/android/media/audio/common/AudioMMapPolicyInfo.aidl
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+package android.media.audio.common;
+
+import android.media.audio.common.AudioDevice;
+import android.media.audio.common.AudioMMapPolicy;
+
+/**
+ * Audio MMAP policy info describes how an aaudio MMAP feature can be
+ * used on a particular device.
+ * {@hide}
+ */
+@JavaDerive(equals=true, toString=true)
+@VintfStability
+parcelable AudioMMapPolicyInfo {
+    /**
+     * The audio device.
+     */
+    AudioDevice device;
+    /**
+     * The aaudio mmap policy for the audio device.
+     */
+    AudioMMapPolicy mmapPolicy = AudioMMapPolicy.UNSPECIFIED;
+}
diff --git a/media/aidl/android/media/audio/common/AudioMMapPolicyType.aidl b/media/aidl/android/media/audio/common/AudioMMapPolicyType.aidl
new file mode 100644
index 0000000..bbc6e57
--- /dev/null
+++ b/media/aidl/android/media/audio/common/AudioMMapPolicyType.aidl
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+package android.media.audio.common;
+
+/**
+ * The aaudio MMAP policy type.
+ * {@hide}
+ */
+@Backing(type="int")
+@VintfStability
+enum AudioMMapPolicyType {
+    /**
+     * Default aaudio mmap policy. It is used to query whether the
+     * aaudio MMAP could be used or not.
+     */
+    DEFAULT    = 1,
+    /**
+     * Exclusive aaudio mmap policy. It is used to query whether the
+     * aaudio MMAP could be used in exclusive mode or not.
+     */
+    EXCLUSIVE  = 2,
+}
diff --git a/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioMMapPolicy.aidl b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioMMapPolicy.aidl
new file mode 100644
index 0000000..98bf0e5
--- /dev/null
+++ b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioMMapPolicy.aidl
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.media.audio.common;
+/* @hide */
+@Backing(type="int") @VintfStability
+enum AudioMMapPolicy {
+  UNSPECIFIED = 0,
+  NEVER = 1,
+  AUTO = 2,
+  ALWAYS = 3,
+}
diff --git a/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioMMapPolicyInfo.aidl b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioMMapPolicyInfo.aidl
new file mode 100644
index 0000000..7c4f75e
--- /dev/null
+++ b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioMMapPolicyInfo.aidl
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.media.audio.common;
+/* @hide */
+@JavaDerive(equals=true, toString=true) @VintfStability
+parcelable AudioMMapPolicyInfo {
+  android.media.audio.common.AudioDevice device;
+  android.media.audio.common.AudioMMapPolicy mmapPolicy = android.media.audio.common.AudioMMapPolicy.UNSPECIFIED;
+}
diff --git a/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioMMapPolicyType.aidl b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioMMapPolicyType.aidl
new file mode 100644
index 0000000..efe8826
--- /dev/null
+++ b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioMMapPolicyType.aidl
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.media.audio.common;
+/* @hide */
+@Backing(type="int") @VintfStability
+enum AudioMMapPolicyType {
+  DEFAULT = 1,
+  EXCLUSIVE = 2,
+}