Add pid override feature to MediaResourceManager

Current MediaResourceManager assume that the calling process actually use the resource.
In TV Input Framework, the actually user of the resource is different application.
To allow MediaResourceManager to use pid of actual user, we add overridePid method

bug: 139809797
Test: Manual
Change-Id: Ia113ca2387dfbcc092eb150d19b4751448e9f27a
diff --git a/services/mediaresourcemanager/ResourceManagerService.h b/services/mediaresourcemanager/ResourceManagerService.h
index ae12d7b..f500c62 100644
--- a/services/mediaresourcemanager/ResourceManagerService.h
+++ b/services/mediaresourcemanager/ResourceManagerService.h
@@ -118,6 +118,10 @@
             const std::vector<MediaResourceParcel>& resources,
             bool* _aidl_return) override;
 
+    Status overridePid(
+            int originalPid,
+            int newPid) override;
+
     Status removeResource(int pid, int64_t clientId, bool checkValid);
 
 private:
@@ -157,6 +161,9 @@
     // Merge r2 into r1
     void mergeResources(MediaResourceParcel& r1, const MediaResourceParcel& r2);
 
+    // Get priority from process's pid
+    bool getPriority_l(int pid, int* priority);
+
     mutable Mutex mLock;
     sp<ProcessInfoInterface> mProcessInfo;
     sp<SystemCallbackInterface> mSystemCB;
@@ -166,6 +173,7 @@
     bool mSupportsSecureWithNonSecureCodec;
     int32_t mCpuBoostCount;
     ::ndk::ScopedAIBinder_DeathRecipient mDeathRecipient;
+    std::map<int, int> mOverridePidMap;
 };
 
 // ----------------------------------------------------------------------------