From 949a926cadbc961fbb649c91d76d7aee8ea4d7bd Mon Sep 17 00:00:00 2001 From: Glenn Kasten Date: Tue, 16 Apr 2013 12:35:20 -0700 Subject: Use correct pid when running under test harness This is a partial fix which addresses one of the root causes of this bug, but only when running under test harness. It has no effect otherwise. Bug: 8598539 Change-Id: I87444daef1d76b17544f331e651ba1c87893c381 --- services/audioflinger/ServiceUtilities.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'services/audioflinger/ServiceUtilities.cpp') diff --git a/services/audioflinger/ServiceUtilities.cpp b/services/audioflinger/ServiceUtilities.cpp index 6a58852..d15bd04 100644 --- a/services/audioflinger/ServiceUtilities.cpp +++ b/services/audioflinger/ServiceUtilities.cpp @@ -21,8 +21,9 @@ namespace android { -// This optimization assumes mediaserver process doesn't fork, which it doesn't -const pid_t getpid_cached = getpid(); +// Not valid until initialized by AudioFlinger constructor. It would have to be +// re-initialized if the process containing AudioFlinger service forks (which it doesn't). +pid_t getpid_cached; bool recordingAllowed() { if (getpid_cached == IPCThreadState::self()->getCallingPid()) return true; -- cgit v1.1