Add package name when creating AudioTrack.
The package name can be used when starting an external vibration, which
is used by vibrator service to check if the application has the
permission to start vibration.
Bug: 165910728
Bug: 162343845
Test: atest AudioTrackTest MediaPlayerTest
Test: start audio-coupled-haptic playback
Change-Id: I6d12c4e141c037ee94ee79cbb9bf537421ec9507
Merged-In: I6d12c4e141c037ee94ee79cbb9bf537421ec9507
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 5279bb3..766f940 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -2067,7 +2067,8 @@
uid_t uid,
status_t *status,
audio_port_handle_t portId,
- const sp<media::IAudioTrackCallback>& callback)
+ const sp<media::IAudioTrackCallback>& callback,
+ const std::string& opPackageName)
{
size_t frameCount = *pFrameCount;
size_t notificationFrameCount = *pNotificationFrameCount;
@@ -2348,7 +2349,8 @@
track = new Track(this, client, streamType, attr, sampleRate, format,
channelMask, frameCount,
nullptr /* buffer */, (size_t)0 /* bufferSize */, sharedBuffer,
- sessionId, creatorPid, uid, *flags, TrackBase::TYPE_DEFAULT, portId);
+ sessionId, creatorPid, uid, *flags, TrackBase::TYPE_DEFAULT, portId,
+ SIZE_MAX /*frameCountToBeReady*/, opPackageName);
lStatus = track != 0 ? track->initCheck() : (status_t) NO_MEMORY;
if (lStatus != NO_ERROR) {