Camera: Use original client PID for eviction

Use the original client PID to evaluate priorities for eviction. The
original client PID may be different from the calling PID when the
application uses MediaRecorder to open camera.

Bug: 26493273
Change-Id: I8f56194f1ca2151701efb8cb380ff4abf6c8d6c4
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index af8fc74..0c88dad 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -912,7 +912,8 @@
 }
 
 Status CameraService::validateConnectLocked(const String8& cameraId,
-        const String8& clientName8, /*inout*/int& clientUid, /*inout*/int& clientPid) const {
+        const String8& clientName8, /*inout*/int& clientUid, /*inout*/int& clientPid,
+        /*out*/int& originalClientPid) const {
 
     int callingPid = getCallingPid();
     int callingUid = getCallingUid();
@@ -954,6 +955,7 @@
 
     // Only use passed in clientPid to check permission. Use calling PID as the client PID that's
     // connected to camera service directly.
+    originalClientPid = clientPid;
     clientPid = callingPid;
 
     if (!mModule) {