Hide IBase static maps.

Because sizeof(IBase) can't be changed, we have a couple of maps to
store data about IBase. Hiding these maps internally inside libhidl* so
that we can more easily remove them in the future if necessary.

Fixes: 122472540
Test: hidl_test, checking logs
Change-Id: Ic722a9fd1f406cf03abb072015078fc7192066ce
diff --git a/transport/HidlTransportSupport.cpp b/transport/HidlTransportSupport.cpp
index b433b70..e645cd0 100644
--- a/transport/HidlTransportSupport.cpp
+++ b/transport/HidlTransportSupport.cpp
@@ -13,13 +13,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include <hidl/HidlBinderSupport.h>
 #include <hidl/HidlTransportSupport.h>
-#include <hidl/Static.h>
+
+#include <hidl/HidlBinderSupport.h>
+#include "InternalStatic.h"
 
 #include <android-base/logging.h>
 #include <android/hidl/manager/1.0/IServiceManager.h>
 
+#include <linux/sched.h>
+
 namespace android {
 namespace hardware {
 
@@ -92,6 +95,10 @@
     return true;
 }
 
+SchedPrio getMinSchedulerPolicy(const sp<IBase>& service) {
+    return details::gServicePrioMap->get(service, {SCHED_NORMAL, 0});
+}
+
 bool setRequestingSid(const sp<IBase>& service, bool requesting) {
     if (service->isRemote()) {
         LOG(ERROR) << "Can't set requesting sid on remote service.";
@@ -108,6 +115,10 @@
     return true;
 }
 
+bool getRequestingSid(const sp<IBase>& service) {
+    return details::gServiceSidMap->get(service.get(), false);
+}
+
 bool interfacesEqual(const sp<IBase>& left, const sp<IBase>& right) {
     if (left == nullptr || right == nullptr || !left->isRemote() || !right->isRemote()) {
         return left == right;
diff --git a/transport/InternalStatic.h b/transport/InternalStatic.h
index 1dfaae4..666b2b6 100644
--- a/transport/InternalStatic.h
+++ b/transport/InternalStatic.h
@@ -20,19 +20,26 @@
 #ifndef ANDROID_HARDWARE_HIDL_INTERNAL_STATIC_H
 #define ANDROID_HARDWARE_HIDL_INTERNAL_STATIC_H
 
+#include <hidl/HidlTransportSupport.h>  // for SchedPrio
 #include <hidl/Static.h>
 
 namespace android {
 namespace hardware {
 namespace details {
 
-// TODO(b/69122224): remove this
+// TODO(b/69122224): remove this once no prebuilts reference it
 // deprecated; use getBnConstructorMap instead.
 extern DoNotDestruct<BnConstructorMap> gBnConstructorMap;
-// TODO(b/69122224): remove this
+// TODO(b/69122224): remove this once no prebuilts reference it
 // deprecated; use getBsConstructorMap instead.
 extern DoNotDestruct<BsConstructorMap> gBsConstructorMap;
 
+// TODO(b/69122224): remove this once no prebuilts reference it
+extern DoNotDestruct<ConcurrentMap<wp<::android::hidl::base::V1_0::IBase>, SchedPrio>>
+        gServicePrioMap;
+// TODO(b/69122224): remove this once no prebuilts reference it
+extern DoNotDestruct<ConcurrentMap<wp<::android::hidl::base::V1_0::IBase>, bool>> gServiceSidMap;
+
 }  // namespace details
 }  // namespace hardware
 }  // namespace android
diff --git a/transport/include/hidl/HidlTransportSupport.h b/transport/include/hidl/HidlTransportSupport.h
index a132bfa..454a4e5 100644
--- a/transport/include/hidl/HidlTransportSupport.h
+++ b/transport/include/hidl/HidlTransportSupport.h
@@ -84,6 +84,13 @@
 bool setMinSchedulerPolicy(const sp<::android::hidl::base::V1_0::IBase>& service,
                            int policy, int priority);
 
+struct SchedPrio {
+    int sched_policy;
+    int prio;
+};
+
+SchedPrio getMinSchedulerPolicy(const sp<::android::hidl::base::V1_0::IBase>& service);
+
 /**
  * Sets whether or not this object should request security contexts to be populatd for incoming
  * calls (e.g. with getCallingSid).
@@ -97,6 +104,12 @@
 bool setRequestingSid(const sp<::android::hidl::base::V1_0::IBase>& service, bool requesting);
 
 /**
+ * Says whether or not this service is requesting a SID. If this was set after the service was
+ * sent to another process, then it will not take effect.
+ */
+bool getRequestingSid(const sp<::android::hidl::base::V1_0::IBase>& service);
+
+/**
  * Returns whether two interfaces represent the same interface. References to interfaces in the same
  * process will always be equivalent. However, in order to compare a service that is a proxy to a
  * different process, its underlying structure may have to be checked.
diff --git a/transport/include/hidl/Static.h b/transport/include/hidl/Static.h
index be74bae..3f6203c 100644
--- a/transport/include/hidl/Static.h
+++ b/transport/include/hidl/Static.h
@@ -32,17 +32,6 @@
 namespace hardware {
 namespace details {
 
-struct SchedPrio {
-    int sched_policy;
-    int prio;
-};
-
-// TODO(b/69122224): remove this
-extern DoNotDestruct<ConcurrentMap<wp<::android::hidl::base::V1_0::IBase>, SchedPrio>>
-        gServicePrioMap;
-// TODO(b/69122224): remove this
-extern DoNotDestruct<ConcurrentMap<wp<::android::hidl::base::V1_0::IBase>, bool>> gServiceSidMap;
-
 // TODO(b/69122224): remove this
 // For HidlBinderSupport and autogenerated code
 extern DoNotDestruct<ConcurrentMap<const ::android::hidl::base::V1_0::IBase*,