Merge "Refactor the SADeviceState to AdiDeviceState" into udc-dev-plus-aosp
diff --git a/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java b/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
index 618f7ed..44943b6 100644
--- a/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
+++ b/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
@@ -701,6 +701,7 @@
                  Settings.Secure.ASSIST_SCREENSHOT_ENABLED,
                  Settings.Secure.ASSIST_STRUCTURE_ENABLED,
                  Settings.Secure.ATTENTIVE_TIMEOUT,
+                 Settings.Secure.AUDIO_DEVICE_INVENTORY, // setting not controllable by user
                  Settings.Secure.AUTOFILL_FEATURE_FIELD_CLASSIFICATION,
                  Settings.Secure.AUTOFILL_USER_DATA_MAX_CATEGORY_COUNT,
                  Settings.Secure.AUTOFILL_USER_DATA_MAX_FIELD_CLASSIFICATION_IDS_SIZE,
diff --git a/services/core/java/com/android/server/audio/AudioDeviceInventory.java b/services/core/java/com/android/server/audio/AudioDeviceInventory.java
index b4ab14f..387646c 100644
--- a/services/core/java/com/android/server/audio/AudioDeviceInventory.java
+++ b/services/core/java/com/android/server/audio/AudioDeviceInventory.java
@@ -90,8 +90,10 @@
     private static final String mMetricsId = "audio.device.";
 
     private final Object mDeviceInventoryLock = new Object();
-    @GuardedBy("mDeviceCatalogLock")
+    @GuardedBy("mDeviceInventoryLock")
     private final ArrayList<AdiDeviceState> mDeviceInventory = new ArrayList<>(0);
+
+
     List<AdiDeviceState> getImmutableDeviceInventory() {
         synchronized (mDeviceInventoryLock) {
             return List.copyOf(mDeviceInventory);
@@ -107,6 +109,7 @@
     AdiDeviceState findDeviceStateForAudioDeviceAttributes(AudioDeviceAttributes ada,
             int canonicalDeviceType) {
         final boolean isWireless = isBluetoothDevice(ada.getInternalType());
+
         synchronized (mDeviceInventoryLock) {
             for (AdiDeviceState deviceSetting : mDeviceInventory) {
                 if (deviceSetting.getDeviceType() == canonicalDeviceType