summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Moreland <smoreland@google.com>2019-10-02 15:50:10 -0700
committerSteven Moreland <smoreland@google.com>2019-10-02 15:50:10 -0700
commit635a2918cf1f31b8b1581055071825d133931022 (patch)
tree41ba62aaa42e1620defaf93c8404effc6c2fddd3
parent56701ba87948fcab7bccf771ac39e7778f763b0a (diff)
downloadnative-635a2918cf1f31b8b1581055071825d133931022.tar.gz
IServiceManager: check constant values consistancy
Now that we can check AIDL values against C++ values (note, we can't remove the duplication yet b/c of 'include_dirs'). Bug: 136027762 Test: build (hits static asserts) Change-Id: I96189b9aceac19699d90252f24dd161dcc5a2be5
-rw-r--r--libs/binder/IServiceManager.cpp11
-rw-r--r--libs/binder/include/binder/IServiceManager.h2
2 files changed, 12 insertions, 1 deletions
diff --git a/libs/binder/IServiceManager.cpp b/libs/binder/IServiceManager.cpp
index ee637e24bf..4bea217930 100644
--- a/libs/binder/IServiceManager.cpp
+++ b/libs/binder/IServiceManager.cpp
@@ -43,6 +43,17 @@ namespace android {
using AidlServiceManager = android::os::IServiceManager;
using android::binder::Status;
+// libbinder's IServiceManager.h can't rely on the values generated by AIDL
+// because many places use its headers via include_dirs (meaning, without
+// declaring the dependency in the build system). So, for now, we can just check
+// the values here.
+static_assert(AidlServiceManager::DUMP_FLAG_PRIORITY_CRITICAL == IServiceManager::DUMP_FLAG_PRIORITY_CRITICAL);
+static_assert(AidlServiceManager::DUMP_FLAG_PRIORITY_HIGH == IServiceManager::DUMP_FLAG_PRIORITY_HIGH);
+static_assert(AidlServiceManager::DUMP_FLAG_PRIORITY_NORMAL == IServiceManager::DUMP_FLAG_PRIORITY_NORMAL);
+static_assert(AidlServiceManager::DUMP_FLAG_PRIORITY_DEFAULT == IServiceManager::DUMP_FLAG_PRIORITY_DEFAULT);
+static_assert(AidlServiceManager::DUMP_FLAG_PRIORITY_ALL == IServiceManager::DUMP_FLAG_PRIORITY_ALL);
+static_assert(AidlServiceManager::DUMP_FLAG_PROTO == IServiceManager::DUMP_FLAG_PROTO);
+
sp<IServiceManager> defaultServiceManager()
{
static Mutex gDefaultServiceManagerLock;
diff --git a/libs/binder/include/binder/IServiceManager.h b/libs/binder/include/binder/IServiceManager.h
index def1bea974..cd63a58bce 100644
--- a/libs/binder/include/binder/IServiceManager.h
+++ b/libs/binder/include/binder/IServiceManager.h
@@ -31,7 +31,7 @@ class IServiceManager : public IInterface
public:
DECLARE_META_INTERFACE(ServiceManager)
/**
- * Must match values in IServiceManager.java
+ * Must match values in IServiceManager.aidl
*/
/* Allows services to dump sections according to priorities. */
static const int DUMP_FLAG_PRIORITY_CRITICAL = 1 << 0;