  private:
      class DeathNotifier : public IBinder::DeathRecipient {
      public:
-diff --git a/frameworks/av/include/media/AudioSystem.h b/frameworks/av/include/media/AudioSystem.h
-index 225ef76..72b0328 100644
---- a/frameworks/av/include/media/AudioSystem.h
-+++ b/frameworks/av/include/media/AudioSystem.h
-@@ -27,6 +27,9 @@
- namespace android {
- 
- typedef void (*audio_error_callback)(status_t err);
-+#ifdef STE_AUDIO
-+typedef void (*latency_update_callback)(void *cookie, audio_io_handle_t output, uint32_t sinkLatency);
-+#endif
- 
- class IAudioFlinger;
- class IAudioPolicyService;
-@@ -138,6 +141,11 @@ public:
-     static void acquireAudioSessionId(int audioSession);
-     static void releaseAudioSessionId(int audioSession);
- 
-+#ifdef STE_AUDIO
-+    static int registerLatencyNotificationClient(latency_update_callback cb, void *cookie, audio_io_handle_t output);
-+    static void unregisterLatencyNotificationClient(int clientId);
-+#endif
-+
-     // types of io configuration change events received with ioConfigChanged()
-     enum io_config_event {
-         OUTPUT_OPENED,
-@@ -147,6 +155,9 @@ public:
-         INPUT_CLOSED,
-         INPUT_CONFIG_CHANGED,
-         STREAM_CONFIG_CHANGED,
-+#ifdef STE_AUDIO
-+        SINK_LATENCY_CHANGED,
-+#endif
-         NUM_CONFIG_EVENTS
-     };
- 
-@@ -210,7 +221,13 @@ public:
-                                     uint32_t samplingRate = 0,
-                                     audio_format_t format = AUDIO_FORMAT_DEFAULT,
-                                     audio_channel_mask_t channelMask = AUDIO_CHANNEL_IN_MONO,
-+#ifdef STE_AUDIO
-+                                    audio_in_acoustics_t acoustics = (audio_in_acoustics_t)0,
-+                                    int sessionId = 0,
-+                                    audio_input_clients *inputClientId = NULL);
-+#else
-                                     int sessionId = 0);
-+#endif
-     static status_t startInput(audio_io_handle_t input);
-     static status_t stopInput(audio_io_handle_t input);
-     static void releaseInput(audio_io_handle_t input);
-@@ -285,6 +302,14 @@ private:
-         virtual void binderDied(const wp<IBinder>& who);
-     };
- 
-+#ifdef STE_AUDIO
-+    struct NotificationClient : public RefBase {
-+        latency_update_callback mCb;
-+        void *mCookie;
-+        audio_io_handle_t mOutput;
-+    };
-+#endif
-+
-     static sp<AudioFlingerClient> gAudioFlingerClient;
-     static sp<AudioPolicyServiceClient> gAudioPolicyServiceClient;
-     friend class AudioFlingerClient;
-@@ -307,6 +332,12 @@ private:
-     // list of output descriptors containing cached parameters
-     // (sampling rate, framecount, channel count...)
-     static DefaultKeyedVector<audio_io_handle_t, OutputDescriptor *> gOutputs;
-+
-+#ifdef STE_AUDIO
-+    static Mutex gLatencyLock;
-+    static int gNextUniqueLatencyId;
-+    static DefaultKeyedVector<int, sp<AudioSystem::NotificationClient> > gLatencyNotificationClients;
-+#endif
- };
- 
- };  // namespace android
+
 diff --git a/frameworks/av/include/media/AudioTrack.h b/frameworks/av/include/media/AudioTrack.h
 index f2f9c22..6156a18 100644
 --- a/frameworks/av/include/media/AudioTrack.h

#       modified:   include/media/stagefright/MediaDefs.h
#       modified:   include/media/stagefright/OMXCodec.h
#       modified:   include/private/media/AudioTrackShared.h
#       modified:   media/libmedia/AudioParameter.cpp
#       modified:   media/libmedia/AudioRecord.cpp
#       modified:   media/libmedia/AudioSystem.cpp
#       modified:   media/libmedia/AudioTrack.cpp
#       modified:   media/libmedia/IAudioFlinger.cpp
#       modified:   media/libmedia/IAudioPolicyService.cpp
#       modified:   media/libstagefright/ACodec.cpp
#       modified:   media/libstagefright/CameraSource.cpp

 
 status_t AudioFlinger::closeInput_nonvirtual(audio_io_handle_t input)
 {

diff --git a/frameworks/av/services/audioflinger/AudioPolicyService.cpp b/frameworks/av/services/audioflinger/AudioPolicyService.cpp
index 7f40812..352ba8b 100644
--- a/frameworks/av/services/audioflinger/AudioPolicyService.cpp
