alsa_sound: avoid pcm_open error

sometimes occur pcm_open error caused by mDevices 0.
so, must not change mDevices to 0.

Bug: 7293209

Change-Id: I3ffaca81dea15145bd8f03e3abedb2840d7c9f2c
diff --git a/alsa_sound/ALSAStreamOps.cpp b/alsa_sound/ALSAStreamOps.cpp
index aafc736..4e534fd 100644
--- a/alsa_sound/ALSAStreamOps.cpp
+++ b/alsa_sound/ALSAStreamOps.cpp
@@ -214,12 +214,16 @@
 
     if (param.getInt(key, device) == NO_ERROR) {
         // Ignore routing if device is 0.
-        ALOGD("setParameters(): keyRouting with device %d", device);
+        ALOGD("setParameters(): keyRouting with device 0x%x", device);
         // reset to speaker when disconnecting HDMI to avoid timeout due to write errors
         if ((device == 0) && (mDevices == AudioSystem::DEVICE_OUT_AUX_DIGITAL)) {
             device = AudioSystem::DEVICE_OUT_SPEAKER;
         }
-        mDevices = device;
+        if (device)
+            mDevices = device;
+        else
+            ALOGV("must not change mDevices to 0");
+
         if(device) {
             mParent->doRouting(device);
         }
diff --git a/alsa_sound/AudioStreamOutALSA.cpp b/alsa_sound/AudioStreamOutALSA.cpp
index 64492ba..d047cd4 100644
--- a/alsa_sound/AudioStreamOutALSA.cpp
+++ b/alsa_sound/AudioStreamOutALSA.cpp
@@ -178,8 +178,6 @@
             mHandle->module->route(mHandle, mDevices , mParent->mode());
 #endif
         } else {
-            if (!mDevices)
-               mDevices = mParent->mCurDevice;
             mHandle->module->route(mHandle, mDevices , mParent->mode());
         }
         if (!strcmp(mHandle->useCase, SND_USE_CASE_VERB_HIFI) ||