Merge change 23271 into eclair

* changes:
  Cleanup egregious style issues.
diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp
index 77a126c..3a419b5 100644
--- a/libs/audioflinger/AudioFlinger.cpp
+++ b/libs/audioflinger/AudioFlinger.cpp
@@ -136,8 +136,17 @@
 
 AudioFlinger::~AudioFlinger()
 {
-    mRecordThreads.clear();
-    mPlaybackThreads.clear();
+    while (!mRecordThreads.isEmpty()) {
+        // closeInput() will remove first entry from mRecordThreads
+        closeInput(mRecordThreads.keyAt(0));
+    }
+    while (!mPlaybackThreads.isEmpty()) {
+        // closeOutput() will remove first entry from mPlaybackThreads
+        closeOutput(mPlaybackThreads.keyAt(0));
+    }
+    if (mAudioHardware) {
+        delete mAudioHardware;
+    }
 }
 
 
diff --git a/libs/ui/EventHub.cpp b/libs/ui/EventHub.cpp
index df713cb..60c177b 100644
--- a/libs/ui/EventHub.cpp
+++ b/libs/ui/EventHub.cpp
@@ -784,6 +784,7 @@
             int count = mFDCount - i - 1;
             int index = (device->id&ID_MASK);
             mDevicesById[index].device = NULL;
+            close(mFDs[i].fd);
             memmove(mDevices + i, mDevices + i + 1, sizeof(mDevices[0]) * count);
             memmove(mFDs + i, mFDs + i + 1, sizeof(mFDs[0]) * count);