diff options
author | Marco Nelissen <marcone@google.com> | 2013-01-14 14:12:05 -0800 |
---|---|---|
committer | Marco Nelissen <marcone@google.com> | 2013-10-25 14:06:03 -0700 |
commit | 9cae217050aa1347d4ac5053c305754879e3f97f (patch) | |
tree | dff82f277cba8f34af39eaeeb00adec01bbda26c /services/audioflinger/AudioFlinger.cpp | |
parent | be567be3f92026f5964c1c9ecce00e30bb7df412 (diff) | |
download | frameworks_av-9cae217050aa1347d4ac5053c305754879e3f97f.zip frameworks_av-9cae217050aa1347d4ac5053c305754879e3f97f.tar.gz frameworks_av-9cae217050aa1347d4ac5053c305754879e3f97f.tar.bz2 |
Assign blame for playback wakelocks.
Set a work source for the playback wakelock, so that playback is
counted against the requesting app instead of the media server.
Cherrypicked from master.
b/9464621
Change-Id: I7329f88a288a95a582a78005a1c3d16a5a611e31
Diffstat (limited to 'services/audioflinger/AudioFlinger.cpp')
-rw-r--r-- | services/audioflinger/AudioFlinger.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp index a9c9b56..6f6c2b6 100644 --- a/services/audioflinger/AudioFlinger.cpp +++ b/services/audioflinger/AudioFlinger.cpp @@ -448,6 +448,7 @@ sp<IAudioTrack> AudioFlinger::createTrack( pid_t tid, int *sessionId, String8& name, + int clientUid, status_t *status) { sp<PlaybackThread::Track> track; @@ -483,6 +484,7 @@ sp<IAudioTrack> AudioFlinger::createTrack( } pid_t pid = IPCThreadState::self()->getCallingPid(); + client = registerPid_l(pid); ALOGV("createTrack() sessionId: %d", (sessionId == NULL) ? -2 : *sessionId); @@ -510,7 +512,7 @@ sp<IAudioTrack> AudioFlinger::createTrack( ALOGV("createTrack() lSessionId: %d", lSessionId); track = thread->createTrack_l(client, streamType, sampleRate, format, - channelMask, frameCount, sharedBuffer, lSessionId, flags, tid, &lStatus); + channelMask, frameCount, sharedBuffer, lSessionId, flags, tid, clientUid, &lStatus); // move effect chain to this output thread if an effect on same session was waiting // for a track to be created @@ -1284,8 +1286,11 @@ sp<IAudioRecord> AudioFlinger::openRecord( } // create new record track. // The record track uses one track in mHardwareMixerThread by convention. + // TODO: the uid should be passed in as a parameter to openRecord recordTrack = thread->createRecordTrack_l(client, sampleRate, format, channelMask, - frameCount, lSessionId, flags, tid, &lStatus); + frameCount, lSessionId, + IPCThreadState::self()->getCallingUid(), + flags, tid, &lStatus); LOG_ALWAYS_FATAL_IF((recordTrack != 0) != (lStatus == NO_ERROR)); } if (lStatus != NO_ERROR) { |