Merge "Added IAudioControl#onDevicesToMuteChange"
diff --git a/OWNERS b/OWNERS
index 433bbb7..3a1a038 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,9 +1,14 @@
 per-file *.hal,*.aidl,OWNERS = set noparent
-per-file *.hal,*.aidl,OWNERS = elsk@google.com,malchev@google.com,smoreland@google.com
+per-file *.hal,*.aidl,OWNERS = devinmoore@google.com,elsk@google.com,malchev@google.com,smoreland@google.com
 
+# Android Native API Council
+devinmoore@google.com
 elsk@google.com
-maco@google.com
 malchev@google.com
 smoreland@google.com
-yim@google.com  # vts tests
-guangzhu@google.com # vts tests
+
+# historical/backup
+maco@google.com
+
+# vts tests
+guangzhu@google.com
diff --git a/compatibility_matrices/Android.bp b/compatibility_matrices/Android.bp
index b2a815f..de73201 100644
--- a/compatibility_matrices/Android.bp
+++ b/compatibility_matrices/Android.bp
@@ -60,5 +60,6 @@
     kernel_configs: [
         "kernel_config_current_4.19",
         "kernel_config_current_5.4",
+        "kernel_config_current_5.10",
     ],
 }
diff --git a/wifi/1.5/IWifiChip.hal b/wifi/1.5/IWifiChip.hal
index e9caa3d..80f2ca4 100644
--- a/wifi/1.5/IWifiChip.hal
+++ b/wifi/1.5/IWifiChip.hal
@@ -17,7 +17,6 @@
 package android.hardware.wifi@1.5;
 
 import @1.0::WifiStatus;
-import @1.0::IfaceType;
 import @1.5::IWifiApIface;
 import @1.0::IWifiIface;
 import @1.3::IWifiChip;
@@ -187,6 +186,12 @@
         NO_POWER_CAP = 0x7FFFFFFF,
     };
 
+    enum CoexRestriction : uint32_t {
+        WIFI_DIRECT = 1 << 0,
+        SOFTAP = 1 << 1,
+        WIFI_AWARE = 1 << 2
+    };
+
     /**
      * Invoked to indicate that the provided |CoexUnsafeChannels| should be avoided with the
      * specified restrictions.
@@ -194,13 +199,14 @@
      * Channel avoidance is a suggestion and should be done on a best-effort approach. If a provided
      * channel is used, then the specified power cap should be applied.
      *
-     * In addition, hard restrictions on the Wifi modes may be indicated by |IfaceType| bits
-     * (STA, AP, P2P, NAN, etc) in the |restrictions| bitfield. If a hard restriction is provided,
-     * then the channels should be completely avoided for the provided Wifi modes instead of by
-     * best-effort.
+     * In addition, hard restrictions on the Wifi modes may be indicated by |CoexRestriction| bits
+     * (WIFI_DIRECT, SOFTAP, WIFI_AWARE) in the |restrictions| bitfield. If a hard restriction is
+     * provided, then the channels should be completely avoided for the provided Wifi modes instead
+     * of by best-effort.
      *
      * @param unsafeChannels List of |CoexUnsafeChannels| to avoid.
-     * @param restrictions Bitset of |IfaceType| values indicating Wifi modes to completely avoid.
+     * @param restrictions Bitset of |CoexRestriction| values indicating Wifi interfaces to
+     *         completely avoid.
      * @return status WifiStatus of the operation.
      *         Possible status codes:
      *         |WifiStatusCode.SUCCESS|,
@@ -208,6 +214,6 @@
      *         |WifiStatusCode.ERROR_INVALID_ARGS|,
      */
     setCoexUnsafeChannels(
-        vec<CoexUnsafeChannel> unsafeChannels, bitfield<IfaceType> restrictions)
+        vec<CoexUnsafeChannel> unsafeChannels, bitfield<CoexRestriction> restrictions)
             generates (WifiStatus status);
 };
