Fix stopping process for fast tracks

Previously, the state of a fast track "wiggled" back and forth at the end.

Now it goes through these transitions:
  active -> stopping_1 -> stopping_2 -> stopped

This CL is only for fast tracks, and does not change how
normal tracks work.

Change-Id: Icc414f2b48c46dda63cfa6373ca22d033dd21cd4
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index f10295f..bcf29e9 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -365,6 +365,9 @@
                 // These are order-sensitive; do not change order without reviewing the impact.
                 // In particular there are assumptions about > STOPPED.
                 STOPPED,
+                // next 2 states are currently used for fast tracks only
+                STOPPING_1,     // waiting for first underrun
+                STOPPING_2,     // waiting for presentation complete
                 RESUMING,
                 ACTIVE,
                 PAUSING,
@@ -417,6 +420,17 @@
                 return mState == STOPPED;
             }
 
+            // for fast tracks only
+            bool isStopping() const {
+                return mState == STOPPING_1 || mState == STOPPING_2;
+            }
+            bool isStopping_1() const {
+                return mState == STOPPING_1;
+            }
+            bool isStopping_2() const {
+                return mState == STOPPING_2;
+            }
+
             bool isTerminated() const {
                 return mState == TERMINATED;
             }