Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a26a7623 authored by jiabin's avatar jiabin
Browse files

Change log level when microphone enumeration APIs native call fail.

For microphone enumeration APIs, it could fail due to hal v2,
which is WAI. We shouldn't log as error. Using warning instead.

Bug: 64038649
Test: build
Change-Id: I1a64b8537e27e712a09f122d4763e0e5a345b08f
parent cd7a174c
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -4816,7 +4816,10 @@ public class AudioManager {
        filterTypes.add(AudioDeviceInfo.TYPE_TELEPHONY);
        if (status != AudioManager.SUCCESS) {
            // fail and populate microphones with unknown characteristics by device information.
            if (status != AudioManager.ERROR_INVALID_OPERATION) {
                Log.e(TAG, "getMicrophones failed:" + status);
            }
            Log.i(TAG, "fallback on device info");
            addMicrophonesFromAudioDeviceInfo(microphones, filterTypes);
            return microphones;
        }
+4 −1
Original line number Diff line number Diff line
@@ -1627,8 +1627,11 @@ public class AudioRecord implements AudioRouting
        ArrayList<MicrophoneInfo> activeMicrophones = new ArrayList<>();
        int status = native_get_active_microphones(activeMicrophones);
        if (status != AudioManager.SUCCESS) {
            if (status != AudioManager.ERROR_INVALID_OPERATION) {
                Log.e(TAG, "getActiveMicrophones failed:" + status);
            }
            Log.i(TAG, "getActiveMicrophones failed, fallback on routed device info");
        }
        AudioManager.setPortIdForMicrophones(activeMicrophones);

        // Use routed device when there is not information returned by hal.
+4 −1
Original line number Diff line number Diff line
@@ -1433,8 +1433,11 @@ public class MediaRecorder implements AudioRouting
        ArrayList<MicrophoneInfo> activeMicrophones = new ArrayList<>();
        int status = native_getActiveMicrophones(activeMicrophones);
        if (status != AudioManager.SUCCESS) {
            if (status != AudioManager.ERROR_INVALID_OPERATION) {
                Log.e(TAG, "getActiveMicrophones failed:" + status);
            }
            Log.i(TAG, "getActiveMicrophones failed, fallback on routed device info");
        }
        AudioManager.setPortIdForMicrophones(activeMicrophones);

        // Use routed device when there is not information returned by hal.