Loading media/java/android/media/AudioDevicePort.java +21 −0 Original line number Diff line number Diff line Loading @@ -210,6 +210,27 @@ public class AudioDevicePort extends AudioPort { return super.equals(o); } /** * Returns true if the AudioDevicePort passed as argument represents the same device (same * type and same address). This is different from equals() in that the port IDs are not compared * which allows matching devices across native audio server restarts. * @param other the other audio device port to compare to. * @return true if both device port correspond to the same audio device, false otherwise. * @hide */ public boolean isSameAs(AudioDevicePort other) { if (mType != other.type()) { return false; } if (mAddress == null && other.address() != null) { return false; } if (!mAddress.equals(other.address())) { return false; } return true; } @Override public String toString() { String type = (mRole == ROLE_SOURCE ? Loading media/java/android/media/AudioManager.java +5 −8 Original line number Diff line number Diff line Loading @@ -8068,15 +8068,15 @@ public class AudioManager { ArrayList<AudioDevicePort> ports_A, ArrayList<AudioDevicePort> ports_B, int flags) { ArrayList<AudioDevicePort> delta_ports = new ArrayList<AudioDevicePort>(); AudioDevicePort cur_port = null; for (int cur_index = 0; cur_index < ports_B.size(); cur_index++) { boolean cur_port_found = false; cur_port = ports_B.get(cur_index); AudioDevicePort cur_port = ports_B.get(cur_index); for (int prev_index = 0; prev_index < ports_A.size() && !cur_port_found; prev_index++) { cur_port_found = (cur_port.id() == ports_A.get(prev_index).id()); // Do not compare devices by port ID as these change when the native // audio server restarts cur_port_found = cur_port.isSameAs(ports_A.get(prev_index)); } if (!cur_port_found) { Loading Loading @@ -8422,12 +8422,9 @@ public class AudioManager { * Callback method called when the mediaserver dies */ public void onServiceDied() { synchronized (mDeviceCallbacks) { broadcastDeviceListChange_sync(null); // Nothing to do here } } } /** * @hide Loading media/java/android/media/AudioPortEventHandler.java +9 −11 Original line number Diff line number Diff line Loading @@ -97,7 +97,6 @@ class AudioPortEventHandler { ArrayList<AudioPort> ports = new ArrayList<AudioPort>(); ArrayList<AudioPatch> patches = new ArrayList<AudioPatch>(); if (msg.what != AUDIOPORT_EVENT_SERVICE_DIED) { int status = AudioManager.updateAudioPortCache(ports, patches, null); if (status != AudioManager.SUCCESS) { // Since audio ports and audio patches are not null, the return Loading @@ -108,7 +107,6 @@ class AudioPortEventHandler { RESCHEDULE_MESSAGE_DELAY_MS); return; } } switch (msg.what) { case AUDIOPORT_EVENT_NEW_LISTENER: Loading Loading
media/java/android/media/AudioDevicePort.java +21 −0 Original line number Diff line number Diff line Loading @@ -210,6 +210,27 @@ public class AudioDevicePort extends AudioPort { return super.equals(o); } /** * Returns true if the AudioDevicePort passed as argument represents the same device (same * type and same address). This is different from equals() in that the port IDs are not compared * which allows matching devices across native audio server restarts. * @param other the other audio device port to compare to. * @return true if both device port correspond to the same audio device, false otherwise. * @hide */ public boolean isSameAs(AudioDevicePort other) { if (mType != other.type()) { return false; } if (mAddress == null && other.address() != null) { return false; } if (!mAddress.equals(other.address())) { return false; } return true; } @Override public String toString() { String type = (mRole == ROLE_SOURCE ? Loading
media/java/android/media/AudioManager.java +5 −8 Original line number Diff line number Diff line Loading @@ -8068,15 +8068,15 @@ public class AudioManager { ArrayList<AudioDevicePort> ports_A, ArrayList<AudioDevicePort> ports_B, int flags) { ArrayList<AudioDevicePort> delta_ports = new ArrayList<AudioDevicePort>(); AudioDevicePort cur_port = null; for (int cur_index = 0; cur_index < ports_B.size(); cur_index++) { boolean cur_port_found = false; cur_port = ports_B.get(cur_index); AudioDevicePort cur_port = ports_B.get(cur_index); for (int prev_index = 0; prev_index < ports_A.size() && !cur_port_found; prev_index++) { cur_port_found = (cur_port.id() == ports_A.get(prev_index).id()); // Do not compare devices by port ID as these change when the native // audio server restarts cur_port_found = cur_port.isSameAs(ports_A.get(prev_index)); } if (!cur_port_found) { Loading Loading @@ -8422,12 +8422,9 @@ public class AudioManager { * Callback method called when the mediaserver dies */ public void onServiceDied() { synchronized (mDeviceCallbacks) { broadcastDeviceListChange_sync(null); // Nothing to do here } } } /** * @hide Loading
media/java/android/media/AudioPortEventHandler.java +9 −11 Original line number Diff line number Diff line Loading @@ -97,7 +97,6 @@ class AudioPortEventHandler { ArrayList<AudioPort> ports = new ArrayList<AudioPort>(); ArrayList<AudioPatch> patches = new ArrayList<AudioPatch>(); if (msg.what != AUDIOPORT_EVENT_SERVICE_DIED) { int status = AudioManager.updateAudioPortCache(ports, patches, null); if (status != AudioManager.SUCCESS) { // Since audio ports and audio patches are not null, the return Loading @@ -108,7 +107,6 @@ class AudioPortEventHandler { RESCHEDULE_MESSAGE_DELAY_MS); return; } } switch (msg.what) { case AUDIOPORT_EVENT_NEW_LISTENER: Loading