Merge 24Q3 (ab/11976889) to aosp-main-future
Bug: 347831320
Merged-In: I30f4c21dfee68603d0dad01d205f8a5581e6db31
Change-Id: I301c522ae67cc1f30fe0ddc819aa3dffd4c32d1a
diff --git a/libs/adbd_auth/adbd_auth.cpp b/libs/adbd_auth/adbd_auth.cpp
index ebc74fb..78896ed 100644
--- a/libs/adbd_auth/adbd_auth.cpp
+++ b/libs/adbd_auth/adbd_auth.cpp
@@ -365,7 +365,7 @@
if (event.events & EPOLLIN) {
int rc = TEMP_FAILURE_RETRY(read(framework_fd_.get(), buf, sizeof(buf)));
if (rc == -1) {
- LOG(FATAL) << "adbd_auth: failed to read from framework fd";
+ PLOG(FATAL) << "adbd_auth: failed to read from framework fd";
} else if (rc == 0) {
LOG(INFO) << "adbd_auth: hit EOF on framework fd";
std::lock_guard<std::mutex> lock(mutex_);
diff --git a/libs/binder/Android.bp b/libs/binder/Android.bp
index 7d15350..f31f8d3 100644
--- a/libs/binder/Android.bp
+++ b/libs/binder/Android.bp
@@ -19,6 +19,7 @@
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
default_applicable_licenses: ["frameworks_native_license"],
+ default_team: "trendy_team_virtualization",
}
cc_library_headers {
@@ -90,7 +91,11 @@
"libbinder_sdk",
"libbinder_sdk_single_threaded",
"libbinder_ndk_sdk",
+ "googletest_cmake",
+
"binderRpcTestNoKernel",
+ "binderRpcTestSingleThreadedNoKernel",
+ "binderRpcWireProtocolTest",
],
prebuilts: [
// to enable arm64 host support, build with musl - e.g. on aosp_cf_arm64_phone
@@ -133,12 +138,16 @@
{
android_name: "libgtest",
mapped_name: "GTest::gtest",
- package_system: "GTest",
+ package_pregenerated: "external/googletest",
},
{
android_name: "libgtest_main",
- mapped_name: "GTest::gtest",
- package_system: "GTest",
+ mapped_name: "GTest::gtest_main",
+ package_pregenerated: "external/googletest",
+ },
+ {
+ android_name: "googletest_cmake",
+ package_pregenerated: "external/googletest",
},
// use libbinder_sdk and friends instead of full Android's libbinder
diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp
index fbc8125..8b65d63 100644
--- a/libs/binder/IPCThreadState.cpp
+++ b/libs/binder/IPCThreadState.cpp
@@ -613,16 +613,20 @@
void IPCThreadState::blockUntilThreadAvailable()
{
- pthread_mutex_lock(&mProcess->mThreadCountLock);
- mProcess->mWaitingForThreads++;
- while (mProcess->mExecutingThreadsCount >= mProcess->mMaxThreads) {
- ALOGW("Waiting for thread to be free. mExecutingThreadsCount=%lu mMaxThreads=%lu\n",
- static_cast<unsigned long>(mProcess->mExecutingThreadsCount),
- static_cast<unsigned long>(mProcess->mMaxThreads));
- pthread_cond_wait(&mProcess->mThreadCountDecrement, &mProcess->mThreadCountLock);
- }
- mProcess->mWaitingForThreads--;
- pthread_mutex_unlock(&mProcess->mThreadCountLock);
+ std::unique_lock lock_guard_(mProcess->mOnThreadAvailableLock);
+ mProcess->mOnThreadAvailableWaiting++;
+ mProcess->mOnThreadAvailableCondVar.wait(lock_guard_, [&] {
+ size_t max = mProcess->mMaxThreads;
+ size_t cur = mProcess->mExecutingThreadsCount;
+ if (cur < max) {
+ return true;
+ }
+ ALOGW("Waiting for thread to be free. mExecutingThreadsCount=%" PRId64
+ " mMaxThreads=%" PRId64 "\n",
+ cur, max);
+ return false;
+ });
+ mProcess->mOnThreadAvailableWaiting--;
}
status_t IPCThreadState::getAndExecuteCommand()
@@ -642,34 +646,33 @@
ALOGI("%s", message.c_str());
}
- pthread_mutex_lock(&mProcess->mThreadCountLock);
- mProcess->mExecutingThreadsCount++;
- if (mProcess->mExecutingThreadsCount >= mProcess->mMaxThreads &&
- mProcess->mStarvationStartTimeMs == 0) {
- mProcess->mStarvationStartTimeMs = uptimeMillis();
+ size_t newThreadsCount = mProcess->mExecutingThreadsCount.fetch_add(1) + 1;
+ if (newThreadsCount >= mProcess->mMaxThreads) {
+ int64_t expected = 0;
+ mProcess->mStarvationStartTimeMs.compare_exchange_strong(expected, uptimeMillis());
}
- pthread_mutex_unlock(&mProcess->mThreadCountLock);
result = executeCommand(cmd);
- pthread_mutex_lock(&mProcess->mThreadCountLock);
- mProcess->mExecutingThreadsCount--;
- if (mProcess->mExecutingThreadsCount < mProcess->mMaxThreads &&
- mProcess->mStarvationStartTimeMs != 0) {
- int64_t starvationTimeMs = uptimeMillis() - mProcess->mStarvationStartTimeMs;
- if (starvationTimeMs > 100) {
- ALOGE("binder thread pool (%zu threads) starved for %" PRId64 " ms",
- mProcess->mMaxThreads, starvationTimeMs);
+ size_t maxThreads = mProcess->mMaxThreads;
+ newThreadsCount = mProcess->mExecutingThreadsCount.fetch_sub(1) - 1;
+ if (newThreadsCount < maxThreads) {
+ size_t starvationStartTimeMs = mProcess->mStarvationStartTimeMs.exchange(0);
+ if (starvationStartTimeMs != 0) {
+ int64_t starvationTimeMs = uptimeMillis() - starvationStartTimeMs;
+ if (starvationTimeMs > 100) {
+ ALOGE("binder thread pool (%zu threads) starved for %" PRId64 " ms", maxThreads,
+ starvationTimeMs);
+ }
}
- mProcess->mStarvationStartTimeMs = 0;
}
// Cond broadcast can be expensive, so don't send it every time a binder
// call is processed. b/168806193
- if (mProcess->mWaitingForThreads > 0) {
- pthread_cond_broadcast(&mProcess->mThreadCountDecrement);
+ if (mProcess->mOnThreadAvailableWaiting > 0) {
+ std::lock_guard lock_guard_(mProcess->mOnThreadAvailableLock);
+ mProcess->mOnThreadAvailableCondVar.notify_all();
}
- pthread_mutex_unlock(&mProcess->mThreadCountLock);
}
return result;
@@ -727,10 +730,9 @@
void IPCThreadState::joinThreadPool(bool isMain)
{
- LOG_THREADPOOL("**** THREAD %p (PID %d) IS JOINING THE THREAD POOL\n", (void*)pthread_self(), getpid());
- pthread_mutex_lock(&mProcess->mThreadCountLock);
+ LOG_THREADPOOL("**** THREAD %p (PID %d) IS JOINING THE THREAD POOL\n", (void*)pthread_self(),
+ getpid());
mProcess->mCurrentThreads++;
- pthread_mutex_unlock(&mProcess->mThreadCountLock);
mOut.writeInt32(isMain ? BC_ENTER_LOOPER : BC_REGISTER_LOOPER);
mIsLooper = true;
@@ -758,13 +760,11 @@
mOut.writeInt32(BC_EXIT_LOOPER);
mIsLooper = false;
talkWithDriver(false);
- pthread_mutex_lock(&mProcess->mThreadCountLock);
- LOG_ALWAYS_FATAL_IF(mProcess->mCurrentThreads == 0,
- "Threadpool thread count = 0. Thread cannot exist and exit in empty "
- "threadpool\n"
+ size_t oldCount = mProcess->mCurrentThreads.fetch_sub(1);
+ LOG_ALWAYS_FATAL_IF(oldCount == 0,
+ "Threadpool thread count underflowed. Thread cannot exist and exit in "
+ "empty threadpool\n"
"Misconfiguration. Increase threadpool max threads configuration\n");
- mProcess->mCurrentThreads--;
- pthread_mutex_unlock(&mProcess->mThreadCountLock);
}
status_t IPCThreadState::setupPolling(int* fd)
@@ -776,9 +776,7 @@
mOut.writeInt32(BC_ENTER_LOOPER);
flushCommands();
*fd = mProcess->mDriverFD;
- pthread_mutex_lock(&mProcess->mThreadCountLock);
mProcess->mCurrentThreads++;
- pthread_mutex_unlock(&mProcess->mThreadCountLock);
return 0;
}
diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp
index 8485ecd..ad5a6b3 100644
--- a/libs/binder/ProcessState.cpp
+++ b/libs/binder/ProcessState.cpp
@@ -407,9 +407,7 @@
ALOGV("Spawning new pooled thread, name=%s\n", name.c_str());
sp<Thread> t = sp<PoolThread>::make(isMain);
t->run(name.c_str());
- pthread_mutex_lock(&mThreadCountLock);
mKernelStartedThreads++;
- pthread_mutex_unlock(&mThreadCountLock);
}
// TODO: if startThreadPool is called on another thread after the process
// starts up, the kernel might think that it already requested those
@@ -432,19 +430,19 @@
}
size_t ProcessState::getThreadPoolMaxTotalThreadCount() const {
- pthread_mutex_lock(&mThreadCountLock);
- auto detachGuard = make_scope_guard([&]() { pthread_mutex_unlock(&mThreadCountLock); });
-
if (mThreadPoolStarted) {
- LOG_ALWAYS_FATAL_IF(mKernelStartedThreads > mMaxThreads + 1,
- "too many kernel-started threads: %zu > %zu + 1", mKernelStartedThreads,
- mMaxThreads);
+ size_t kernelStarted = mKernelStartedThreads;
+ size_t max = mMaxThreads;
+ size_t current = mCurrentThreads;
+
+ LOG_ALWAYS_FATAL_IF(kernelStarted > max + 1,
+ "too many kernel-started threads: %zu > %zu + 1", kernelStarted, max);
// calling startThreadPool starts a thread
size_t threads = 1;
// the kernel is configured to start up to mMaxThreads more threads
- threads += mMaxThreads;
+ threads += max;
// Users may call IPCThreadState::joinThreadPool directly. We don't
// currently have a way to count this directly (it could be added by
@@ -454,8 +452,8 @@
// in IPCThreadState, temporarily forget about the extra join threads.
// This is okay, because most callers of this method only care about
// having 0, 1, or more threads.
- if (mCurrentThreads > mKernelStartedThreads) {
- threads += mCurrentThreads - mKernelStartedThreads;
+ if (current > kernelStarted) {
+ threads += current - kernelStarted;
}
return threads;
@@ -463,10 +461,9 @@
// must not be initialized or maybe has poll thread setup, we
// currently don't track this in libbinder
- LOG_ALWAYS_FATAL_IF(mKernelStartedThreads != 0,
- "Expecting 0 kernel started threads but have"
- " %zu",
- mKernelStartedThreads);
+ size_t kernelStarted = mKernelStartedThreads;
+ LOG_ALWAYS_FATAL_IF(kernelStarted != 0, "Expecting 0 kernel started threads but have %zu",
+ kernelStarted);
return mCurrentThreads;
}
@@ -554,10 +551,7 @@
: mDriverName(String8(driver)),
mDriverFD(-1),
mVMStart(MAP_FAILED),
- mThreadCountLock(PTHREAD_MUTEX_INITIALIZER),
- mThreadCountDecrement(PTHREAD_COND_INITIALIZER),
mExecutingThreadsCount(0),
- mWaitingForThreads(0),
mMaxThreads(DEFAULT_MAX_BINDER_THREADS),
mCurrentThreads(0),
mKernelStartedThreads(0),
diff --git a/libs/binder/include/binder/ProcessState.h b/libs/binder/include/binder/ProcessState.h
index a466638..11898a0 100644
--- a/libs/binder/include/binder/ProcessState.h
+++ b/libs/binder/include/binder/ProcessState.h
@@ -23,6 +23,7 @@
#include <pthread.h>
+#include <atomic>
#include <mutex>
// ---------------------------------------------------------------------------
@@ -162,22 +163,21 @@
int mDriverFD;
void* mVMStart;
- // Protects thread count and wait variables below.
- mutable pthread_mutex_t mThreadCountLock;
- // Broadcast whenever mWaitingForThreads > 0
- pthread_cond_t mThreadCountDecrement;
+ mutable std::mutex mOnThreadAvailableLock;
+ std::condition_variable mOnThreadAvailableCondVar;
+ // Number of threads waiting on `mOnThreadAvailableCondVar`.
+ std::atomic_int64_t mOnThreadAvailableWaiting = 0;
+
// Number of binder threads current executing a command.
- size_t mExecutingThreadsCount;
- // Number of threads calling IPCThreadState::blockUntilThreadAvailable()
- size_t mWaitingForThreads;
+ std::atomic_size_t mExecutingThreadsCount;
// Maximum number of lazy threads to be started in the threadpool by the kernel.
- size_t mMaxThreads;
+ std::atomic_size_t mMaxThreads;
// Current number of threads inside the thread pool.
- size_t mCurrentThreads;
+ std::atomic_size_t mCurrentThreads;
// Current number of pooled threads inside the thread pool.
- size_t mKernelStartedThreads;
+ std::atomic_size_t mKernelStartedThreads;
// Time when thread pool was emptied
- int64_t mStarvationStartTimeMs;
+ std::atomic_int64_t mStarvationStartTimeMs;
mutable std::mutex mLock; // protects everything below.
diff --git a/libs/binder/ndk/include_cpp/android/persistable_bundle_aidl.h b/libs/binder/ndk/include_cpp/android/persistable_bundle_aidl.h
index d570eab..cf7dc1a 100644
--- a/libs/binder/ndk/include_cpp/android/persistable_bundle_aidl.h
+++ b/libs/binder/ndk/include_cpp/android/persistable_bundle_aidl.h
@@ -26,13 +26,10 @@
#if defined(__ANDROID_VENDOR__)
#include <android/llndk-versioning.h>
#else // __ANDROID_VENDOR__
-#if defined(API_LEVEL_AT_LEAST)
-// Redefine API_LEVEL_AT_LEAST here to replace the version to __ANDROID_API_FUTURE__ as a workaround
-#undef API_LEVEL_AT_LEAST
-#endif
-// TODO(b/322384429) switch this __ANDROID_API_FUTURE__ to sdk_api_level when V is finalized
+#if !defined(API_LEVEL_AT_LEAST)
#define API_LEVEL_AT_LEAST(sdk_api_level, vendor_api_level) \
- (__builtin_available(android __ANDROID_API_FUTURE__, *))
+ (__builtin_available(android sdk_api_level, *))
+#endif
#endif // __ANDROID_VENDOR__
namespace aidl::android::os {
diff --git a/libs/binder/tests/binder_sdk/Android.bp b/libs/binder/tests/binder_sdk/Android.bp
new file mode 100644
index 0000000..4e884ad
--- /dev/null
+++ b/libs/binder/tests/binder_sdk/Android.bp
@@ -0,0 +1,84 @@
+//
+// Copyright (C) 2024 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "frameworks_native_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["frameworks_native_license"],
+}
+
+sh_test_host {
+ name: "binder_sdk_test",
+ src: "binder_sdk_test.sh",
+ test_suites: ["general-tests"],
+ test_options: {
+ unit_test: false,
+ },
+
+ data: [
+ ":binder_sdk",
+ ":cmake_root",
+ ],
+ data_bins: [
+ "cmake",
+ "ctest",
+ ],
+}
+
+sh_test_host {
+ name: "binder_sdk_docker_test_gcc",
+ src: "binder_sdk_docker_test.sh",
+ test_suites: ["general-tests"],
+ test_options: {
+ unit_test: false,
+ },
+
+ data: [
+ ":binder_sdk",
+ "gcc.Dockerfile",
+ ],
+}
+
+sh_test_host {
+ name: "binder_sdk_docker_test_clang",
+ src: "binder_sdk_docker_test.sh",
+ test_suites: ["general-tests"],
+ test_options: {
+ unit_test: false,
+ },
+
+ data: [
+ ":binder_sdk",
+ "clang.Dockerfile",
+ ],
+}
+
+sh_test_host {
+ name: "binder_sdk_docker_test_gnumake",
+ src: "binder_sdk_docker_test.sh",
+ test_suites: ["general-tests"],
+ test_options: {
+ unit_test: false,
+ },
+
+ data: [
+ ":binder_sdk",
+ "gnumake.Dockerfile",
+ ],
+}
diff --git a/libs/binder/tests/binder_sdk/binder_sdk_docker_test.sh b/libs/binder/tests/binder_sdk/binder_sdk_docker_test.sh
new file mode 100755
index 0000000..0eca846
--- /dev/null
+++ b/libs/binder/tests/binder_sdk/binder_sdk_docker_test.sh
@@ -0,0 +1,70 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2024 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+set -ex
+
+TEST_NAME="$(basename "$0")"
+DOCKER_TAG="${TEST_NAME}-${RANDOM}${RANDOM}"
+DOCKER_FILE=*.Dockerfile
+DOCKER_RUN_FLAGS=
+
+# Guess if we're running as an Android test or directly
+if [ "$(ls -1 ${DOCKER_FILE} | wc -l)" == "1" ]; then
+ # likely running as `atest binder_sdk_docker_test_XYZ`
+ DOCKER_PATH="$(dirname $(readlink --canonicalize --no-newline binder_sdk.zip))"
+else
+ # likely running directly as `./binder_sdk_docker_test.sh` - provide mode for easy testing
+ RED='\033[1;31m'
+ NO_COLOR='\033[0m'
+
+ if ! modinfo vsock_loopback &>/dev/null ; then
+ echo -e "${RED}Module vsock_loopback is not installed.${NO_COLOR}"
+ exit 1
+ fi
+ if modprobe --dry-run --first-time vsock_loopback &>/dev/null ; then
+ echo "Module vsock_loopback is not loaded. Attempting to load..."
+ if ! sudo modprobe vsock_loopback ; then
+ echo -e "${RED}Module vsock_loopback is not loaded and attempt to load failed.${NO_COLOR}"
+ exit 1
+ fi
+ fi
+
+ DOCKER_RUN_FLAGS="--interactive --tty"
+
+ DOCKER_FILE="$1"
+ if [ ! -f "${DOCKER_FILE}" ]; then
+ echo -e "${RED}Docker file '${DOCKER_FILE}' doesn't exist. Please provide one as an argument.${NO_COLOR}"
+ exit 1
+ fi
+
+ if [ ! -d "${ANDROID_BUILD_TOP}" ]; then
+ echo -e "${RED}ANDROID_BUILD_TOP doesn't exist. Please lunch some target.${NO_COLOR}"
+ exit 1
+ fi
+ ${ANDROID_BUILD_TOP}/build/soong/soong_ui.bash --make-mode binder_sdk
+ BINDER_SDK_ZIP="${ANDROID_BUILD_TOP}/out/soong/.intermediates/frameworks/native/libs/binder/binder_sdk/linux_glibc_x86_64/*/binder_sdk.zip"
+ DOCKER_PATH="$(dirname $(ls -1 ${BINDER_SDK_ZIP} | head --lines=1))"
+fi
+
+function cleanup {
+ docker rmi --force "${DOCKER_TAG}" 2>/dev/null || true
+}
+trap cleanup EXIT
+
+docker build --force-rm --tag "${DOCKER_TAG}" --file ${DOCKER_FILE} ${DOCKER_PATH}
+docker run ${DOCKER_RUN_FLAGS} --rm "${DOCKER_TAG}"
diff --git a/libs/binder/tests/binder_sdk/binder_sdk_test.sh b/libs/binder/tests/binder_sdk/binder_sdk_test.sh
new file mode 100644
index 0000000..1881ace
--- /dev/null
+++ b/libs/binder/tests/binder_sdk/binder_sdk_test.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2024 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+set -ex
+
+RED='\033[1;31m'
+NO_COLOR='\033[0m'
+
+if [ ! -f "binder_sdk.zip" ]; then
+ echo -e "${RED}binder_sdk.zip doesn't exist. Are you running this test through 'atest binder_sdk_test'?${NO_COLOR}"
+ exit 1
+fi
+
+mkdir -p bin
+cp `pwd`/cmake bin/cmake
+cp `pwd`/ctest bin/ctest
+export PATH="`pwd`/bin:$PATH"
+
+WORKDIR=workdir_$RANDOM$RANDOM$RANDOM
+unzip -q -d $WORKDIR binder_sdk.zip
+cd $WORKDIR
+
+cmake .
+make -j
+make test ARGS="--parallel 32 --output-on-failure"
diff --git a/libs/binder/tests/binder_sdk/clang.Dockerfile b/libs/binder/tests/binder_sdk/clang.Dockerfile
new file mode 100644
index 0000000..aa1fec2
--- /dev/null
+++ b/libs/binder/tests/binder_sdk/clang.Dockerfile
@@ -0,0 +1,32 @@
+#
+# Copyright (C) 2024 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+FROM debian:bookworm
+
+RUN echo 'deb http://deb.debian.org/debian bookworm-backports main' >> /etc/apt/sources.list && \
+ apt-get update -y && \
+ apt-get install -y clang cmake ninja-build unzip
+
+ADD binder_sdk.zip /
+RUN unzip -q -d binder_sdk binder_sdk.zip
+
+WORKDIR /binder_sdk
+RUN CC=clang CXX=clang++ cmake -G Ninja -B build .
+RUN cmake --build build
+
+WORKDIR /binder_sdk/build
+# Alternatively: `ninja test`, but it won't pass parallel argument
+ENTRYPOINT [ "ctest", "--parallel", "32", "--output-on-failure" ]
diff --git a/libs/binder/tests/binder_sdk/gcc.Dockerfile b/libs/binder/tests/binder_sdk/gcc.Dockerfile
new file mode 100644
index 0000000..fb2ee2c
--- /dev/null
+++ b/libs/binder/tests/binder_sdk/gcc.Dockerfile
@@ -0,0 +1,32 @@
+#
+# Copyright (C) 2024 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+FROM gcc:9
+
+RUN echo 'deb http://deb.debian.org/debian bullseye-backports main' >> /etc/apt/sources.list && \
+ apt-get update -y && \
+ apt-get install -y cmake ninja-build
+
+ADD binder_sdk.zip /
+RUN unzip -q -d binder_sdk binder_sdk.zip
+
+WORKDIR /binder_sdk
+RUN CC=gcc CXX=g++ cmake -G Ninja -B build .
+RUN cmake --build build
+
+WORKDIR /binder_sdk/build
+# Alternatively: `ninja test`, but it won't pass parallel argument
+ENTRYPOINT [ "ctest", "--parallel", "32", "--output-on-failure" ]
diff --git a/libs/binder/tests/binder_sdk/gnumake.Dockerfile b/libs/binder/tests/binder_sdk/gnumake.Dockerfile
new file mode 100644
index 0000000..abe12fb
--- /dev/null
+++ b/libs/binder/tests/binder_sdk/gnumake.Dockerfile
@@ -0,0 +1,30 @@
+#
+# Copyright (C) 2024 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+FROM gcc:9
+
+RUN echo 'deb http://deb.debian.org/debian bullseye-backports main' >> /etc/apt/sources.list && \
+ apt-get update -y && \
+ apt-get install -y cmake
+
+ADD binder_sdk.zip /
+RUN unzip -q -d binder_sdk binder_sdk.zip
+
+WORKDIR /binder_sdk
+RUN cmake .
+RUN make -j
+
+ENTRYPOINT make test ARGS="--parallel 32 --output-on-failure"
diff --git a/libs/ui/Gralloc5.cpp b/libs/ui/Gralloc5.cpp
index f14a5cf..c9ec036 100644
--- a/libs/ui/Gralloc5.cpp
+++ b/libs/ui/Gralloc5.cpp
@@ -91,8 +91,7 @@
}
void* so = nullptr;
- // TODO(b/322384429) switch this to __ANDROID_API_V__ when V is finalized
- if API_LEVEL_AT_LEAST(__ANDROID_API_FUTURE__, 202404) {
+ if API_LEVEL_AT_LEAST (__ANDROID_API_V__, 202404) {
so = AServiceManager_openDeclaredPassthroughHal("mapper", mapperSuffix.c_str(),
RTLD_LOCAL | RTLD_NOW);
} else {