Merge "Add HAL support for Passpoint venue URL"
diff --git a/automotive/audiocontrol/aidl/Android.bp b/automotive/audiocontrol/aidl/Android.bp
new file mode 100644
index 0000000..f8240b1
--- /dev/null
+++ b/automotive/audiocontrol/aidl/Android.bp
@@ -0,0 +1,13 @@
+// This is the expected build file, but it may not be right in all cases
+
+aidl_interface {
+    name: "android.hardware.automotive.audiocontrol",
+    vendor_available: true,
+    srcs: ["android/hardware/automotive/audiocontrol/*.aidl"],
+    stability: "vintf",
+    backend: {
+        java: {
+            sdk_version: "module_current",
+        },
+    },
+}
diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/AudioFocusChange.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/AudioFocusChange.aidl
new file mode 100644
index 0000000..3dc393a
--- /dev/null
+++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/AudioFocusChange.aidl
@@ -0,0 +1,29 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files 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.hardware.automotive.audiocontrol;
+@Backing(type="int") @VintfStability
+enum AudioFocusChange {
+  NONE = 0,
+  GAIN = 1,
+  GAIN_TRANSIENT = 2,
+  GAIN_TRANSIENT_MAY_DUCK = 3,
+  GAIN_TRANSIENT_EXCLUSIVE = 4,
+  LOSS = -1,
+  LOSS_TRANSIENT = -2,
+  LOSS_TRANSIENT_CAN_DUCK = -3,
+}
diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IAudioControl.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IAudioControl.aidl
new file mode 100644
index 0000000..6916846
--- /dev/null
+++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IAudioControl.aidl
@@ -0,0 +1,25 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files 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.hardware.automotive.audiocontrol;
+@VintfStability
+interface IAudioControl {
+  oneway void onAudioFocusChange(in String usage, in int zoneId, in android.hardware.automotive.audiocontrol.AudioFocusChange focusChange);
+  oneway void registerFocusListener(in android.hardware.automotive.audiocontrol.IFocusListener listener);
+  oneway void setBalanceTowardRight(in float value);
+  oneway void setFadeTowardFront(in float value);
+}
diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IFocusListener.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IFocusListener.aidl
new file mode 100644
index 0000000..f00f042
--- /dev/null
+++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IFocusListener.aidl
@@ -0,0 +1,23 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files 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.hardware.automotive.audiocontrol;
+@VintfStability
+interface IFocusListener {
+  oneway void abandonAudioFocus(in String usage, in int zoneId);
+  oneway void requestAudioFocus(in String usage, in int zoneId, in android.hardware.automotive.audiocontrol.AudioFocusChange focusGain);
+}
diff --git a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/AudioFocusChange.aidl b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/AudioFocusChange.aidl
new file mode 100644
index 0000000..fc35fa9
--- /dev/null
+++ b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/AudioFocusChange.aidl
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2020 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.hardware.automotive.audiocontrol;
+
+/**
+ * Changes in audio focus that can be experienced
+ */
+@VintfStability
+@Backing(type="int")
+enum AudioFocusChange {
+    NONE = 0,
+    GAIN = 1,
+    GAIN_TRANSIENT = 2,
+    GAIN_TRANSIENT_MAY_DUCK = 3,
+    GAIN_TRANSIENT_EXCLUSIVE = 4,
+    LOSS = -1, // -1 * GAIN,
+    LOSS_TRANSIENT = -2, // -1 * GAIN_TRANSIENT,
+    LOSS_TRANSIENT_CAN_DUCK = -3, // -1 * GAIN_TRANSIENT_MAY_DUCK,
+}
\ No newline at end of file
diff --git a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl
new file mode 100644
index 0000000..0641691
--- /dev/null
+++ b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2020 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.hardware.automotive.audiocontrol;
+
+import android.hardware.automotive.audiocontrol.AudioFocusChange;
+import android.hardware.automotive.audiocontrol.IFocusListener;
+
+/**
+ * Interacts with the car's audio subsystem to manage audio sources and volumes
+ */
+@VintfStability
+interface IAudioControl {
+    /**
+     * Notifies HAL of changes in audio focus status for focuses requested or abandoned by the HAL.
+     *
+     * This will be called in response to IFocusListener's requestAudioFocus and
+     * abandonAudioFocus, as well as part of any change in focus being held by the HAL due focus
+     * request from other activities or services.
+     *
+     * The HAL is not required to wait for an callback of AUDIOFOCUS_GAIN before playing audio, nor
+     * is it required to stop playing audio in the event of a AUDIOFOCUS_LOSS callback is received.
+     *
+     * @param usage The audio usage associated with the focus change {@code AttributeUsage}. See
+     * {@code audioUsage} in audio_policy_configuration.xsd for the list of allowed values.
+     * @param zoneId The identifier for the audio zone that the HAL is playing the stream in
+     * @param focusChange the AudioFocusChange that has occurred.
+     */
+    oneway void onAudioFocusChange(in String usage, in int zoneId, in AudioFocusChange focusChange);
+
+    /**
+     * Registers focus listener to be used by HAL for requesting and abandoning audio focus.
+     *
+     * It is expected that there will only ever be a single focus listener registered. If the
+     * observer dies, the HAL implementation must unregister observer automatically. If called when
+     * a listener is already registered, the existing one should be unregistered and replaced with
+     * the new listener.
+     *
+     * @param listener the listener interface.
+     */
+    oneway void registerFocusListener(in IFocusListener listener);
+
+    /**
+     * Control the right/left balance setting of the car speakers.
+     *
+     * This is intended to shift the speaker volume toward the right (+) or left (-) side of
+     * the car. 0.0 means "centered". +1.0 means fully right. -1.0 means fully left.
+     *
+     * A value outside the range -1 to 1 must be clamped by the implementation to the -1 to 1
+     * range.
+     */
+    oneway void setBalanceTowardRight(in float value);
+
+    /**
+     * Control the fore/aft fade setting of the car speakers.
+     *
+     * This is intended to shift the speaker volume toward the front (+) or back (-) of the car.
+     * 0.0 means "centered". +1.0 means fully forward. -1.0 means fully rearward.
+     *
+     * A value outside the range -1 to 1 must be clamped by the implementation to the -1 to 1
+     * range.
+     */
+    oneway void setFadeTowardFront(in float value);
+}
\ No newline at end of file
diff --git a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IFocusListener.aidl b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IFocusListener.aidl
new file mode 100644
index 0000000..b79295a
--- /dev/null
+++ b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IFocusListener.aidl
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2020 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.hardware.automotive.audiocontrol;
+
+import android.hardware.automotive.audiocontrol.AudioFocusChange;
+
+/**
+ * Callback interface for audio focus listener.
+ *
+ * For typical configuration, the listener the car audio service.
+ */
+@VintfStability
+interface IFocusListener {
+    /**
+     * Called whenever HAL is abandoning focus as it is finished playing audio of a given usage in a
+     * specific zone.
+     *
+     * In response, IAudioControl#onAudioFocusChange will be called with focusChange status. This
+     * interaction is oneway to avoid blocking HAL so that it is not required to wait for a response
+     * before stopping audio playback.
+     *
+     * @param usage The audio usage for which the HAL is abandoning focus {@code AttributeUsage}.
+     * See {@code audioUsage} in audio_policy_configuration.xsd for the list of allowed values.
+     * @param zoneId The identifier for the audio zone that the HAL abandoning focus
+     */
+    oneway void abandonAudioFocus(in String usage, in int zoneId);
+
+    /**
+     * Called whenever HAL is requesting focus as it is starting to play audio of a given usage in a
+     * specified zone.
+     *
+     * In response, IAudioControl#onAudioFocusChange will be called with focusChange status. This
+     * interaction is oneway to avoid blocking HAL so that it is not required to wait for a response
+     * before playing audio.
+     *
+     * @param usage The audio usage associated with the focus request {@code AttributeUsage}. See
+     * {@code audioUsage} in audio_policy_configuration.xsd for the list of allowed values.
+     * @param zoneId The identifier for the audio zone where the HAL is requesting focus
+     * @param focusGain The AudioFocusChange associated with this request. Should be one of the
+     * following: GAIN, GAIN_TRANSIENT, GAIN_TRANSIENT_MAY_DUCK, GAIN_TRANSIENT_EXCLUSIVE.
+     */
+    oneway void requestAudioFocus(in String usage, in int zoneId, in AudioFocusChange focusGain);
+}
\ No newline at end of file
diff --git a/automotive/audiocontrol/aidl/default/Android.bp b/automotive/audiocontrol/aidl/default/Android.bp
new file mode 100644
index 0000000..faf7ad2
--- /dev/null
+++ b/automotive/audiocontrol/aidl/default/Android.bp
@@ -0,0 +1,36 @@
+// Copyright (C) 2020 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.
+
+cc_binary {
+    name: "android.hardware.automotive.audiocontrol-service.example",
+    relative_install_path: "hw",
+    init_rc: ["audiocontrol-default.rc"],
+    vintf_fragments: ["audiocontrol-default.xml"],
+    vendor: true,
+    generated_headers: ["audio_policy_configuration_V7_0"],
+    generated_sources: ["audio_policy_configuration_V7_0"],
+    header_libs: ["libxsdc-utils"],
+    shared_libs: [
+        "android.hardware.automotive.audiocontrol-ndk_platform",
+        "libbase",
+        "libbinder_ndk",
+        "liblog",
+        "libcutils",
+        "libxml2",
+    ],
+    srcs: [
+        "AudioControl.cpp",
+        "main.cpp",
+    ],
+}
diff --git a/automotive/audiocontrol/aidl/default/AudioControl.cpp b/automotive/audiocontrol/aidl/default/AudioControl.cpp
new file mode 100644
index 0000000..b637310
--- /dev/null
+++ b/automotive/audiocontrol/aidl/default/AudioControl.cpp
@@ -0,0 +1,224 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#include "AudioControl.h"
+
+#include <aidl/android/hardware/automotive/audiocontrol/AudioFocusChange.h>
+#include <aidl/android/hardware/automotive/audiocontrol/IFocusListener.h>
+
+#include <android-base/logging.h>
+#include <android-base/parseint.h>
+#include <android-base/strings.h>
+
+#include <audio_policy_configuration_V7_0.h>
+#include <private/android_filesystem_config.h>
+
+#include <stdio.h>
+
+namespace aidl::android::hardware::automotive::audiocontrol {
+
+using ::android::base::EqualsIgnoreCase;
+using ::android::base::ParseInt;
+using ::std::string;
+
+namespace xsd {
+using namespace audio::policy::configuration::V7_0;
+}
+
+namespace {
+const float kLowerBound = -1.0f;
+const float kUpperBound = 1.0f;
+bool checkCallerHasWritePermissions(int fd) {
+    // Double check that's only called by root - it should be be blocked at debug() level,
+    // but it doesn't hurt to make sure...
+    if (AIBinder_getCallingUid() != AID_ROOT) {
+        dprintf(fd, "Must be root\n");
+        return false;
+    }
+    return true;
+}
+
+bool isValidValue(float value) {
+    return (value >= kLowerBound) && (value <= kUpperBound);
+}
+
+bool safelyParseInt(string s, int* out) {
+    if (!ParseInt(s, out)) {
+        return false;
+    }
+    return true;
+}
+}  // namespace
+
+ndk::ScopedAStatus AudioControl::registerFocusListener(
+        const shared_ptr<IFocusListener>& in_listener) {
+    LOG(DEBUG) << "registering focus listener";
+
+    if (in_listener.get()) {
+        std::atomic_store(&mFocusListener, in_listener);
+    } else {
+        LOG(ERROR) << "Unexpected nullptr for listener resulting in no-op.";
+    }
+    return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus AudioControl::setBalanceTowardRight(float value) {
+    if (isValidValue(value)) {
+        // Just log in this default mock implementation
+        LOG(INFO) << "Balance set to " << value;
+    } else {
+        LOG(ERROR) << "Balance value out of range -1 to 1 at " << value;
+    }
+    return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus AudioControl::setFadeTowardFront(float value) {
+    if (isValidValue(value)) {
+        // Just log in this default mock implementation
+        LOG(INFO) << "Fader set to " << value;
+    } else {
+        LOG(ERROR) << "Fader value out of range -1 to 1 at " << value;
+    }
+    return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus AudioControl::onAudioFocusChange(const string& in_usage, int32_t in_zoneId,
+                                                    AudioFocusChange in_focusChange) {
+    LOG(INFO) << "Focus changed: " << toString(in_focusChange).c_str() << " for usage "
+              << in_usage.c_str() << " in zone " << in_zoneId;
+    return ndk::ScopedAStatus::ok();
+}
+
+binder_status_t AudioControl::dump(int fd, const char** args, uint32_t numArgs) {
+    if (numArgs == 0) {
+        return dumpsys(fd);
+    }
+
+    string option = string(args[0]);
+    if (EqualsIgnoreCase(option, "--help")) {
+        return cmdHelp(fd);
+    } else if (EqualsIgnoreCase(option, "--request")) {
+        return cmdRequestFocus(fd, args, numArgs);
+    } else if (EqualsIgnoreCase(option, "--abandon")) {
+        return cmdAbandonFocus(fd, args, numArgs);
+    } else {
+        dprintf(fd, "Invalid option: %s\n", option.c_str());
+        return STATUS_BAD_VALUE;
+    }
+}
+
+binder_status_t AudioControl::dumpsys(int fd) {
+    if (mFocusListener == nullptr) {
+        dprintf(fd, "No focus listener registered\n");
+    } else {
+        dprintf(fd, "Focus listener registered\n");
+    }
+    return STATUS_OK;
+}
+
+binder_status_t AudioControl::cmdHelp(int fd) const {
+    dprintf(fd, "Usage: \n\n");
+    dprintf(fd, "[no args]: dumps focus listener status\n");
+    dprintf(fd, "--help: shows this help\n");
+    dprintf(fd,
+            "--request <USAGE> <ZONE_ID> <FOCUS_GAIN>: requests audio focus for specified "
+            "usage (string), audio zone ID (int), and focus gain type (int)\n");
+    dprintf(fd,
+            "--abandon <USAGE> <ZONE_ID>: abandons audio focus for specified usage (string) and "
+            "audio zone ID (int)\n");
+    dprintf(fd, "See audio_policy_configuration.xsd for valid AudioUsage values.\n");
+    return STATUS_OK;
+}
+
+binder_status_t AudioControl::cmdRequestFocus(int fd, const char** args, uint32_t numArgs) {
+    if (!checkCallerHasWritePermissions(fd)) {
+        return STATUS_PERMISSION_DENIED;
+    }
+    if (numArgs != 4) {
+        dprintf(fd,
+                "Invalid number of arguments: please provide --request <USAGE> <ZONE_ID> "
+                "<FOCUS_GAIN>\n");
+        return STATUS_BAD_VALUE;
+    }
+
+    string usage = string(args[1]);
+    if (xsd::stringToAudioUsage(usage) == xsd::AudioUsage::UNKNOWN) {
+        dprintf(fd,
+                "Unknown usage provided: %s. Please see audio_policy_configuration.xsd V7_0 "
+                "for supported values\n",
+                usage.c_str());
+        return STATUS_BAD_VALUE;
+    }
+
+    int zoneId;
+    if (!safelyParseInt(string(args[2]), &zoneId)) {
+        dprintf(fd, "Non-integer zoneId provided with request: %s\n", string(args[2]).c_str());
+        return STATUS_BAD_VALUE;
+    }
+
+    int focusGainValue;
+    if (!safelyParseInt(string(args[3]), &focusGainValue)) {
+        dprintf(fd, "Non-integer focusGain provided with request: %s\n", string(args[3]).c_str());
+        return STATUS_BAD_VALUE;
+    }
+    AudioFocusChange focusGain = AudioFocusChange(focusGainValue);
+
+    if (mFocusListener == nullptr) {
+        dprintf(fd, "Unable to request focus - no focus listener registered\n");
+        return STATUS_BAD_VALUE;
+    }
+
+    mFocusListener->requestAudioFocus(usage, zoneId, focusGain);
+    dprintf(fd, "Requested focus for usage %s, zoneId %d, and focusGain %d\n", usage.c_str(),
+            zoneId, focusGain);
+    return STATUS_OK;
+}
+
+binder_status_t AudioControl::cmdAbandonFocus(int fd, const char** args, uint32_t numArgs) {
+    if (!checkCallerHasWritePermissions(fd)) {
+        return STATUS_PERMISSION_DENIED;
+    }
+    if (numArgs != 3) {
+        dprintf(fd, "Invalid number of arguments: please provide --abandon <USAGE> <ZONE_ID>\n");
+        return STATUS_BAD_VALUE;
+    }
+
+    string usage = string(args[1]);
+    if (xsd::stringToAudioUsage(usage) == xsd::AudioUsage::UNKNOWN) {
+        dprintf(fd,
+                "Unknown usage provided: %s. Please see audio_policy_configuration.xsd V7_0 "
+                "for supported values\n",
+                usage.c_str());
+        return STATUS_BAD_VALUE;
+    }
+
+    int zoneId;
+    if (!safelyParseInt(string(args[2]), &zoneId)) {
+        dprintf(fd, "Non-integer zoneId provided with abandon: %s\n", string(args[2]).c_str());
+        return STATUS_BAD_VALUE;
+    }
+
+    if (mFocusListener == nullptr) {
+        dprintf(fd, "Unable to abandon focus - no focus listener registered\n");
+        return STATUS_BAD_VALUE;
+    }
+
+    mFocusListener->abandonAudioFocus(usage, zoneId);
+    dprintf(fd, "Abandoned focus for usage %s and zoneId %d\n", usage.c_str(), zoneId);
+    return STATUS_OK;
+}
+
+}  // namespace aidl::android::hardware::automotive::audiocontrol
diff --git a/automotive/audiocontrol/aidl/default/AudioControl.h b/automotive/audiocontrol/aidl/default/AudioControl.h
new file mode 100644
index 0000000..a77da3e
--- /dev/null
+++ b/automotive/audiocontrol/aidl/default/AudioControl.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+#ifndef ANDROID_HARDWARE_AUTOMOTIVE_AUDIOCONTROL_AUDIOCONTROL_H
+#define ANDROID_HARDWARE_AUTOMOTIVE_AUDIOCONTROL_AUDIOCONTROL_H
+
+#include <aidl/android/hardware/automotive/audiocontrol/AudioFocusChange.h>
+#include <aidl/android/hardware/automotive/audiocontrol/BnAudioControl.h>
+
+namespace aidl::android::hardware::automotive::audiocontrol {
+
+using ::std::shared_ptr;
+
+class AudioControl : public BnAudioControl {
+  public:
+    ndk::ScopedAStatus onAudioFocusChange(const std::string& in_usage, int32_t in_zoneId,
+                                          AudioFocusChange in_focusChange) override;
+    ndk::ScopedAStatus registerFocusListener(
+            const shared_ptr<IFocusListener>& in_listener) override;
+    ndk::ScopedAStatus setBalanceTowardRight(float in_value) override;
+    ndk::ScopedAStatus setFadeTowardFront(float in_value) override;
+    binder_status_t dump(int fd, const char** args, uint32_t numArgs) override;
+
+  private:
+    // This focus listener will only be used by this HAL instance to communicate with
+    // a single instance of CarAudioService. As such, it doesn't have explicit serialization.
+    // If a different AudioControl implementation were to have multiple threads leveraging this
+    // listener, then it should also include mutexes or make the listener atomic.
+    shared_ptr<IFocusListener> mFocusListener;
+
+    binder_status_t cmdHelp(int fd) const;
+    binder_status_t cmdRequestFocus(int fd, const char** args, uint32_t numArgs);
+    binder_status_t cmdAbandonFocus(int fd, const char** args, uint32_t numArgs);
+    binder_status_t dumpsys(int fd);
+};
+
+}  // namespace aidl::android::hardware::automotive::audiocontrol
+
+#endif  // ANDROID_HARDWARE_AUTOMOTIVE_AUDIOCONTROL_AUDIOCONTROL_H
diff --git a/automotive/audiocontrol/aidl/default/audiocontrol-default.rc b/automotive/audiocontrol/aidl/default/audiocontrol-default.rc
new file mode 100644
index 0000000..88d180d
--- /dev/null
+++ b/automotive/audiocontrol/aidl/default/audiocontrol-default.rc
@@ -0,0 +1,4 @@
+service vendor.audiocontrol-default /vendor/bin/hw/android.hardware.automotive.audiocontrol-service.example
+    class hal
+    user audioserver
+    group system
diff --git a/automotive/audiocontrol/aidl/default/audiocontrol-default.xml b/automotive/audiocontrol/aidl/default/audiocontrol-default.xml
new file mode 100644
index 0000000..f95d05f
--- /dev/null
+++ b/automotive/audiocontrol/aidl/default/audiocontrol-default.xml
@@ -0,0 +1,6 @@
+<manifest version="1.0" type="device">
+    <hal format="aidl">
+        <name>android.hardware.automotive.audiocontrol</name>
+        <fqname>IAudioControl/default</fqname>
+    </hal>
+</manifest>
diff --git a/automotive/audiocontrol/aidl/default/main.cpp b/automotive/audiocontrol/aidl/default/main.cpp
new file mode 100644
index 0000000..996665f
--- /dev/null
+++ b/automotive/audiocontrol/aidl/default/main.cpp
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#include "AudioControl.h"
+
+#include <android-base/logging.h>
+#include <android/binder_manager.h>
+#include <android/binder_process.h>
+
+using aidl::android::hardware::automotive::audiocontrol::AudioControl;
+
+int main() {
+    ABinderProcess_setThreadPoolMaxThreadCount(0);
+    std::shared_ptr<AudioControl> audioControl = ndk::SharedRefBase::make<AudioControl>();
+
+    const std::string instance = std::string() + AudioControl::descriptor + "/default";
+    binder_status_t status =
+            AServiceManager_addService(audioControl->asBinder().get(), instance.c_str());
+    CHECK(status == STATUS_OK);
+
+    ABinderProcess_joinThreadPool();
+    return EXIT_FAILURE;  // should not reach
+}
diff --git a/automotive/audiocontrol/aidl/vts/Android.bp b/automotive/audiocontrol/aidl/vts/Android.bp
new file mode 100644
index 0000000..3d81e00
--- /dev/null
+++ b/automotive/audiocontrol/aidl/vts/Android.bp
@@ -0,0 +1,38 @@
+// Copyright (C) 2020 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.
+
+cc_test {
+    name: "VtsAidlHalAudioControlTest",
+    defaults: [
+        "VtsHalTargetTestDefaults",
+        "use_libaidlvintf_gtest_helper_static",
+    ],
+    generated_headers: ["audio_policy_configuration_V7_0"],
+    generated_sources: ["audio_policy_configuration_V7_0"],
+    header_libs: ["libxsdc-utils"],
+    srcs: ["VtsHalAudioControlTargetTest.cpp"],
+    shared_libs: [
+        "libbinder",
+        "libbase",
+        "libxml2",
+    ],
+    static_libs: [
+        "android.hardware.automotive.audiocontrol-cpp",
+        "libgmock",
+    ],
+    test_suites: [
+        "general-tests",
+        "vts",
+    ],
+}
diff --git a/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp b/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp
new file mode 100644
index 0000000..c734e29
--- /dev/null
+++ b/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp
@@ -0,0 +1,143 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+#define LOG_TAG "VtsAidlHalAudioControlTest"
+
+#include <aidl/Gtest.h>
+#include <aidl/Vintf.h>
+#include <gmock/gmock.h>
+
+#include <android/hardware/automotive/audiocontrol/BnFocusListener.h>
+#include <android/hardware/automotive/audiocontrol/IAudioControl.h>
+#include <android/log.h>
+#include <binder/IServiceManager.h>
+#include <binder/ProcessState.h>
+
+using android::ProcessState;
+using android::sp;
+using android::String16;
+using android::binder::Status;
+using android::hardware::automotive::audiocontrol::AudioFocusChange;
+using android::hardware::automotive::audiocontrol::BnFocusListener;
+using android::hardware::automotive::audiocontrol::IAudioControl;
+
+#include "audio_policy_configuration_V7_0.h"
+
+namespace xsd {
+using namespace audio::policy::configuration::V7_0;
+}
+
+class AudioControlAidl : public testing::TestWithParam<std::string> {
+  public:
+    virtual void SetUp() override {
+        audioControl = android::waitForDeclaredService<IAudioControl>(String16(GetParam().c_str()));
+        ASSERT_NE(audioControl, nullptr);
+    }
+
+    sp<IAudioControl> audioControl;
+    int32_t capabilities;
+};
+
+TEST_P(AudioControlAidl, OnSetFadeTowardsFront) {
+    ALOGI("Fader exercise test (silent)");
+
+    // Set the fader all the way to the back
+    ASSERT_TRUE(audioControl->setFadeTowardFront(-1.0f).isOk());
+
+    // Set the fader all the way to the front
+    ASSERT_TRUE(audioControl->setFadeTowardFront(1.0f).isOk());
+
+    // Set the fader part way toward the back
+    ASSERT_TRUE(audioControl->setFadeTowardFront(-0.333f).isOk());
+
+    // Set the fader to a out of bounds value (driver should clamp)
+    ASSERT_TRUE(audioControl->setFadeTowardFront(99999.9f).isOk());
+
+    // Set the fader to a negative out of bounds value (driver should clamp)
+    ASSERT_TRUE(audioControl->setFadeTowardFront(-99999.9f).isOk());
+
+    // Set the fader back to the middle
+    ASSERT_TRUE(audioControl->setFadeTowardFront(0.0f).isOk());
+}
+
+TEST_P(AudioControlAidl, OnSetBalanceTowardsRight) {
+    ALOGI("Balance exercise test (silent)");
+
+    // Set the balance all the way to the left
+    ASSERT_TRUE(audioControl->setBalanceTowardRight(-1.0f).isOk());
+
+    // Set the balance all the way to the right
+    ASSERT_TRUE(audioControl->setBalanceTowardRight(1.0f).isOk());
+
+    // Set the balance part way toward the left
+    ASSERT_TRUE(audioControl->setBalanceTowardRight(-0.333f).isOk());
+
+    // Set the balance to a out of bounds value (driver should clamp)
+    ASSERT_TRUE(audioControl->setBalanceTowardRight(99999.9f).isOk());
+
+    // Set the balance to a negative out of bounds value (driver should clamp)
+    ASSERT_TRUE(audioControl->setBalanceTowardRight(-99999.9f).isOk());
+
+    // Set the balance back to the middle
+    ASSERT_TRUE(audioControl->setBalanceTowardRight(0.0f).isOk());
+
+    // Set the balance back to the middle
+    audioControl->setBalanceTowardRight(0.0f).isOk();
+}
+
+struct FocusListenerMock : BnFocusListener {
+    MOCK_METHOD(Status, requestAudioFocus,
+                (const String16& usage, int32_t zoneId, AudioFocusChange focusGain));
+    MOCK_METHOD(Status, abandonAudioFocus, (const String16& usage, int32_t zoneId));
+};
+
+/*
+ * Test focus listener registration.
+ *
+ * Verifies that:
+ * - registerFocusListener succeeds;
+ * - registering a second listener succeeds in replacing the first;
+ * - closing handle does not crash;
+ */
+TEST_P(AudioControlAidl, FocusListenerRegistration) {
+    ALOGI("Focus listener test");
+
+    sp<FocusListenerMock> listener = new FocusListenerMock();
+    ASSERT_TRUE(audioControl->registerFocusListener(listener).isOk());
+
+    sp<FocusListenerMock> listener2 = new FocusListenerMock();
+    ASSERT_TRUE(audioControl->registerFocusListener(listener2).isOk());
+};
+
+TEST_P(AudioControlAidl, FocusChangeExercise) {
+    ALOGI("Focus Change test");
+
+    String16 usage = String16(xsd::toString(xsd::AudioUsage::AUDIO_USAGE_MEDIA).c_str());
+    ASSERT_TRUE(
+            audioControl->onAudioFocusChange(usage, 0, AudioFocusChange::GAIN_TRANSIENT).isOk());
+};
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioControlAidl);
+INSTANTIATE_TEST_SUITE_P(
+        Audiocontrol, AudioControlAidl,
+        testing::ValuesIn(android::getAidlHalInstanceNames(IAudioControl::descriptor)),
+        android::PrintInstanceNameToString);
+
+int main(int argc, char** argv) {
+    ::testing::InitGoogleTest(&argc, argv);
+    ProcessState::self()->setThreadPoolMaxThreadCount(1);
+    ProcessState::self()->startThreadPool();
+    return RUN_ALL_TESTS();
+}
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index d1d254b..57f390c 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -35,10 +35,8 @@
             <instance>default</instance>
         </interface>
     </hal>
-    <hal format="hidl" optional="true">
+    <hal format="aidl" optional="true">
         <name>android.hardware.automotive.audiocontrol</name>
-        <version>1.0</version>
-        <version>2.0</version>
         <interface>
             <name>IAudioControl</name>
             <instance>default</instance>
diff --git a/radio/1.6/IRadio.hal b/radio/1.6/IRadio.hal
index 747b2f2..a093dee 100644
--- a/radio/1.6/IRadio.hal
+++ b/radio/1.6/IRadio.hal
@@ -231,9 +231,9 @@
      * 3. Disable NR dual connectivity and force secondary cell to be released
      * {NrDualConnectivityState:DISABLE_IMMEDIATE}
 
-     * Response callback is IRadioResponse.enableNRDualConnectivityResponse()
+     * Response callback is IRadioResponse.setNRDualConnectivityStateResponse()
      */
-    oneway enableNrDualConnectivity(int32_t serial,
+    oneway setNrDualConnectivityState(int32_t serial,
             NrDualConnectivityState nrDualConnectivityState);
 
     /**
diff --git a/radio/1.6/IRadioResponse.hal b/radio/1.6/IRadioResponse.hal
index 523185e..0379e00 100644
--- a/radio/1.6/IRadioResponse.hal
+++ b/radio/1.6/IRadioResponse.hal
@@ -225,7 +225,7 @@
      *   RadioError:RADIO_NOT_AVAILABLE
      *   RadioError:INTERNAL_ERR
      */
-    oneway enableNrDualConnectivityResponse(RadioResponseInfo info);
+    oneway setNrDualConnectivityStateResponse(RadioResponseInfo info);
 
     /**
      * @param info Response info struct containing response type, serial no. and error
diff --git a/radio/1.6/vts/functional/radio_hidl_hal_api.cpp b/radio/1.6/vts/functional/radio_hidl_hal_api.cpp
index 01236c6..6547611 100644
--- a/radio/1.6/vts/functional/radio_hidl_hal_api.cpp
+++ b/radio/1.6/vts/functional/radio_hidl_hal_api.cpp
@@ -260,13 +260,13 @@
 }
 
 /*
- * Test IRadio.enableNrDualConnectivity() for the response returned.
+ * Test IRadio.setNrDualConnectivityState() for the response returned.
  */
-TEST_P(RadioHidlTest_v1_6, enableNrDualConnectivity) {
+TEST_P(RadioHidlTest_v1_6, setNrDualConnectivityState) {
     serial = GetRandomSerialNumber();
 
     Return<void> res =
-            radio_v1_6->enableNrDualConnectivity(serial, NrDualConnectivityState::DISABLE);
+            radio_v1_6->setNrDualConnectivityState(serial, NrDualConnectivityState::DISABLE);
     ASSERT_OK(res);
 
     EXPECT_EQ(std::cv_status::no_timeout, wait());
diff --git a/radio/1.6/vts/functional/radio_hidl_hal_utils_v1_6.h b/radio/1.6/vts/functional/radio_hidl_hal_utils_v1_6.h
index 5682f11..f0550af 100644
--- a/radio/1.6/vts/functional/radio_hidl_hal_utils_v1_6.h
+++ b/radio/1.6/vts/functional/radio_hidl_hal_utils_v1_6.h
@@ -773,7 +773,7 @@
             const ::android::hardware::radio::V1_6::RadioResponseInfo& info,
             const SendSmsResult& sms);
 
-    Return<void> enableNrDualConnectivityResponse(
+    Return<void> setNrDualConnectivityStateResponse(
             const ::android::hardware::radio::V1_6::RadioResponseInfo& info);
     Return<void> isNrDualConnectivityEnabledResponse(
             const ::android::hardware::radio::V1_6::RadioResponseInfo& info, bool isEnabled);
diff --git a/radio/1.6/vts/functional/radio_response.cpp b/radio/1.6/vts/functional/radio_response.cpp
index dc4f57d..18cda6a 100644
--- a/radio/1.6/vts/functional/radio_response.cpp
+++ b/radio/1.6/vts/functional/radio_response.cpp
@@ -1055,7 +1055,7 @@
     parent_v1_6.notify(info.serial);
     return Void();
 }
-Return<void> RadioResponse_v1_6::enableNrDualConnectivityResponse(
+Return<void> RadioResponse_v1_6::setNrDualConnectivityStateResponse(
         const ::android::hardware::radio::V1_6::RadioResponseInfo& info) {
     rspInfo = info;
     parent_v1_6.notify(info.serial);
diff --git a/tv/tuner/1.1/default/Filter.cpp b/tv/tuner/1.1/default/Filter.cpp
index 4c37729..139e98a 100644
--- a/tv/tuner/1.1/default/Filter.cpp
+++ b/tv/tuner/1.1/default/Filter.cpp
@@ -209,6 +209,7 @@
 
     if (mSharedAvMemHandle.getNativeHandle() != nullptr) {
         _hidl_cb(Result::SUCCESS, mSharedAvMemHandle, BUFFER_SIZE_16M);
+        mUsingSharedAvMem = true;
         return Void();
     }
 
@@ -225,6 +226,7 @@
     ::close(av_fd);
 
     _hidl_cb(Result::SUCCESS, mSharedAvMemHandle, BUFFER_SIZE_16M);
+    mUsingSharedAvMem = true;
     return Void();
 }
 
@@ -678,11 +680,10 @@
     recordEvent = {
             .byteNumber = mRecordFilterOutput.size(),
     };
-    V1_1::DemuxFilterRecordEventExt recordEventExt;
+    V1_1::DemuxFilterTsRecordEventExt recordEventExt;
     recordEventExt = {
             .pts = (mPts == 0) ? time(NULL) * 900000 : mPts,
             .firstMbInSlice = 0,     // random address
-            .mpuSequenceNumber = 1,  // random sequence number
     };
 
     int size;
diff --git a/tv/tuner/1.1/default/Filter.h b/tv/tuner/1.1/default/Filter.h
index 522db35..a7b3fd2 100644
--- a/tv/tuner/1.1/default/Filter.h
+++ b/tv/tuner/1.1/default/Filter.h
@@ -227,7 +227,7 @@
 
     // Shared A/V memory handle
     hidl_handle mSharedAvMemHandle;
-    bool mUsingSharedAvMem = true;
+    bool mUsingSharedAvMem = false;
     uint32_t mSharedAvMemOffset = 0;
 
     uint32_t mAudioStreamType;
diff --git a/tv/tuner/1.1/types.hal b/tv/tuner/1.1/types.hal
index 3ff795a..006e597 100644
--- a/tv/tuner/1.1/types.hal
+++ b/tv/tuner/1.1/types.hal
@@ -20,6 +20,7 @@
 import @1.0::DemuxFilterMmtpRecordEvent;
 import @1.0::DemuxFilterTsRecordEvent;
 import @1.0::DemuxScIndex;
+import @1.0::DemuxTsIndex;
 import @1.0::FrontendIsdbs3Rolloff;
 import @1.0::FrontendAtsc3Bandwidth;
 import @1.0::FrontendAtsc3Modulation;
@@ -51,11 +52,11 @@
 @export
 enum Constant : @1.0::Constant {
     /**
-     * An invalid mpuSequenceNumber in DemuxFilterRecordEventExt.
+     * An invalid mpuSequenceNumber.
      */
     INVALID_MMTP_RECORD_EVENT_MPT_SEQUENCE_NUM = 0xFFFFFFFF,
     /**
-     * An invalid first macroblock address in DemuxFilterRecordEventExt.
+     * An invalid first macroblock address.
      */
     INVALID_FIRST_MACROBLOCK_IN_SLICE = 0xFFFFFFFF,
     /**
@@ -103,9 +104,25 @@
 };
 
 /**
- * Extended Demux Filter Record Event.
+ * Extended Demux Filter TS Record Event.
  */
-struct DemuxFilterRecordEventExt {
+struct DemuxFilterTsRecordEventExt {
+    /**
+     * The Presentation Time Stamp(PTS) for the audio or video frame. It is based on 90KHz
+     * and has the same format as the PTS in ISO/IEC 13818-1.
+     */
+    uint64_t pts;
+
+    /**
+     * Specifies the address of the first macroblock in the slice defined in ITU-T Rec. H.264.
+     */
+    uint32_t firstMbInSlice;
+};
+
+/**
+ * Extended Demux Filter MMTP Record Event.
+ */
+struct DemuxFilterMmtpRecordEventExt {
     /**
      * The Presentation Time Stamp(PTS) for the audio or video frame. It is based on 90KHz
      * and has the same format as the PTS in ISO/IEC 13818-1.
@@ -121,6 +138,11 @@
      * Specifies the address of the first macroblock in the slice defined in ITU-T Rec. H.264.
      */
     uint32_t firstMbInSlice;
+
+    /**
+     * TS index mask.
+     */
+    bitfield<@1.1::DemuxTsIndex> tsIndexMask;
 };
 
 /**
@@ -130,13 +152,13 @@
     safe_union Event {
         /**
          * No extended record filter Event. This is used by the tsRecord or mmtpRecord filter event
-         * that does not contain the DemuxFilterRecordEventExt information.
+         * that does not contain the DemuxFilterTs/MmtpRecordEventExt information.
          */
         Monostate noinit;
 
-        DemuxFilterRecordEventExt tsRecord;
+        DemuxFilterTsRecordEventExt tsRecord;
 
-        DemuxFilterRecordEventExt mmtpRecord;
+        DemuxFilterMmtpRecordEventExt mmtpRecord;
 
         ScramblingStatus scramblingStatus;
     };
@@ -828,3 +850,27 @@
      */
     SP_SLICE = 1 << 8,
 };
+
+@export
+enum DemuxTsIndex : @1.0::DemuxTsIndex {
+    /**
+     * Index the address of MMT Packet Table(MPT).
+     */
+    MPT_INDEX_MPT = 1 << 16,
+    /**
+     * Index the address of Video.
+     */
+    MPT_INDEX_VIDEO = 1 << 17,
+    /**
+     * Index the address of Audio.
+     */
+    MPT_INDEX_AUDIO = 1 << 18,
+    /**
+     * Index to indicate this is a target of timestamp extraction for video.
+     */
+    MPT_INDEX_TIMESTAMP_TARGET_VIDEO = 1 << 19,
+    /**
+     * Index to indicate this is a target of timestamp extraction for audio.
+     */
+    MPT_INDEX_TIMESTAMP_TARGET_AUDIO = 1 << 20,
+};
diff --git a/tv/tuner/1.1/vts/functional/FilterTests.cpp b/tv/tuner/1.1/vts/functional/FilterTests.cpp
index f114a66..d2535e5 100644
--- a/tv/tuner/1.1/vts/functional/FilterTests.cpp
+++ b/tv/tuner/1.1/vts/functional/FilterTests.cpp
@@ -64,9 +64,9 @@
                 break;
             case DemuxFilterEventExt::Event::hidl_discriminator::mmtpRecord:
                 ALOGD("[vts] Extended MMTP record filter event, pts=%" PRIu64
-                      ", firstMbInSlice=%d, mpuSequenceNumber=%d",
+                      ", firstMbInSlice=%d, mpuSequenceNumber=%d, tsIndexMask=%d",
                       eventExt.mmtpRecord().pts, eventExt.mmtpRecord().firstMbInSlice,
-                      eventExt.mmtpRecord().mpuSequenceNumber);
+                      eventExt.mmtpRecord().mpuSequenceNumber, eventExt.mmtpRecord().tsIndexMask);
                 break;
             case DemuxFilterEventExt::Event::hidl_discriminator::scramblingStatus:
                 mScramblingStatusEvent++;
diff --git a/wifi/hostapd/1.3/IHostapd.hal b/wifi/hostapd/1.3/IHostapd.hal
index 0309f3b..be6fe59 100644
--- a/wifi/hostapd/1.3/IHostapd.hal
+++ b/wifi/hostapd/1.3/IHostapd.hal
@@ -26,6 +26,53 @@
  * Top-level object for managing SoftAPs.
  */
 interface IHostapd extends @1.2::IHostapd {
+
+    /**
+     * Parameters to control the channel selection for the interface.
+     */
+    struct ChannelParams {
+        /**
+         * Baseline information as defined in HAL 1.2.
+         *
+         * Includes bandMask and acsChannelFreqRangesMhz
+         */
+        @1.2::IHostapd.ChannelParams V1_2;
+
+        /**
+         * Whether to enable ACS (Automatic Channel Selection) or not.
+         * The channel can be selected automatically at run time by setting
+         * this flag, which must enable the ACS survey based algorithm.
+         *
+         * Note: It is used instead of V1_0::ChannelParams.enableAcs inside
+         * V1_3::IfaceParams.V1_2.V1_1.V1_0.
+         */
+        bool enableAcs;
+
+        /**
+         * Channel number (IEEE 802.11) to use for the interface.
+         * If ACS is enabled, this field is ignored.
+         *
+         * Note: It is used instead of V1_0::ChannelParams.channel inside
+         * V1_3::IfaceParams.V1_2.V1_1.V1_0.
+         */
+        uint32_t channel;
+    };
+
+    /**
+     * Parameters to use for setting up the dual access point interfaces.
+     */
+    struct IfaceParams {
+        /**
+         * Baseline information as defined in HAL 1.2.
+         */
+        @1.2::IHostapd.IfaceParams V1_2;
+
+        /**
+         * The list of the channel params for the dual interfaces.
+         */
+        vec<ChannelParams> channelParamsList;
+    };
+
     /**
      * Parameters to use for setting up the access point network.
      */
@@ -57,7 +104,7 @@
      *         |HostapdStatusCode.FAILURE_UNKNOWN|,
      *         |HostapdStatusCode.FAILURE_IFACE_EXISTS|
      */
-    addAccessPoint_1_3(@1.2::IHostapd.IfaceParams ifaceParams, NetworkParams nwParams)
+    addAccessPoint_1_3(IfaceParams ifaceParams, NetworkParams nwParams)
         generates (HostapdStatus status);
 
     /**
diff --git a/wifi/hostapd/1.3/vts/functional/hostapd_hidl_test.cpp b/wifi/hostapd/1.3/vts/functional/hostapd_hidl_test.cpp
index d6c750f..9234a5b 100644
--- a/wifi/hostapd/1.3/vts/functional/hostapd_hidl_test.cpp
+++ b/wifi/hostapd/1.3/vts/functional/hostapd_hidl_test.cpp
@@ -95,7 +95,16 @@
             iface_params;
         ::android::hardware::wifi::hostapd::V1_1::IHostapd::IfaceParams
             iface_params_1_1;
-        IHostapd::IfaceParams iface_params_1_2;
+        ::android::hardware::wifi::hostapd::V1_2::IHostapd::IfaceParams
+            iface_params_1_2;
+        IHostapd::IfaceParams iface_params_1_3;
+
+        std::vector<
+            ::android::hardware::wifi::hostapd::V1_3::IHostapd::ChannelParams>
+            vec_channelParams;
+
+        ::android::hardware::wifi::hostapd::V1_3::IHostapd::ChannelParams
+            channelParams_1_3;
 
         iface_params.ifaceName = getPrimaryWlanIfaceName();
         iface_params.hwModeParams.enable80211N = true;
@@ -111,23 +120,39 @@
         iface_params_1_2.channelParams.bandMask = 0;
         iface_params_1_2.channelParams.bandMask |=
             IHostapd::BandMask::BAND_2_GHZ;
-        return iface_params_1_2;
+
+        // Newly added attributes in V1_3
+        channelParams_1_3.channel = iface_params.channelParams.channel;
+        channelParams_1_3.enableAcs = iface_params.channelParams.enableAcs;
+        channelParams_1_3.V1_2 = iface_params_1_2.channelParams;
+
+        vec_channelParams.push_back(channelParams_1_3);
+        iface_params_1_3.V1_2 = iface_params_1_2;
+        iface_params_1_3.channelParamsList = vec_channelParams;
+        return iface_params_1_3;
     }
 
     IHostapd::IfaceParams getIfaceParamsWithAcs() {
         // First get the settings for WithoutAcs and then make changes
-        IHostapd::IfaceParams iface_params_1_2 = getIfaceParamsWithoutAcs();
-        iface_params_1_2.V1_1.V1_0.channelParams.enableAcs = true;
-        iface_params_1_2.V1_1.V1_0.channelParams.acsShouldExcludeDfs = true;
-        iface_params_1_2.V1_1.V1_0.channelParams.channel = 0;
-        iface_params_1_2.channelParams.bandMask |=
+        IHostapd::IfaceParams iface_params_1_3 = getIfaceParamsWithoutAcs();
+        iface_params_1_3.V1_2.V1_1.V1_0.channelParams.enableAcs = true;
+        iface_params_1_3.V1_2.V1_1.V1_0.channelParams.acsShouldExcludeDfs =
+            true;
+        iface_params_1_3.V1_2.V1_1.V1_0.channelParams.channel = 0;
+        iface_params_1_3.V1_2.channelParams.bandMask |=
             IHostapd::BandMask::BAND_5_GHZ;
+        iface_params_1_3.channelParamsList[0].channel =
+            iface_params_1_3.V1_2.V1_1.V1_0.channelParams.channel;
+        iface_params_1_3.channelParamsList[0].enableAcs =
+            iface_params_1_3.V1_2.V1_1.V1_0.channelParams.enableAcs;
+        iface_params_1_3.channelParamsList[0].V1_2 =
+            iface_params_1_3.V1_2.channelParams;
 
-        return iface_params_1_2;
+        return iface_params_1_3;
     }
 
     IHostapd::IfaceParams getIfaceParamsWithAcsAndFreqRange() {
-        IHostapd::IfaceParams iface_params_1_2 = getIfaceParamsWithAcs();
+        IHostapd::IfaceParams iface_params_1_3 = getIfaceParamsWithAcs();
         ::android::hardware::wifi::hostapd::V1_2::IHostapd::AcsFrequencyRange
             acsFrequencyRange;
         acsFrequencyRange.start = 2412;
@@ -136,17 +161,23 @@
                         AcsFrequencyRange>
             vec_acsFrequencyRange;
         vec_acsFrequencyRange.push_back(acsFrequencyRange);
-        iface_params_1_2.channelParams.acsChannelFreqRangesMhz =
+        iface_params_1_3.V1_2.channelParams.acsChannelFreqRangesMhz =
             vec_acsFrequencyRange;
-        return iface_params_1_2;
+        iface_params_1_3.channelParamsList[0].V1_2 =
+            iface_params_1_3.V1_2.channelParams;
+        return iface_params_1_3;
     }
 
     IHostapd::IfaceParams getIfaceParamsWithAcsAndInvalidFreqRange() {
-        IHostapd::IfaceParams iface_params_1_2 =
+        IHostapd::IfaceParams iface_params_1_3 =
             getIfaceParamsWithAcsAndFreqRange();
-        iface_params_1_2.channelParams.acsChannelFreqRangesMhz[0].start = 222;
-        iface_params_1_2.channelParams.acsChannelFreqRangesMhz[0].end = 999;
-        return iface_params_1_2;
+        iface_params_1_3.V1_2.channelParams.acsChannelFreqRangesMhz[0].start =
+            222;
+        iface_params_1_3.V1_2.channelParams.acsChannelFreqRangesMhz[0].end =
+            999;
+        iface_params_1_3.channelParamsList[0].V1_2 =
+            iface_params_1_3.V1_2.channelParams;
+        return iface_params_1_3;
     }
 
     IHostapd::NetworkParams getOpenNwParams() {
@@ -218,9 +249,12 @@
     }
 
     IHostapd::IfaceParams getIfaceParamsWithInvalidChannel() {
-        IHostapd::IfaceParams iface_params_1_2 = getIfaceParamsWithoutAcs();
-        iface_params_1_2.V1_1.V1_0.channelParams.channel = kIfaceInvalidChannel;
-        return iface_params_1_2;
+        IHostapd::IfaceParams iface_params_1_3 = getIfaceParamsWithoutAcs();
+        iface_params_1_3.V1_2.V1_1.V1_0.channelParams.channel =
+            kIfaceInvalidChannel;
+        iface_params_1_3.channelParamsList[0].channel =
+            iface_params_1_3.V1_2.V1_1.V1_0.channelParams.channel;
+        return iface_params_1_3;
     }
 
     // IHostapd object used for all tests in this fixture.
@@ -422,6 +456,11 @@
     EXPECT_EQ(HostapdStatusCode::FAILURE_CLIENT_UNKNOWN, status_1_2.code);
 }
 
+/**
+ * AddAccessPointWithDualBandConfig should pass
+ */
+// TODO: Add it after VendorHal ready & add feature support check.
+
 GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(HostapdHidlTest);
 INSTANTIATE_TEST_CASE_P(
     PerInstance, HostapdHidlTest,