This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to use two input devices at the same time in Android 4.1.1?

Android version: 4.1.1

Steps to reproduce the issue:

  1. execute VoIP apk and make voip call from Device1 to Device2,
  2. during live call launch SoundRecorder.apk and give record,
  3. Show internal application error and SoundRecorder.apk does not work.

error message:

startInput() input failed: other input already started.

I know this issue has been resolved in Android 4.4, but I want to knot how to fix this issue in Android 4.1.1.

Thanks~

  • Hi Emily,

    did you checked those changes for the AudioPolicyManagerBase

    https://android.googlesource.com/platform/hardware/libhardware_legacy/+/android-4.4_r0.7%5E2%5E!/

    Regards,

    Boyko

  • Hi, Boyko

    Thanks your reply.

    I tried to merge the AudioPolicyManagerBase and my test steps as follows:

    1. execute VoIP apk and make voip call from Device1 to Device2,
    2. during live call launch SoundRecorder.apk and give record,

    In my test steps, the activeDesc->mInputSource != AUDIO_SOURCE_HOTWORD, the activeDesc->mInputSource == AUDIO_SOURCE_VOICE_COMMUNICATION, so I still get "startInput() input xx failed: other input already started" message, where do I need to set "InputSource = AUDIO_SOURCE_HOTWORD"?

    +        // refuse 2 active AudioRecord clients at the same time except if the active input
    +        // uses AUDIO_SOURCE_HOTWORD in which case it is closed.
    +        audio_io_handle_t activeInput = getActiveInput();
    +        if (!isVirtualInputDevice(inputDesc->mDevice) && activeInput != 0) {
    +            AudioInputDescriptor *activeDesc = mInputs.valueFor(activeInput);
    +            if (activeDesc->mInputSource == AUDIO_SOURCE_HOTWORD) {
    +                ALOGW("startInput() preempting already started low-priority input %d", activeInput);
    +                stopInput(activeInput);
    +                releaseInput(activeInput);
    +            } else {
    +                ALOGW("startInput() input %d failed: other input already started..", input);
    +                return INVALID_OPERATION;
    +            }


    Regards,
    Emily