am ac112990: am e6639066: am a2e39c6a: Merge "Filtering Remote-Submix and Back-mic devices from AudioDeviceInfo API." into mnc-dev
* commit 'ac1129905d24fae4f2a5b89e4a91fbac43cde76b': Filtering Remote-Submix and Back-mic devices from AudioDeviceInfo API.
This commit is contained in:
@@ -3757,6 +3757,12 @@ public class AudioManager {
|
|||||||
port.role() == AudioPort.ROLE_SOURCE && (flags & GET_DEVICES_INPUTS) != 0;
|
port.role() == AudioPort.ROLE_SOURCE && (flags & GET_DEVICES_INPUTS) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean checkTypes(AudioDevicePort port) {
|
||||||
|
return AudioDeviceInfo.convertInternalDeviceToDeviceType(port.type()) !=
|
||||||
|
AudioDeviceInfo.TYPE_UNKNOWN &&
|
||||||
|
port.type() != AudioSystem.DEVICE_IN_BACK_MIC;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array of {@link AudioDeviceInfo} objects corresponding to the audio devices
|
* Returns an array of {@link AudioDeviceInfo} objects corresponding to the audio devices
|
||||||
* currently connected to the system and meeting the criteria specified in the
|
* currently connected to the system and meeting the criteria specified in the
|
||||||
@@ -3779,7 +3785,7 @@ public class AudioManager {
|
|||||||
// figure out how many AudioDeviceInfo we need space for...
|
// figure out how many AudioDeviceInfo we need space for...
|
||||||
int numRecs = 0;
|
int numRecs = 0;
|
||||||
for (AudioDevicePort port : ports) {
|
for (AudioDevicePort port : ports) {
|
||||||
if (checkFlags(port, flags)) {
|
if (checkTypes(port) && checkFlags(port, flags)) {
|
||||||
numRecs++;
|
numRecs++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3788,7 +3794,7 @@ public class AudioManager {
|
|||||||
AudioDeviceInfo[] deviceList = new AudioDeviceInfo[numRecs];
|
AudioDeviceInfo[] deviceList = new AudioDeviceInfo[numRecs];
|
||||||
int slot = 0;
|
int slot = 0;
|
||||||
for (AudioDevicePort port : ports) {
|
for (AudioDevicePort port : ports) {
|
||||||
if (checkFlags(port, flags)) {
|
if (checkTypes(port) && checkFlags(port, flags)) {
|
||||||
deviceList[slot++] = new AudioDeviceInfo(port);
|
deviceList[slot++] = new AudioDeviceInfo(port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user