am fb79b7da: am d347480a: Fix buffer compacting in NativeDaemonConnector
Merge commit 'fb79b7dab3ccaf490e8cbb18c9feed7080e4b54f'
* commit 'fb79b7dab3ccaf490e8cbb18c9feed7080e4b54f':
Fix buffer compacting in NativeDaemonConnector
diff --git a/services/java/com/android/server/NativeDaemonConnector.java b/services/java/com/android/server/NativeDaemonConnector.java
index f3cb9b7..03f8dae 100644
--- a/services/java/com/android/server/NativeDaemonConnector.java
+++ b/services/java/com/android/server/NativeDaemonConnector.java
@@ -132,11 +132,12 @@
Slog.e(TAG, String.format(
"Error handling '%s'", event), ex);
}
- }
- try {
- mResponseQueue.put(event);
- } catch (InterruptedException ex) {
- Slog.e(TAG, "Failed to put response onto queue", ex);
+ } else {
+ try {
+ mResponseQueue.put(event);
+ } catch (InterruptedException ex) {
+ Slog.e(TAG, "Failed to put response onto queue", ex);
+ }
}
} catch (NumberFormatException nfe) {
Slog.w(TAG, String.format("Bad msg (%s)", event));
@@ -216,6 +217,7 @@
*/
public synchronized ArrayList<String> doCommand(String cmd)
throws NativeDaemonConnectorException {
+ mResponseQueue.clear();
sendCommand(cmd);
ArrayList<String> response = new ArrayList<String>();