Clean up error handling in createTrack and openRecord

Outside callers now use initCheck() to determine whether a TrackBase
has been created successfully, instead of relying on internal knowledge.

Previously, callers needed to know that a TrackBase was only valid if it's
getCbk() != 0.  For a Track (playback), they needed to know to also check
the track's name (track index).  Now, outsiders can just call initCheck().

Other changes:
 - Return a 0 reference if track creation fails
 - Remove a dead line of code in AudioFlinger::openRecord

Change-Id: If374924a3f6fd27906f625aa83dd0a1e3f506e00
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp
index 6ea6f2f..6039078 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -361,6 +361,15 @@
     ALOGV("PlaybackThread::Track destructor");
 }
 
+status_t AudioFlinger::PlaybackThread::Track::initCheck() const
+{
+    status_t status = TrackBase::initCheck();
+    if (status == NO_ERROR && mName < 0) {
+        status = NO_MEMORY;
+    }
+    return status;
+}
+
 void AudioFlinger::PlaybackThread::Track::destroy()
 {
     // NOTE: destroyTrack_l() can remove a strong reference to this Track