diff --git a/wifi/1.5/default/wifi_chip.cpp b/wifi/1.5/default/wifi_chip.cpp
index 95478a4..6dd400c 100644
--- a/wifi/1.5/default/wifi_chip.cpp
+++ b/wifi/1.5/default/wifi_chip.cpp
@@ -724,7 +724,7 @@
 
 Return<void> WifiChip::setCoexUnsafeChannels(
     const hidl_vec<CoexUnsafeChannel>& unsafeChannels,
-    hidl_bitfield<IfaceType> restrictions,
+    hidl_bitfield<CoexRestriction> restrictions,
     setCoexUnsafeChannels_cb hidl_status_cb) {
     return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
                            &WifiChip::setCoexUnsafeChannelsInternal,
@@ -1463,8 +1463,18 @@
             unsafe_channels, &legacy_unsafe_channels)) {
         return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
     }
+    uint32_t legacy_restrictions = 0;
+    if (restrictions & CoexRestriction::WIFI_DIRECT) {
+        legacy_restrictions |= legacy_hal::wifi_coex_restriction::WIFI_DIRECT;
+    }
+    if (restrictions & CoexRestriction::SOFTAP) {
+        legacy_restrictions |= legacy_hal::wifi_coex_restriction::SOFTAP;
+    }
+    if (restrictions & CoexRestriction::WIFI_AWARE) {
+        legacy_restrictions |= legacy_hal::wifi_coex_restriction::WIFI_AWARE;
+    }
     auto legacy_status = legacy_hal_.lock()->setCoexUnsafeChannels(
-        legacy_unsafe_channels, restrictions);
+        legacy_unsafe_channels, legacy_restrictions);
     return createWifiStatusFromLegacyError(legacy_status);
 }
 
diff --git a/wifi/1.5/vts/functional/wifi_chip_hidl_test.cpp b/wifi/1.5/vts/functional/wifi_chip_hidl_test.cpp
index eeaa7e0..a065721 100644
--- a/wifi/1.5/vts/functional/wifi_chip_hidl_test.cpp
+++ b/wifi/1.5/vts/functional/wifi_chip_hidl_test.cpp
@@ -44,6 +44,7 @@
 using ::android::hardware::wifi::V1_0::WifiStatusCode;
 using ::android::hardware::wifi::V1_4::IWifiChipEventCallback;
 using ::android::hardware::wifi::V1_5::IWifiChip;
+using ::android::hardware::wifi::V1_5::WifiBand;
 
 /**
  * Fixture to use for all Wifi chip HIDL interface tests.
@@ -141,6 +142,37 @@
     }
 }
 
+/*
+ * setCoexUnsafeChannels
+ */
+TEST_P(WifiChipHidlTest, setCoexUnsafeChannels) {
+    // Test with empty vector of CoexUnsafeChannels
+    std::vector<IWifiChip::CoexUnsafeChannel> vec;
+    const auto& statusEmpty =
+        HIDL_INVOKE(wifi_chip_, setCoexUnsafeChannels, vec, 0);
+    if (statusEmpty.code != WifiStatusCode::SUCCESS) {
+        EXPECT_EQ(WifiStatusCode::ERROR_NOT_SUPPORTED, statusEmpty.code);
+    }
+
+    // Test with non-empty vector of CoexUnsafeChannels
+    IWifiChip::CoexUnsafeChannel unsafeChannel24Ghz;
+    unsafeChannel24Ghz.band = WifiBand::BAND_24GHZ;
+    unsafeChannel24Ghz.channel = 6;
+    vec.push_back(unsafeChannel24Ghz);
+    IWifiChip::CoexUnsafeChannel unsafeChannel5Ghz;
+    unsafeChannel5Ghz.band = WifiBand::BAND_5GHZ;
+    unsafeChannel5Ghz.channel = 36;
+    vec.push_back(unsafeChannel5Ghz);
+    uint32_t restrictions = IWifiChip::CoexRestriction::WIFI_AWARE |
+                            IWifiChip::CoexRestriction::SOFTAP |
+                            IWifiChip::CoexRestriction::WIFI_DIRECT;
+    const auto& statusNonEmpty =
+        HIDL_INVOKE(wifi_chip_, setCoexUnsafeChannels, vec, restrictions);
+    if (statusNonEmpty.code != WifiStatusCode::SUCCESS) {
+        EXPECT_EQ(WifiStatusCode::ERROR_NOT_SUPPORTED, statusNonEmpty.code);
+    }
+}
+
 GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(WifiChipHidlTest);
 INSTANTIATE_TEST_SUITE_P(
     PerInstance, WifiChipHidlTest,