Loading include/android/surface_control.h +59 −1 Original line number Diff line number Diff line Loading @@ -145,6 +145,9 @@ typedef struct ASurfaceTransactionStats ASurfaceTransactionStats; * Buffers which are replaced or removed from the scene in the transaction invoking * this callback may be reused after this point. * * Starting with API level 36, prefer using \a ASurfaceTransaction_OnBufferRelease to listen * to when a buffer is ready to be reused. * * \param context Optional context provided by the client that is passed into * the callback. * Loading Loading @@ -189,6 +192,35 @@ typedef void (*ASurfaceTransaction_OnCommit)(void* _Null_unspecified context, ASurfaceTransactionStats* _Nonnull stats) __INTRODUCED_IN(31); /** * The ASurfaceTransaction_OnBufferRelease callback is invoked when a buffer that was passed in * ASurfaceTransaction_setBuffer is ready to be reused. * * This callback is guaranteed to be invoked if ASurfaceTransaction_setBuffer is called with a non * null buffer. If the buffer in the transaction is replaced via another call to * ASurfaceTransaction_setBuffer, the callback will be invoked immediately. Otherwise the callback * will be invoked before the ASurfaceTransaction_OnComplete callback after the buffer was * presented. * * If this callback is set, caller should not release the buffer using the * ASurfaceTransaction_OnComplete. * * \param context Optional context provided by the client that is passed into the callback. * * \param release_fence_fd Returns the fence file descriptor used to signal the release of buffer * associated with this callback. If this fence is valid (>=0), the buffer has not yet been released * and the fence will signal when the buffer has been released. If the fence is -1 , the buffer is * already released. The recipient of the callback takes ownership of the fence fd and is * responsible for closing it. * * THREADING * The callback can be invoked on any thread. * * Available since API level 36. */ typedef void (*ASurfaceTransaction_OnBufferRelease)(void* _Null_unspecified context, int release_fence_fd) __INTRODUCED_IN(36); /** * Returns the timestamp of when the frame was latched by the framework. Once a frame is * latched by the framework, it is presented at the following hardware vsync. Loading Loading @@ -353,6 +385,9 @@ void ASurfaceTransaction_setZOrder(ASurfaceTransaction* _Nonnull transaction, * Note that the buffer must be allocated with AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE * as the surface control might be composited using the GPU. * * Starting with API level 36, prefer using \a ASurfaceTransaction_setBufferWithRelease to * set a buffer and a callback which will be invoked when the buffer is ready to be reused. * * Available since API level 29. */ void ASurfaceTransaction_setBuffer(ASurfaceTransaction* _Nonnull transaction, Loading @@ -360,6 +395,29 @@ void ASurfaceTransaction_setBuffer(ASurfaceTransaction* _Nonnull transaction, AHardwareBuffer* _Nonnull buffer, int acquire_fence_fd) __INTRODUCED_IN(29); /** * Updates the AHardwareBuffer displayed for \a surface_control. If not -1, the * acquire_fence_fd should be a file descriptor that is signaled when all pending work * for the buffer is complete and the buffer can be safely read. * * The frameworks takes ownership of the \a acquire_fence_fd passed and is responsible * for closing it. * * Note that the buffer must be allocated with AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE * as the surface control might be composited using the GPU. * * When the buffer is ready to be reused, the ASurfaceTransaction_OnBufferRelease * callback will be invoked. If the buffer is null, the callback will not be invoked. * * Available since API level 36. */ void ASurfaceTransaction_setBufferWithRelease(ASurfaceTransaction* _Nonnull transaction, ASurfaceControl* _Nonnull surface_control, AHardwareBuffer* _Nonnull buffer, int acquire_fence_fd, void* _Null_unspecified context, ASurfaceTransaction_OnBufferRelease _Nonnull func) __INTRODUCED_IN(36); /** * Updates the color for \a surface_control. This will make the background color for the * ASurfaceControl visible in transparent regions of the surface. Colors \a r, \a g, Loading libs/arect/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ ndk_headers { cc_library_headers { name: "libarect_headers", host_supported: true, vendor_available: true, min_sdk_version: "29", // TODO(b/153609531): remove when no longer needed. Loading libs/binder/ndk/tests/libbinder_ndk_unit_test.cpp +23 −17 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ #include "android/binder_ibinder.h" using namespace android; using namespace std::chrono_literals; constexpr char kExistingNonNdkService[] = "SurfaceFlinger"; constexpr char kBinderNdkUnitTestService[] = "BinderNdkUnitTest"; Loading @@ -54,7 +55,7 @@ constexpr char kForcePersistNdkUnitTestService[] = "ForcePersistNdkUnitTestServi constexpr char kActiveServicesNdkUnitTestService[] = "ActiveServicesNdkUnitTestService"; constexpr char kBinderNdkUnitTestServiceFlagged[] = "BinderNdkUnitTestFlagged"; constexpr unsigned int kShutdownWaitTime = 11; constexpr auto kShutdownWaitTime = 30s; constexpr uint64_t kContextTestValue = 0xb4e42fb4d9a1d715; class MyTestFoo : public IFoo { Loading Loading @@ -253,12 +254,22 @@ int lazyService(const char* instance) { } bool isServiceRunning(const char* serviceName) { AIBinder* binder = AServiceManager_checkService(serviceName); if (binder == nullptr) { static const sp<android::IServiceManager> sm(android::defaultServiceManager()); const Vector<String16> services = sm->listServices(); for (const auto service : services) { if (service == String16(serviceName)) return true; } return false; } AIBinder_decStrong(binder); bool isServiceShutdownWithWait(const char* serviceName) { LOG(INFO) << "About to check and wait for shutdown of " << std::string(serviceName); const auto before = std::chrono::steady_clock::now(); while (isServiceRunning(serviceName)) { sleep(1); const auto after = std::chrono::steady_clock::now(); if (after - before >= kShutdownWaitTime) return false; } return true; } Loading Loading @@ -450,8 +461,8 @@ TEST(NdkBinder, CheckLazyServiceShutDown) { service = nullptr; IPCThreadState::self()->flushCommands(); // Make sure the service is dead after some time of no use sleep(kShutdownWaitTime); ASSERT_EQ(nullptr, AServiceManager_checkService(kLazyBinderNdkUnitTestService)); ASSERT_TRUE(isServiceShutdownWithWait(kLazyBinderNdkUnitTestService)) << "Service failed to shut down"; } TEST(NdkBinder, ForcedPersistenceTest) { Loading @@ -466,14 +477,12 @@ TEST(NdkBinder, ForcedPersistenceTest) { service = nullptr; IPCThreadState::self()->flushCommands(); sleep(kShutdownWaitTime); bool isRunning = isServiceRunning(kForcePersistNdkUnitTestService); if (i == 0) { ASSERT_TRUE(isRunning) << "Service shut down when it shouldn't have."; ASSERT_TRUE(isServiceRunning(kForcePersistNdkUnitTestService)) << "Service shut down when it shouldn't have."; } else { ASSERT_FALSE(isRunning) << "Service failed to shut down."; ASSERT_TRUE(isServiceShutdownWithWait(kForcePersistNdkUnitTestService)) << "Service failed to shut down"; } } } Loading @@ -491,10 +500,7 @@ TEST(NdkBinder, ActiveServicesCallbackTest) { service = nullptr; IPCThreadState::self()->flushCommands(); LOG(INFO) << "ActiveServicesCallbackTest about to sleep"; sleep(kShutdownWaitTime); ASSERT_FALSE(isServiceRunning(kActiveServicesNdkUnitTestService)) ASSERT_TRUE(isServiceShutdownWithWait(kActiveServicesNdkUnitTestService)) << "Service failed to shut down."; } Loading libs/binder/tests/binderRpcTest.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -454,7 +454,7 @@ TEST_P(BinderRpc, ThreadPoolGreaterThanEqualRequested) { GTEST_SKIP() << "This test requires multiple threads"; } constexpr size_t kNumThreads = 10; constexpr size_t kNumThreads = 5; auto proc = createRpcTestSocketServerProcess({.numThreads = kNumThreads}); Loading services/gpuservice/vts/TEST_MAPPING +7 −1 Original line number Diff line number Diff line { "presubmit": [ { "name": "GpuServiceVendorTests" "name": "GpuServiceVendorTests", "options": [ { // Exclude test methods that require a physical device to run. "exclude-annotation": "android.platform.test.annotations.RequiresDevice" } ] } ] } Loading
include/android/surface_control.h +59 −1 Original line number Diff line number Diff line Loading @@ -145,6 +145,9 @@ typedef struct ASurfaceTransactionStats ASurfaceTransactionStats; * Buffers which are replaced or removed from the scene in the transaction invoking * this callback may be reused after this point. * * Starting with API level 36, prefer using \a ASurfaceTransaction_OnBufferRelease to listen * to when a buffer is ready to be reused. * * \param context Optional context provided by the client that is passed into * the callback. * Loading Loading @@ -189,6 +192,35 @@ typedef void (*ASurfaceTransaction_OnCommit)(void* _Null_unspecified context, ASurfaceTransactionStats* _Nonnull stats) __INTRODUCED_IN(31); /** * The ASurfaceTransaction_OnBufferRelease callback is invoked when a buffer that was passed in * ASurfaceTransaction_setBuffer is ready to be reused. * * This callback is guaranteed to be invoked if ASurfaceTransaction_setBuffer is called with a non * null buffer. If the buffer in the transaction is replaced via another call to * ASurfaceTransaction_setBuffer, the callback will be invoked immediately. Otherwise the callback * will be invoked before the ASurfaceTransaction_OnComplete callback after the buffer was * presented. * * If this callback is set, caller should not release the buffer using the * ASurfaceTransaction_OnComplete. * * \param context Optional context provided by the client that is passed into the callback. * * \param release_fence_fd Returns the fence file descriptor used to signal the release of buffer * associated with this callback. If this fence is valid (>=0), the buffer has not yet been released * and the fence will signal when the buffer has been released. If the fence is -1 , the buffer is * already released. The recipient of the callback takes ownership of the fence fd and is * responsible for closing it. * * THREADING * The callback can be invoked on any thread. * * Available since API level 36. */ typedef void (*ASurfaceTransaction_OnBufferRelease)(void* _Null_unspecified context, int release_fence_fd) __INTRODUCED_IN(36); /** * Returns the timestamp of when the frame was latched by the framework. Once a frame is * latched by the framework, it is presented at the following hardware vsync. Loading Loading @@ -353,6 +385,9 @@ void ASurfaceTransaction_setZOrder(ASurfaceTransaction* _Nonnull transaction, * Note that the buffer must be allocated with AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE * as the surface control might be composited using the GPU. * * Starting with API level 36, prefer using \a ASurfaceTransaction_setBufferWithRelease to * set a buffer and a callback which will be invoked when the buffer is ready to be reused. * * Available since API level 29. */ void ASurfaceTransaction_setBuffer(ASurfaceTransaction* _Nonnull transaction, Loading @@ -360,6 +395,29 @@ void ASurfaceTransaction_setBuffer(ASurfaceTransaction* _Nonnull transaction, AHardwareBuffer* _Nonnull buffer, int acquire_fence_fd) __INTRODUCED_IN(29); /** * Updates the AHardwareBuffer displayed for \a surface_control. If not -1, the * acquire_fence_fd should be a file descriptor that is signaled when all pending work * for the buffer is complete and the buffer can be safely read. * * The frameworks takes ownership of the \a acquire_fence_fd passed and is responsible * for closing it. * * Note that the buffer must be allocated with AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE * as the surface control might be composited using the GPU. * * When the buffer is ready to be reused, the ASurfaceTransaction_OnBufferRelease * callback will be invoked. If the buffer is null, the callback will not be invoked. * * Available since API level 36. */ void ASurfaceTransaction_setBufferWithRelease(ASurfaceTransaction* _Nonnull transaction, ASurfaceControl* _Nonnull surface_control, AHardwareBuffer* _Nonnull buffer, int acquire_fence_fd, void* _Null_unspecified context, ASurfaceTransaction_OnBufferRelease _Nonnull func) __INTRODUCED_IN(36); /** * Updates the color for \a surface_control. This will make the background color for the * ASurfaceControl visible in transparent regions of the surface. Colors \a r, \a g, Loading
libs/arect/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ ndk_headers { cc_library_headers { name: "libarect_headers", host_supported: true, vendor_available: true, min_sdk_version: "29", // TODO(b/153609531): remove when no longer needed. Loading
libs/binder/ndk/tests/libbinder_ndk_unit_test.cpp +23 −17 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ #include "android/binder_ibinder.h" using namespace android; using namespace std::chrono_literals; constexpr char kExistingNonNdkService[] = "SurfaceFlinger"; constexpr char kBinderNdkUnitTestService[] = "BinderNdkUnitTest"; Loading @@ -54,7 +55,7 @@ constexpr char kForcePersistNdkUnitTestService[] = "ForcePersistNdkUnitTestServi constexpr char kActiveServicesNdkUnitTestService[] = "ActiveServicesNdkUnitTestService"; constexpr char kBinderNdkUnitTestServiceFlagged[] = "BinderNdkUnitTestFlagged"; constexpr unsigned int kShutdownWaitTime = 11; constexpr auto kShutdownWaitTime = 30s; constexpr uint64_t kContextTestValue = 0xb4e42fb4d9a1d715; class MyTestFoo : public IFoo { Loading Loading @@ -253,12 +254,22 @@ int lazyService(const char* instance) { } bool isServiceRunning(const char* serviceName) { AIBinder* binder = AServiceManager_checkService(serviceName); if (binder == nullptr) { static const sp<android::IServiceManager> sm(android::defaultServiceManager()); const Vector<String16> services = sm->listServices(); for (const auto service : services) { if (service == String16(serviceName)) return true; } return false; } AIBinder_decStrong(binder); bool isServiceShutdownWithWait(const char* serviceName) { LOG(INFO) << "About to check and wait for shutdown of " << std::string(serviceName); const auto before = std::chrono::steady_clock::now(); while (isServiceRunning(serviceName)) { sleep(1); const auto after = std::chrono::steady_clock::now(); if (after - before >= kShutdownWaitTime) return false; } return true; } Loading Loading @@ -450,8 +461,8 @@ TEST(NdkBinder, CheckLazyServiceShutDown) { service = nullptr; IPCThreadState::self()->flushCommands(); // Make sure the service is dead after some time of no use sleep(kShutdownWaitTime); ASSERT_EQ(nullptr, AServiceManager_checkService(kLazyBinderNdkUnitTestService)); ASSERT_TRUE(isServiceShutdownWithWait(kLazyBinderNdkUnitTestService)) << "Service failed to shut down"; } TEST(NdkBinder, ForcedPersistenceTest) { Loading @@ -466,14 +477,12 @@ TEST(NdkBinder, ForcedPersistenceTest) { service = nullptr; IPCThreadState::self()->flushCommands(); sleep(kShutdownWaitTime); bool isRunning = isServiceRunning(kForcePersistNdkUnitTestService); if (i == 0) { ASSERT_TRUE(isRunning) << "Service shut down when it shouldn't have."; ASSERT_TRUE(isServiceRunning(kForcePersistNdkUnitTestService)) << "Service shut down when it shouldn't have."; } else { ASSERT_FALSE(isRunning) << "Service failed to shut down."; ASSERT_TRUE(isServiceShutdownWithWait(kForcePersistNdkUnitTestService)) << "Service failed to shut down"; } } } Loading @@ -491,10 +500,7 @@ TEST(NdkBinder, ActiveServicesCallbackTest) { service = nullptr; IPCThreadState::self()->flushCommands(); LOG(INFO) << "ActiveServicesCallbackTest about to sleep"; sleep(kShutdownWaitTime); ASSERT_FALSE(isServiceRunning(kActiveServicesNdkUnitTestService)) ASSERT_TRUE(isServiceShutdownWithWait(kActiveServicesNdkUnitTestService)) << "Service failed to shut down."; } Loading
libs/binder/tests/binderRpcTest.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -454,7 +454,7 @@ TEST_P(BinderRpc, ThreadPoolGreaterThanEqualRequested) { GTEST_SKIP() << "This test requires multiple threads"; } constexpr size_t kNumThreads = 10; constexpr size_t kNumThreads = 5; auto proc = createRpcTestSocketServerProcess({.numThreads = kNumThreads}); Loading
services/gpuservice/vts/TEST_MAPPING +7 −1 Original line number Diff line number Diff line { "presubmit": [ { "name": "GpuServiceVendorTests" "name": "GpuServiceVendorTests", "options": [ { // Exclude test methods that require a physical device to run. "exclude-annotation": "android.platform.test.annotations.RequiresDevice" } ] } ] }