summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Tomasz Wasilczyk <twasilczyk@google.com> 2023-11-13 21:57:35 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2023-11-13 21:57:35 +0000
commitbcfdf390bf4e8433bad9b2acc844ce9ddd37fecc (patch)
tree3fa81bc867cf368f1cea51dd926bf0a605eefc3a
parentae37b16655f760518dec3406595f6af17aac1466 (diff)
parent897ac13a911b338ccf543335d5b3ee673837d252 (diff)
Merge "Don't use Android properties outside of Android" into main am: 897ac13a91
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2819218 Change-Id: I5cb65fe9e42d3aa5f8144661c1fe624b875952c2 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--libs/binder/tests/binderRpcTest.cpp9
-rw-r--r--libs/binder/tests/binderRpcTestCommon.h5
2 files changed, 10 insertions, 4 deletions
diff --git a/libs/binder/tests/binderRpcTest.cpp b/libs/binder/tests/binderRpcTest.cpp
index 05b9b6ca65..b86eb94928 100644
--- a/libs/binder/tests/binderRpcTest.cpp
+++ b/libs/binder/tests/binderRpcTest.cpp
@@ -1358,7 +1358,11 @@ private:
};
TEST(BinderRpc, Java) {
-#if !defined(__ANDROID__)
+ bool expectDebuggable = false;
+#if defined(__ANDROID__)
+ expectDebuggable = android::base::GetBoolProperty("ro.debuggable", false) &&
+ android::base::GetProperty("ro.build.type", "") != "user";
+#else
GTEST_SKIP() << "This test is only run on Android. Though it can technically run on host on"
"createRpcDelegateServiceManager() with a device attached, such test belongs "
"to binderHostDeviceTest. Hence, just disable this test on host.";
@@ -1386,8 +1390,7 @@ TEST(BinderRpc, Java) {
auto keepAlive = sp<BBinder>::make();
auto setRpcClientDebugStatus = binder->setRpcClientDebug(std::move(socket), keepAlive);
- if (!android::base::GetBoolProperty("ro.debuggable", false) ||
- android::base::GetProperty("ro.build.type", "") == "user") {
+ if (!expectDebuggable) {
ASSERT_EQ(INVALID_OPERATION, setRpcClientDebugStatus)
<< "setRpcClientDebug should return INVALID_OPERATION on non-debuggable or user "
"builds, but get "
diff --git a/libs/binder/tests/binderRpcTestCommon.h b/libs/binder/tests/binderRpcTestCommon.h
index d0ec3fa576..b2b63e4bf3 100644
--- a/libs/binder/tests/binderRpcTestCommon.h
+++ b/libs/binder/tests/binderRpcTestCommon.h
@@ -36,9 +36,12 @@
#include <string>
#include <vector>
+#ifdef __ANDROID__
+#include <android-base/properties.h>
+#endif
+
#ifndef __TRUSTY__
#include <android-base/file.h>
-#include <android-base/properties.h>
#include <android/binder_auto_utils.h>
#include <android/binder_libbinder.h>
#include <binder/ProcessState.h>