Do not open the input device when opening the input stream but
only when the input stream starts. This avoids blocking the thread
executing openInputStream() on the pcm input driver mutex while this mutex
is constantly acquired and released by the high priority audio
input thread.
It also allows an app to open an input stream while another thread is recording
if it does not use it immediately (useful for voice search and VoIP).
Also did some clean up in output and input stream standby logic.
Change-Id: I69c82f5833f7a034d828001f87e02745d7683b65