• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2014 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.media;
18 
19 import android.Manifest;
20 import android.annotation.IntDef;
21 import android.annotation.NonNull;
22 import android.annotation.RequiresPermission;
23 import android.annotation.TestApi;
24 import android.util.SparseIntArray;
25 
26 import com.android.internal.annotations.VisibleForTesting;
27 
28 import java.lang.annotation.Retention;
29 import java.lang.annotation.RetentionPolicy;
30 import java.util.List;
31 import java.util.Objects;
32 import java.util.TreeSet;
33 
34 /**
35  * Provides information about an audio device.
36  */
37 public final class AudioDeviceInfo {
38 
39     /**
40      * A device type associated with an unknown or uninitialized device.
41      */
42     public static final int TYPE_UNKNOWN          = 0;
43     /**
44      * A device type describing the attached earphone speaker.
45      */
46     public static final int TYPE_BUILTIN_EARPIECE = 1;
47     /**
48      * A device type describing the speaker system (i.e. a mono speaker or stereo speakers) built
49      * in a device.
50      */
51     public static final int TYPE_BUILTIN_SPEAKER  = 2;
52     /**
53      * A device type describing a headset, which is the combination of a headphones and microphone.
54      */
55     public static final int TYPE_WIRED_HEADSET    = 3;
56     /**
57      * A device type describing a pair of wired headphones.
58      */
59     public static final int TYPE_WIRED_HEADPHONES = 4;
60     /**
61      * A device type describing an analog line-level connection.
62      */
63     public static final int TYPE_LINE_ANALOG      = 5;
64     /**
65      * A device type describing a digital line connection (e.g. SPDIF).
66      */
67     public static final int TYPE_LINE_DIGITAL     = 6;
68     /**
69      * A device type describing a Bluetooth device typically used for telephony.
70      */
71     public static final int TYPE_BLUETOOTH_SCO    = 7;
72     /**
73      * A device type describing a Bluetooth device supporting the A2DP profile.
74      */
75     public static final int TYPE_BLUETOOTH_A2DP   = 8;
76     /**
77      * A device type describing an HDMI connection .
78      */
79     public static final int TYPE_HDMI             = 9;
80     /**
81      * A device type describing the Audio Return Channel of an HDMI connection.
82      */
83     public static final int TYPE_HDMI_ARC         = 10;
84     /**
85      * A device type describing a USB audio device.
86      */
87     public static final int TYPE_USB_DEVICE       = 11;
88     /**
89      * A device type describing a USB audio device in accessory mode.
90      */
91     public static final int TYPE_USB_ACCESSORY    = 12;
92     /**
93      * A device type describing the audio device associated with a dock.
94      * Starting at API 34, this device type only represents digital docks, while docks with an
95      * analog connection are represented with {@link #TYPE_DOCK_ANALOG}.
96      * @see #TYPE_DOCK_ANALOG
97      */
98     public static final int TYPE_DOCK             = 13;
99     /**
100      * A device type associated with the transmission of audio signals over FM.
101      */
102     public static final int TYPE_FM               = 14;
103     /**
104      * A device type describing the microphone(s) built in a device.
105      */
106     public static final int TYPE_BUILTIN_MIC      = 15;
107     /**
108      * A device type for accessing the audio content transmitted over FM.
109      */
110     public static final int TYPE_FM_TUNER         = 16;
111     /**
112      * A device type for accessing the audio content transmitted over the TV tuner system.
113      */
114     public static final int TYPE_TV_TUNER         = 17;
115     /**
116      * A device type describing the transmission of audio signals over the telephony network.
117      */
118     public static final int TYPE_TELEPHONY        = 18;
119     /**
120      * A device type describing the auxiliary line-level connectors.
121      */
122     public static final int TYPE_AUX_LINE         = 19;
123     /**
124      * A device type connected over IP.
125      */
126     public static final int TYPE_IP               = 20;
127     /**
128      * A type-agnostic device used for communication with external audio systems
129      */
130     public static final int TYPE_BUS              = 21;
131     /**
132      * A device type describing a USB audio headset.
133      */
134     public static final int TYPE_USB_HEADSET       = 22;
135     /**
136      * A device type describing a Hearing Aid.
137      */
138     public static final int TYPE_HEARING_AID   = 23;
139     /**
140      * A device type describing the speaker system (i.e. a mono speaker or stereo speakers) built
141      * in a device, that is specifically tuned for outputting sounds like notifications and alarms
142      * (i.e. sounds the user couldn't necessarily anticipate).
143      * <p>Note that this physical audio device may be the same as {@link #TYPE_BUILTIN_SPEAKER}
144      * but is driven differently to safely accommodate the different use case.</p>
145      */
146     public static final int TYPE_BUILTIN_SPEAKER_SAFE = 24;
147     /**
148      * A device type for rerouting audio within the Android framework between mixes and
149      * system applications.
150      * This type is for instance encountered when querying the output device of a track
151      * (with {@link AudioTrack#getRoutedDevice()} playing from a device in screen mirroring mode,
152      * where the audio is not heard on the device, but on the remote device.
153      */
154     // Typically created when using
155     // {@link android.media.audiopolicy.AudioPolicy} for mixes created with the
156     // {@link android.media.audiopolicy.AudioMix#ROUTE_FLAG_LOOP_BACK} flag.
157     public static final int TYPE_REMOTE_SUBMIX = 25;
158 
159     /**
160      * A device type describing a Bluetooth Low Energy (BLE) audio headset or headphones.
161      * Headphones are grouped with headsets when the device is a sink:
162      * the features of headsets and headphones with regard to playback are the same.
163      */
164     public static final int TYPE_BLE_HEADSET   = 26;
165 
166     /**
167      * A device type describing a Bluetooth Low Energy (BLE) audio speaker.
168      */
169     public static final int TYPE_BLE_SPEAKER   = 27;
170 
171     /**
172      * A device type describing an Echo Canceller loopback Reference.
173      * This device is only used when capturing with MediaRecorder.AudioSource.ECHO_REFERENCE,
174      * which requires privileged permission
175      * {@link android.Manifest.permission#CAPTURE_AUDIO_OUTPUT}.
176      * @hide */
177     @RequiresPermission(Manifest.permission.CAPTURE_AUDIO_OUTPUT)
178     public static final int TYPE_ECHO_REFERENCE   = 28;
179 
180     /**
181      * A device type describing the Enhanced Audio Return Channel of an HDMI connection.
182      */
183     public static final int TYPE_HDMI_EARC         = 29;
184 
185     /**
186      * A device type describing a Bluetooth Low Energy (BLE) broadcast group.
187      */
188     public static final int TYPE_BLE_BROADCAST   = 30;
189 
190     /**
191      * A device type describing the audio device associated with a dock using an analog connection.
192      */
193     public static final int TYPE_DOCK_ANALOG = 31;
194 
195     /** @hide */
196     @IntDef(flag = false, prefix = "TYPE", value = {
197             TYPE_BUILTIN_EARPIECE,
198             TYPE_BUILTIN_SPEAKER,
199             TYPE_WIRED_HEADSET,
200             TYPE_WIRED_HEADPHONES,
201             TYPE_BLUETOOTH_SCO,
202             TYPE_BLUETOOTH_A2DP,
203             TYPE_HDMI,
204             TYPE_DOCK,
205             TYPE_USB_ACCESSORY,
206             TYPE_USB_DEVICE,
207             TYPE_USB_HEADSET,
208             TYPE_TELEPHONY,
209             TYPE_LINE_ANALOG,
210             TYPE_HDMI_ARC,
211             TYPE_HDMI_EARC,
212             TYPE_LINE_DIGITAL,
213             TYPE_FM,
214             TYPE_AUX_LINE,
215             TYPE_IP,
216             TYPE_BUS,
217             TYPE_HEARING_AID,
218             TYPE_BUILTIN_MIC,
219             TYPE_FM_TUNER,
220             TYPE_TV_TUNER,
221             TYPE_BUILTIN_SPEAKER_SAFE,
222             TYPE_REMOTE_SUBMIX,
223             TYPE_BLE_HEADSET,
224             TYPE_BLE_SPEAKER,
225             TYPE_ECHO_REFERENCE,
226             TYPE_BLE_BROADCAST,
227             TYPE_DOCK_ANALOG}
228     )
229     @Retention(RetentionPolicy.SOURCE)
230     public @interface AudioDeviceType {}
231 
232     /** @hide */
233     @IntDef(flag = false, prefix = "TYPE", value = {
234             TYPE_BUILTIN_MIC,
235             TYPE_BLUETOOTH_SCO,
236             TYPE_BLUETOOTH_A2DP,
237             TYPE_WIRED_HEADSET,
238             TYPE_HDMI,
239             TYPE_TELEPHONY,
240             TYPE_DOCK,
241             TYPE_USB_ACCESSORY,
242             TYPE_USB_DEVICE,
243             TYPE_USB_HEADSET,
244             TYPE_FM_TUNER,
245             TYPE_TV_TUNER,
246             TYPE_LINE_ANALOG,
247             TYPE_LINE_DIGITAL,
248             TYPE_IP,
249             TYPE_BUS,
250             TYPE_REMOTE_SUBMIX,
251             TYPE_BLE_HEADSET,
252             TYPE_HDMI_ARC,
253             TYPE_HDMI_EARC,
254             TYPE_ECHO_REFERENCE,
255             TYPE_DOCK_ANALOG}
256     )
257     @Retention(RetentionPolicy.SOURCE)
258     public @interface AudioDeviceTypeIn {}
259 
260     /** @hide */
261     @IntDef(flag = false, prefix = "TYPE", value = {
262             TYPE_BUILTIN_EARPIECE,
263             TYPE_BUILTIN_SPEAKER,
264             TYPE_WIRED_HEADSET,
265             TYPE_WIRED_HEADPHONES,
266             TYPE_BLUETOOTH_SCO,
267             TYPE_BLUETOOTH_A2DP,
268             TYPE_HDMI,
269             TYPE_DOCK,
270             TYPE_USB_ACCESSORY,
271             TYPE_USB_DEVICE,
272             TYPE_USB_HEADSET,
273             TYPE_TELEPHONY,
274             TYPE_LINE_ANALOG,
275             TYPE_HDMI_ARC,
276             TYPE_HDMI_EARC,
277             TYPE_LINE_DIGITAL,
278             TYPE_FM,
279             TYPE_AUX_LINE,
280             TYPE_IP,
281             TYPE_BUS,
282             TYPE_HEARING_AID,
283             TYPE_BUILTIN_SPEAKER_SAFE,
284             TYPE_BLE_HEADSET,
285             TYPE_BLE_SPEAKER,
286             TYPE_BLE_BROADCAST,
287             TYPE_DOCK_ANALOG}
288     )
289     @Retention(RetentionPolicy.SOURCE)
290     public @interface AudioDeviceTypeOut {}
291 
292     /** @hide */
isValidAudioDeviceTypeOut(int type)293     /*package*/ static boolean isValidAudioDeviceTypeOut(int type) {
294         switch (type) {
295             case TYPE_BUILTIN_EARPIECE:
296             case TYPE_BUILTIN_SPEAKER:
297             case TYPE_WIRED_HEADSET:
298             case TYPE_WIRED_HEADPHONES:
299             case TYPE_BLUETOOTH_SCO:
300             case TYPE_BLUETOOTH_A2DP:
301             case TYPE_HDMI:
302             case TYPE_DOCK:
303             case TYPE_USB_ACCESSORY:
304             case TYPE_USB_DEVICE:
305             case TYPE_USB_HEADSET:
306             case TYPE_TELEPHONY:
307             case TYPE_LINE_ANALOG:
308             case TYPE_HDMI_ARC:
309             case TYPE_HDMI_EARC:
310             case TYPE_LINE_DIGITAL:
311             case TYPE_FM:
312             case TYPE_AUX_LINE:
313             case TYPE_IP:
314             case TYPE_BUS:
315             case TYPE_HEARING_AID:
316             case TYPE_BUILTIN_SPEAKER_SAFE:
317             case TYPE_BLE_HEADSET:
318             case TYPE_BLE_SPEAKER:
319             case TYPE_BLE_BROADCAST:
320             case TYPE_DOCK_ANALOG:
321                 return true;
322             default:
323                 return false;
324         }
325     }
326 
327     /** @hide */
isValidAudioDeviceTypeIn(int type)328     /*package*/ static boolean isValidAudioDeviceTypeIn(int type) {
329         switch (type) {
330             case TYPE_BUILTIN_MIC:
331             case TYPE_BLUETOOTH_SCO:
332             case TYPE_BLUETOOTH_A2DP:
333             case TYPE_WIRED_HEADSET:
334             case TYPE_HDMI:
335             case TYPE_TELEPHONY:
336             case TYPE_DOCK:
337             case TYPE_USB_ACCESSORY:
338             case TYPE_USB_DEVICE:
339             case TYPE_USB_HEADSET:
340             case TYPE_FM_TUNER:
341             case TYPE_TV_TUNER:
342             case TYPE_LINE_ANALOG:
343             case TYPE_LINE_DIGITAL:
344             case TYPE_IP:
345             case TYPE_BUS:
346             case TYPE_REMOTE_SUBMIX:
347             case TYPE_BLE_HEADSET:
348             case TYPE_HDMI_ARC:
349             case TYPE_HDMI_EARC:
350             case TYPE_ECHO_REFERENCE:
351             case TYPE_DOCK_ANALOG:
352                 return true;
353             default:
354                 return false;
355         }
356     }
357 
358     /**
359      * @hide
360      * Enforces whether the audio device type is acceptable for output.
361      *
362      * A vendor implemented output type should modify isValidAudioDeviceTypeOut()
363      * appropriately to accept the new type.  Do not remove already acceptable types.
364      *
365      * @throws IllegalArgumentException on an invalid output device type.
366      * @param type
367      */
368     @TestApi
enforceValidAudioDeviceTypeOut(int type)369     public static void enforceValidAudioDeviceTypeOut(int type) {
370         if (!isValidAudioDeviceTypeOut(type)) {
371             throw new IllegalArgumentException("Illegal output device type " + type);
372         }
373     }
374 
375     /**
376      * @hide
377      * Enforces whether the audio device type is acceptable for input.
378      *
379      * A vendor implemented input type should modify isValidAudioDeviceTypeIn()
380      * appropriately to accept the new type.  Do not remove already acceptable types.
381      *
382      * @throws IllegalArgumentException on an invalid input device type.
383      * @param type
384      */
385     @TestApi
enforceValidAudioDeviceTypeIn(int type)386     public static void enforceValidAudioDeviceTypeIn(int type) {
387         if (!isValidAudioDeviceTypeIn(type)) {
388             throw new IllegalArgumentException("Illegal input device type " + type);
389         }
390     }
391 
392     @Override
equals(Object o)393     public boolean equals(Object o) {
394         if (this == o) return true;
395         if (o == null || getClass() != o.getClass()) return false;
396         AudioDeviceInfo that = (AudioDeviceInfo) o;
397         return Objects.equals(getPort(), that.getPort());
398     }
399 
400     @Override
hashCode()401     public int hashCode() {
402         return Objects.hash(getPort());
403     }
404 
405     private final AudioDevicePort mPort;
406 
407     /** @hide */
408     @VisibleForTesting
AudioDeviceInfo(AudioDevicePort port)409     public AudioDeviceInfo(AudioDevicePort port) {
410        mPort = port;
411     }
412 
413     /**
414      * @hide
415      * @return The underlying {@link AudioDevicePort} instance.
416      */
getPort()417     public AudioDevicePort getPort() {
418         return mPort;
419     }
420 
421     /**
422      * @hide
423      * @return the internal device type
424      */
getInternalType()425     public int getInternalType() {
426         return mPort.type();
427     }
428 
429     /**
430      * @return The internal device ID.
431      */
getId()432     public int getId() {
433         return mPort.handle().id();
434     }
435 
436     /**
437      * @return The human-readable name of the audio device.
438      */
getProductName()439     public CharSequence getProductName() {
440         String portName = mPort.name();
441         return (portName != null && portName.length() != 0) ? portName : android.os.Build.MODEL;
442     }
443 
444     /**
445      * @return The "address" string of the device. This generally contains device-specific
446      * parameters.
447      */
getAddress()448     public @NonNull String getAddress() {
449         return mPort.address();
450     }
451 
452    /**
453      * @return true if the audio device is a source for audio data (e.e an input).
454      */
isSource()455     public boolean isSource() {
456         return mPort.role() == AudioPort.ROLE_SOURCE;
457     }
458 
459     /**
460      * @return true if the audio device is a sink for audio data (i.e. an output).
461      */
isSink()462     public boolean isSink() {
463         return mPort.role() == AudioPort.ROLE_SINK;
464     }
465 
466     /**
467      * @return An array of sample rates supported by the audio device.
468      *
469      * Note: an empty array indicates that the device supports arbitrary rates.
470      */
getSampleRates()471     public @NonNull int[] getSampleRates() {
472         return mPort.samplingRates();
473     }
474 
475     /**
476      * @return An array of channel position masks (e.g. {@link AudioFormat#CHANNEL_IN_STEREO},
477      * {@link AudioFormat#CHANNEL_OUT_7POINT1}) for which this audio device can be configured.
478      *
479      * @see AudioFormat
480      *
481      * Note: an empty array indicates that the device supports arbitrary channel masks.
482      */
getChannelMasks()483     public @NonNull int[] getChannelMasks() {
484         return mPort.channelMasks();
485     }
486 
487     /**
488      * @return An array of channel index masks for which this audio device can be configured.
489      *
490      * @see AudioFormat
491      *
492      * Note: an empty array indicates that the device supports arbitrary channel index masks.
493      */
getChannelIndexMasks()494     public @NonNull int[] getChannelIndexMasks() {
495         return mPort.channelIndexMasks();
496     }
497 
498     /**
499      * @return An array of channel counts (1, 2, 4, ...) for which this audio device
500      * can be configured.
501      *
502      * Note: an empty array indicates that the device supports arbitrary channel counts.
503      */
getChannelCounts()504     public @NonNull int[] getChannelCounts() {
505         TreeSet<Integer> countSet = new TreeSet<Integer>();
506 
507         // Channel Masks
508         for (int mask : getChannelMasks()) {
509             countSet.add(isSink() ?
510                     AudioFormat.channelCountFromOutChannelMask(mask)
511                     : AudioFormat.channelCountFromInChannelMask(mask));
512         }
513 
514         // Index Masks
515         for (int index_mask : getChannelIndexMasks()) {
516             countSet.add(Integer.bitCount(index_mask));
517         }
518 
519         int[] counts = new int[countSet.size()];
520         int index = 0;
521         for (int count : countSet) {
522             counts[index++] = count;
523         }
524         return counts;
525     }
526 
527     /**
528      * @return An array of audio encodings (e.g. {@link AudioFormat#ENCODING_PCM_16BIT},
529      * {@link AudioFormat#ENCODING_PCM_FLOAT}) supported by the audio device.
530      * <code>ENCODING_PCM_FLOAT</code> indicates the device supports more
531      * than 16 bits of integer precision.  As there is no AudioFormat constant
532      * specifically defined for 24-bit PCM, the value <code>ENCODING_PCM_FLOAT</code>
533      * indicates that {@link AudioTrack} or {@link AudioRecord} can preserve at least 24 bits of
534      * integer precision to that device.
535      *
536      * @see AudioFormat
537      *
538      * Note: an empty array indicates that the device supports arbitrary encodings.
539      * For forward compatibility, applications should ignore entries it does not recognize.
540      */
getEncodings()541     public @NonNull int[] getEncodings() {
542         return AudioFormat.filterPublicFormats(mPort.formats());
543     }
544 
545     /**
546      * @return A list of {@link AudioProfile} supported by the audio devices.
547      */
getAudioProfiles()548     public @NonNull List<AudioProfile> getAudioProfiles() {
549         return mPort.profiles();
550     }
551 
552     /**
553      * @return A list of {@link AudioDescriptor} supported by the audio devices.
554      */
getAudioDescriptors()555     public @NonNull List<AudioDescriptor> getAudioDescriptors() {
556         return mPort.audioDescriptors();
557     }
558 
559     /**
560      * Returns an array of supported encapsulation modes for the device.
561      *
562      * The array can include any of the {@code AudioTrack} encapsulation modes,
563      * e.g. {@link AudioTrack#ENCAPSULATION_MODE_ELEMENTARY_STREAM}.
564      *
565      * @return An array of supported encapsulation modes for the device.  This
566      *     may be an empty array if no encapsulation modes are supported.
567      */
getEncapsulationModes()568     public @NonNull @AudioTrack.EncapsulationMode int[] getEncapsulationModes() {
569         return mPort.encapsulationModes();
570     }
571 
572     /**
573      * Returns an array of supported encapsulation metadata types for the device.
574      *
575      * The metadata type returned should be allowed for all encapsulation modes supported
576      * by the device.  Some metadata types may apply only to certain
577      * compressed stream formats, the returned list is the union of subsets.
578      *
579      * The array can include any of
580      * {@link AudioTrack#ENCAPSULATION_METADATA_TYPE_FRAMEWORK_TUNER},
581      * {@link AudioTrack#ENCAPSULATION_METADATA_TYPE_DVB_AD_DESCRIPTOR}.
582      *
583      * @return An array of supported encapsulation metadata types for the device.  This
584      *     may be an empty array if no metadata types are supported.
585      */
getEncapsulationMetadataTypes()586     public @NonNull @AudioTrack.EncapsulationMetadataType int[] getEncapsulationMetadataTypes() {
587         return mPort.encapsulationMetadataTypes();
588     }
589 
590    /**
591      * @return The device type identifier of the audio device (i.e. TYPE_BUILTIN_SPEAKER).
592      */
getType()593     public @AudioDeviceType int getType() {
594         return INT_TO_EXT_DEVICE_MAPPING.get(mPort.type(), TYPE_UNKNOWN);
595     }
596 
597     /** @hide */
convertDeviceTypeToInternalDevice(int deviceType)598     public static int convertDeviceTypeToInternalDevice(int deviceType) {
599         return EXT_TO_INT_DEVICE_MAPPING.get(deviceType, AudioSystem.DEVICE_NONE);
600     }
601 
602     /** @hide */
convertInternalDeviceToDeviceType(int intDevice)603     public static int convertInternalDeviceToDeviceType(int intDevice) {
604         return INT_TO_EXT_DEVICE_MAPPING.get(intDevice, TYPE_UNKNOWN);
605     }
606 
607     /** @hide */
convertDeviceTypeToInternalInputDevice(int deviceType)608     public static int convertDeviceTypeToInternalInputDevice(int deviceType) {
609         return convertDeviceTypeToInternalInputDevice(deviceType, "");
610     }
611     /** @hide */
convertDeviceTypeToInternalInputDevice(int deviceType, String address)612     public static int convertDeviceTypeToInternalInputDevice(int deviceType, String address) {
613         int internalType = EXT_TO_INT_INPUT_DEVICE_MAPPING.get(deviceType, AudioSystem.DEVICE_NONE);
614         if (internalType == AudioSystem.DEVICE_IN_BUILTIN_MIC
615                 && "back".equals(address)) {
616             internalType = AudioSystem.DEVICE_IN_BACK_MIC;
617         }
618         return internalType;
619     }
620 
621     private static final SparseIntArray INT_TO_EXT_DEVICE_MAPPING;
622 
623     private static final SparseIntArray EXT_TO_INT_DEVICE_MAPPING;
624 
625     /**
626      * EXT_TO_INT_INPUT_DEVICE_MAPPING aims at mapping external device type to internal input device
627      * type.
628      */
629     private static final SparseIntArray EXT_TO_INT_INPUT_DEVICE_MAPPING;
630 
631     static {
632         INT_TO_EXT_DEVICE_MAPPING = new SparseIntArray();
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_EARPIECE, TYPE_BUILTIN_EARPIECE)633         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_EARPIECE, TYPE_BUILTIN_EARPIECE);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_SPEAKER, TYPE_BUILTIN_SPEAKER)634         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_SPEAKER, TYPE_BUILTIN_SPEAKER);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_WIRED_HEADSET, TYPE_WIRED_HEADSET)635         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_WIRED_HEADSET, TYPE_WIRED_HEADSET);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_WIRED_HEADPHONE, TYPE_WIRED_HEADPHONES)636         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_WIRED_HEADPHONE, TYPE_WIRED_HEADPHONES);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_BLUETOOTH_SCO, TYPE_BLUETOOTH_SCO)637         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_BLUETOOTH_SCO, TYPE_BLUETOOTH_SCO);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_BLUETOOTH_SCO_HEADSET, TYPE_BLUETOOTH_SCO)638         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_BLUETOOTH_SCO_HEADSET, TYPE_BLUETOOTH_SCO);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_BLUETOOTH_SCO_CARKIT, TYPE_BLUETOOTH_SCO)639         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_BLUETOOTH_SCO_CARKIT, TYPE_BLUETOOTH_SCO);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, TYPE_BLUETOOTH_A2DP)640         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, TYPE_BLUETOOTH_A2DP);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES, TYPE_BLUETOOTH_A2DP)641         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES, TYPE_BLUETOOTH_A2DP);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER, TYPE_BLUETOOTH_A2DP)642         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER, TYPE_BLUETOOTH_A2DP);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_HDMI, TYPE_HDMI)643         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_HDMI, TYPE_HDMI);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_ANLG_DOCK_HEADSET, TYPE_DOCK_ANALOG)644         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_ANLG_DOCK_HEADSET, TYPE_DOCK_ANALOG);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_DGTL_DOCK_HEADSET, TYPE_DOCK)645         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_DGTL_DOCK_HEADSET, TYPE_DOCK);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_USB_ACCESSORY, TYPE_USB_ACCESSORY)646         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_USB_ACCESSORY, TYPE_USB_ACCESSORY);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_USB_DEVICE, TYPE_USB_DEVICE)647         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_USB_DEVICE, TYPE_USB_DEVICE);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_USB_HEADSET, TYPE_USB_HEADSET)648         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_USB_HEADSET, TYPE_USB_HEADSET);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_TELEPHONY_TX, TYPE_TELEPHONY)649         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_TELEPHONY_TX, TYPE_TELEPHONY);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_LINE, TYPE_LINE_ANALOG)650         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_LINE, TYPE_LINE_ANALOG);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_HDMI_ARC, TYPE_HDMI_ARC)651         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_HDMI_ARC, TYPE_HDMI_ARC);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_HDMI_EARC, TYPE_HDMI_EARC)652         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_HDMI_EARC, TYPE_HDMI_EARC);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_SPDIF, TYPE_LINE_DIGITAL)653         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_SPDIF, TYPE_LINE_DIGITAL);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_FM, TYPE_FM)654         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_FM, TYPE_FM);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_AUX_LINE, TYPE_AUX_LINE)655         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_AUX_LINE, TYPE_AUX_LINE);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_IP, TYPE_IP)656         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_IP, TYPE_IP);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_BUS, TYPE_BUS)657         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_BUS, TYPE_BUS);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_HEARING_AID, TYPE_HEARING_AID)658         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_HEARING_AID, TYPE_HEARING_AID);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_SPEAKER_SAFE, TYPE_BUILTIN_SPEAKER_SAFE)659         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_SPEAKER_SAFE,
660                 TYPE_BUILTIN_SPEAKER_SAFE);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_REMOTE_SUBMIX, TYPE_REMOTE_SUBMIX)661         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_REMOTE_SUBMIX, TYPE_REMOTE_SUBMIX);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_BLE_HEADSET, TYPE_BLE_HEADSET)662         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_BLE_HEADSET, TYPE_BLE_HEADSET);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_BLE_SPEAKER, TYPE_BLE_SPEAKER)663         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_BLE_SPEAKER, TYPE_BLE_SPEAKER);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_BLE_BROADCAST, TYPE_BLE_BROADCAST)664         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_OUT_BLE_BROADCAST, TYPE_BLE_BROADCAST);
665 
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_BUILTIN_MIC, TYPE_BUILTIN_MIC)666         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_BUILTIN_MIC, TYPE_BUILTIN_MIC);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_BLUETOOTH_SCO_HEADSET, TYPE_BLUETOOTH_SCO)667         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_BLUETOOTH_SCO_HEADSET, TYPE_BLUETOOTH_SCO);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_WIRED_HEADSET, TYPE_WIRED_HEADSET)668         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_WIRED_HEADSET, TYPE_WIRED_HEADSET);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_HDMI, TYPE_HDMI)669         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_HDMI, TYPE_HDMI);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_TELEPHONY_RX, TYPE_TELEPHONY)670         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_TELEPHONY_RX, TYPE_TELEPHONY);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_BACK_MIC, TYPE_BUILTIN_MIC)671         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_BACK_MIC, TYPE_BUILTIN_MIC);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_ANLG_DOCK_HEADSET, TYPE_DOCK_ANALOG)672         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_ANLG_DOCK_HEADSET, TYPE_DOCK_ANALOG);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_DGTL_DOCK_HEADSET, TYPE_DOCK)673         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_DGTL_DOCK_HEADSET, TYPE_DOCK);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_USB_ACCESSORY, TYPE_USB_ACCESSORY)674         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_USB_ACCESSORY, TYPE_USB_ACCESSORY);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_USB_DEVICE, TYPE_USB_DEVICE)675         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_USB_DEVICE, TYPE_USB_DEVICE);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_USB_HEADSET, TYPE_USB_HEADSET)676         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_USB_HEADSET, TYPE_USB_HEADSET);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_FM_TUNER, TYPE_FM_TUNER)677         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_FM_TUNER, TYPE_FM_TUNER);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_TV_TUNER, TYPE_TV_TUNER)678         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_TV_TUNER, TYPE_TV_TUNER);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_LINE, TYPE_LINE_ANALOG)679         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_LINE, TYPE_LINE_ANALOG);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_SPDIF, TYPE_LINE_DIGITAL)680         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_SPDIF, TYPE_LINE_DIGITAL);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_BLUETOOTH_A2DP, TYPE_BLUETOOTH_A2DP)681         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_BLUETOOTH_A2DP, TYPE_BLUETOOTH_A2DP);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_IP, TYPE_IP)682         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_IP, TYPE_IP);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_BUS, TYPE_BUS)683         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_BUS, TYPE_BUS);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_REMOTE_SUBMIX, TYPE_REMOTE_SUBMIX)684         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_REMOTE_SUBMIX, TYPE_REMOTE_SUBMIX);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_BLE_HEADSET, TYPE_BLE_HEADSET)685         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_BLE_HEADSET, TYPE_BLE_HEADSET);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_HDMI_ARC, TYPE_HDMI_ARC)686         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_HDMI_ARC, TYPE_HDMI_ARC);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_HDMI_EARC, TYPE_HDMI_EARC)687         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_HDMI_EARC, TYPE_HDMI_EARC);
INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_ECHO_REFERENCE, TYPE_ECHO_REFERENCE)688         INT_TO_EXT_DEVICE_MAPPING.put(AudioSystem.DEVICE_IN_ECHO_REFERENCE, TYPE_ECHO_REFERENCE);
689 
690 
691         // privileges mapping to output device
692         EXT_TO_INT_DEVICE_MAPPING = new SparseIntArray();
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_BUILTIN_EARPIECE, AudioSystem.DEVICE_OUT_EARPIECE)693         EXT_TO_INT_DEVICE_MAPPING.put(TYPE_BUILTIN_EARPIECE, AudioSystem.DEVICE_OUT_EARPIECE);
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_BUILTIN_SPEAKER, AudioSystem.DEVICE_OUT_SPEAKER)694         EXT_TO_INT_DEVICE_MAPPING.put(TYPE_BUILTIN_SPEAKER, AudioSystem.DEVICE_OUT_SPEAKER);
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_WIRED_HEADSET, AudioSystem.DEVICE_OUT_WIRED_HEADSET)695         EXT_TO_INT_DEVICE_MAPPING.put(TYPE_WIRED_HEADSET, AudioSystem.DEVICE_OUT_WIRED_HEADSET);
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_WIRED_HEADPHONES, AudioSystem.DEVICE_OUT_WIRED_HEADPHONE)696         EXT_TO_INT_DEVICE_MAPPING.put(TYPE_WIRED_HEADPHONES, AudioSystem.DEVICE_OUT_WIRED_HEADPHONE);
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_LINE_ANALOG, AudioSystem.DEVICE_OUT_LINE)697         EXT_TO_INT_DEVICE_MAPPING.put(TYPE_LINE_ANALOG, AudioSystem.DEVICE_OUT_LINE);
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_LINE_DIGITAL, AudioSystem.DEVICE_OUT_SPDIF)698         EXT_TO_INT_DEVICE_MAPPING.put(TYPE_LINE_DIGITAL, AudioSystem.DEVICE_OUT_SPDIF);
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_BLUETOOTH_SCO, AudioSystem.DEVICE_OUT_BLUETOOTH_SCO)699         EXT_TO_INT_DEVICE_MAPPING.put(TYPE_BLUETOOTH_SCO, AudioSystem.DEVICE_OUT_BLUETOOTH_SCO);
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_BLUETOOTH_A2DP, AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP)700         EXT_TO_INT_DEVICE_MAPPING.put(TYPE_BLUETOOTH_A2DP, AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP);
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_HDMI, AudioSystem.DEVICE_OUT_HDMI)701         EXT_TO_INT_DEVICE_MAPPING.put(TYPE_HDMI, AudioSystem.DEVICE_OUT_HDMI);
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_HDMI_ARC, AudioSystem.DEVICE_OUT_HDMI_ARC)702         EXT_TO_INT_DEVICE_MAPPING.put(TYPE_HDMI_ARC, AudioSystem.DEVICE_OUT_HDMI_ARC);
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_HDMI_EARC, AudioSystem.DEVICE_OUT_HDMI_EARC)703         EXT_TO_INT_DEVICE_MAPPING.put(TYPE_HDMI_EARC, AudioSystem.DEVICE_OUT_HDMI_EARC);
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_USB_DEVICE, AudioSystem.DEVICE_OUT_USB_DEVICE)704         EXT_TO_INT_DEVICE_MAPPING.put(TYPE_USB_DEVICE, AudioSystem.DEVICE_OUT_USB_DEVICE);
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_USB_HEADSET, AudioSystem.DEVICE_OUT_USB_HEADSET)705         EXT_TO_INT_DEVICE_MAPPING.put(TYPE_USB_HEADSET, AudioSystem.DEVICE_OUT_USB_HEADSET);
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_USB_ACCESSORY, AudioSystem.DEVICE_OUT_USB_ACCESSORY)706         EXT_TO_INT_DEVICE_MAPPING.put(TYPE_USB_ACCESSORY, AudioSystem.DEVICE_OUT_USB_ACCESSORY);
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_DOCK, AudioSystem.DEVICE_OUT_DGTL_DOCK_HEADSET)707         EXT_TO_INT_DEVICE_MAPPING.put(TYPE_DOCK, AudioSystem.DEVICE_OUT_DGTL_DOCK_HEADSET);
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_DOCK_ANALOG, AudioSystem.DEVICE_OUT_ANLG_DOCK_HEADSET)708         EXT_TO_INT_DEVICE_MAPPING.put(TYPE_DOCK_ANALOG, AudioSystem.DEVICE_OUT_ANLG_DOCK_HEADSET);
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_FM, AudioSystem.DEVICE_OUT_FM)709         EXT_TO_INT_DEVICE_MAPPING.put(TYPE_FM, AudioSystem.DEVICE_OUT_FM);
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_TELEPHONY, AudioSystem.DEVICE_OUT_TELEPHONY_TX)710         EXT_TO_INT_DEVICE_MAPPING.put(TYPE_TELEPHONY, AudioSystem.DEVICE_OUT_TELEPHONY_TX);
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_AUX_LINE, AudioSystem.DEVICE_OUT_AUX_LINE)711         EXT_TO_INT_DEVICE_MAPPING.put(TYPE_AUX_LINE, AudioSystem.DEVICE_OUT_AUX_LINE);
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_IP, AudioSystem.DEVICE_OUT_IP)712         EXT_TO_INT_DEVICE_MAPPING.put(TYPE_IP, AudioSystem.DEVICE_OUT_IP);
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_BUS, AudioSystem.DEVICE_OUT_BUS)713         EXT_TO_INT_DEVICE_MAPPING.put(TYPE_BUS, AudioSystem.DEVICE_OUT_BUS);
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_HEARING_AID, AudioSystem.DEVICE_OUT_HEARING_AID)714         EXT_TO_INT_DEVICE_MAPPING.put(TYPE_HEARING_AID, AudioSystem.DEVICE_OUT_HEARING_AID);
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_BUILTIN_SPEAKER_SAFE, AudioSystem.DEVICE_OUT_SPEAKER_SAFE)715         EXT_TO_INT_DEVICE_MAPPING.put(TYPE_BUILTIN_SPEAKER_SAFE,
716                 AudioSystem.DEVICE_OUT_SPEAKER_SAFE);
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_REMOTE_SUBMIX, AudioSystem.DEVICE_OUT_REMOTE_SUBMIX)717         EXT_TO_INT_DEVICE_MAPPING.put(TYPE_REMOTE_SUBMIX, AudioSystem.DEVICE_OUT_REMOTE_SUBMIX);
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_BLE_HEADSET, AudioSystem.DEVICE_OUT_BLE_HEADSET)718         EXT_TO_INT_DEVICE_MAPPING.put(TYPE_BLE_HEADSET, AudioSystem.DEVICE_OUT_BLE_HEADSET);
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_BLE_SPEAKER, AudioSystem.DEVICE_OUT_BLE_SPEAKER)719         EXT_TO_INT_DEVICE_MAPPING.put(TYPE_BLE_SPEAKER, AudioSystem.DEVICE_OUT_BLE_SPEAKER);
EXT_TO_INT_DEVICE_MAPPING.put(TYPE_BLE_BROADCAST, AudioSystem.DEVICE_OUT_BLE_BROADCAST)720         EXT_TO_INT_DEVICE_MAPPING.put(TYPE_BLE_BROADCAST, AudioSystem.DEVICE_OUT_BLE_BROADCAST);
721 
722         // privileges mapping to input device
723         EXT_TO_INT_INPUT_DEVICE_MAPPING = new SparseIntArray();
EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_BUILTIN_MIC, AudioSystem.DEVICE_IN_BUILTIN_MIC)724         EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_BUILTIN_MIC, AudioSystem.DEVICE_IN_BUILTIN_MIC);
EXT_TO_INT_INPUT_DEVICE_MAPPING.put( TYPE_BLUETOOTH_SCO, AudioSystem.DEVICE_IN_BLUETOOTH_SCO_HEADSET)725         EXT_TO_INT_INPUT_DEVICE_MAPPING.put(
726                 TYPE_BLUETOOTH_SCO, AudioSystem.DEVICE_IN_BLUETOOTH_SCO_HEADSET);
EXT_TO_INT_INPUT_DEVICE_MAPPING.put( TYPE_WIRED_HEADSET, AudioSystem.DEVICE_IN_WIRED_HEADSET)727         EXT_TO_INT_INPUT_DEVICE_MAPPING.put(
728                 TYPE_WIRED_HEADSET, AudioSystem.DEVICE_IN_WIRED_HEADSET);
EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_HDMI, AudioSystem.DEVICE_IN_HDMI)729         EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_HDMI, AudioSystem.DEVICE_IN_HDMI);
EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_TELEPHONY, AudioSystem.DEVICE_IN_TELEPHONY_RX)730         EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_TELEPHONY, AudioSystem.DEVICE_IN_TELEPHONY_RX);
EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_DOCK, AudioSystem.DEVICE_IN_DGTL_DOCK_HEADSET)731         EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_DOCK, AudioSystem.DEVICE_IN_DGTL_DOCK_HEADSET);
EXT_TO_INT_INPUT_DEVICE_MAPPING.put( TYPE_DOCK_ANALOG, AudioSystem.DEVICE_IN_ANLG_DOCK_HEADSET)732         EXT_TO_INT_INPUT_DEVICE_MAPPING.put(
733                 TYPE_DOCK_ANALOG, AudioSystem.DEVICE_IN_ANLG_DOCK_HEADSET);
EXT_TO_INT_INPUT_DEVICE_MAPPING.put( TYPE_USB_ACCESSORY, AudioSystem.DEVICE_IN_USB_ACCESSORY)734         EXT_TO_INT_INPUT_DEVICE_MAPPING.put(
735                 TYPE_USB_ACCESSORY, AudioSystem.DEVICE_IN_USB_ACCESSORY);
EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_USB_DEVICE, AudioSystem.DEVICE_IN_USB_DEVICE)736         EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_USB_DEVICE, AudioSystem.DEVICE_IN_USB_DEVICE);
EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_USB_HEADSET, AudioSystem.DEVICE_IN_USB_HEADSET)737         EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_USB_HEADSET, AudioSystem.DEVICE_IN_USB_HEADSET);
EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_FM_TUNER, AudioSystem.DEVICE_IN_FM_TUNER)738         EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_FM_TUNER, AudioSystem.DEVICE_IN_FM_TUNER);
EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_TV_TUNER, AudioSystem.DEVICE_IN_TV_TUNER)739         EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_TV_TUNER, AudioSystem.DEVICE_IN_TV_TUNER);
EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_LINE_ANALOG, AudioSystem.DEVICE_IN_LINE)740         EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_LINE_ANALOG, AudioSystem.DEVICE_IN_LINE);
EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_LINE_DIGITAL, AudioSystem.DEVICE_IN_SPDIF)741         EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_LINE_DIGITAL, AudioSystem.DEVICE_IN_SPDIF);
EXT_TO_INT_INPUT_DEVICE_MAPPING.put( TYPE_BLUETOOTH_A2DP, AudioSystem.DEVICE_IN_BLUETOOTH_A2DP)742         EXT_TO_INT_INPUT_DEVICE_MAPPING.put(
743                 TYPE_BLUETOOTH_A2DP, AudioSystem.DEVICE_IN_BLUETOOTH_A2DP);
EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_IP, AudioSystem.DEVICE_IN_IP)744         EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_IP, AudioSystem.DEVICE_IN_IP);
EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_BUS, AudioSystem.DEVICE_IN_BUS)745         EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_BUS, AudioSystem.DEVICE_IN_BUS);
EXT_TO_INT_INPUT_DEVICE_MAPPING.put( TYPE_REMOTE_SUBMIX, AudioSystem.DEVICE_IN_REMOTE_SUBMIX)746         EXT_TO_INT_INPUT_DEVICE_MAPPING.put(
747                 TYPE_REMOTE_SUBMIX, AudioSystem.DEVICE_IN_REMOTE_SUBMIX);
EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_BLE_HEADSET, AudioSystem.DEVICE_IN_BLE_HEADSET)748         EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_BLE_HEADSET, AudioSystem.DEVICE_IN_BLE_HEADSET);
EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_HDMI_ARC, AudioSystem.DEVICE_IN_HDMI_ARC)749         EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_HDMI_ARC, AudioSystem.DEVICE_IN_HDMI_ARC);
EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_HDMI_EARC, AudioSystem.DEVICE_IN_HDMI_EARC)750         EXT_TO_INT_INPUT_DEVICE_MAPPING.put(TYPE_HDMI_EARC, AudioSystem.DEVICE_IN_HDMI_EARC);
EXT_TO_INT_INPUT_DEVICE_MAPPING.put( TYPE_ECHO_REFERENCE, AudioSystem.DEVICE_IN_ECHO_REFERENCE)751         EXT_TO_INT_INPUT_DEVICE_MAPPING.put(
752                 TYPE_ECHO_REFERENCE, AudioSystem.DEVICE_IN_ECHO_REFERENCE);
753 
754     }
755 }
756 
757