Loading cmds/dumpsys/tests/dumpsys_test.cpp +2 −0 Original line number Original line Diff line number Diff line Loading @@ -67,6 +67,8 @@ class ServiceManagerMock : public IServiceManager { MOCK_METHOD2(unregisterForNotifications, status_t(const String16&, MOCK_METHOD2(unregisterForNotifications, status_t(const String16&, const sp<LocalRegistrationCallback>&)); const sp<LocalRegistrationCallback>&)); MOCK_METHOD0(getServiceDebugInfo, std::vector<ServiceDebugInfo>()); MOCK_METHOD0(getServiceDebugInfo, std::vector<ServiceDebugInfo>()); MOCK_METHOD1(enableAddServiceCache, void(bool)); protected: protected: MOCK_METHOD0(onAsBinder, IBinder*()); MOCK_METHOD0(onAsBinder, IBinder*()); }; }; Loading include/android/display_luts.h +3 −1 Original line number Original line Diff line number Diff line Loading @@ -43,6 +43,7 @@ typedef enum ADisplayLuts_Dimension ADisplayLuts_Dimension; enum ADisplayLuts_SamplingKey : int32_t { enum ADisplayLuts_SamplingKey : int32_t { ADISPLAYLUTS_SAMPLINGKEY_RGB = 0, ADISPLAYLUTS_SAMPLINGKEY_RGB = 0, ADISPLAYLUTS_SAMPLINGKEY_MAX_RGB = 1, ADISPLAYLUTS_SAMPLINGKEY_MAX_RGB = 1, ADISPLAYLUTS_SAMPLINGKEY_CIE_Y = 2, }; }; typedef enum ADisplayLuts_SamplingKey ADisplayLuts_SamplingKey; typedef enum ADisplayLuts_SamplingKey ADisplayLuts_SamplingKey; Loading Loading @@ -74,7 +75,8 @@ typedef struct ADisplayLuts ADisplayLuts; * @return a new \a ADisplayLutsEntry instance. * @return a new \a ADisplayLutsEntry instance. */ */ ADisplayLutsEntry* _Nonnull ADisplayLutsEntry_createEntry(float* _Nonnull buffer, ADisplayLutsEntry* _Nonnull ADisplayLutsEntry_createEntry(float* _Nonnull buffer, int32_t length, int32_t dimension, int32_t key) __INTRODUCED_IN(36); int32_t length, ADisplayLuts_Dimension dimension, ADisplayLuts_SamplingKey key) __INTRODUCED_IN(36); /** /** * Destroy the \a ADisplayLutsEntry instance. * Destroy the \a ADisplayLutsEntry instance. Loading include/private/display_luts_private.h +3 −2 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ #pragma once #pragma once #include <android/display_luts.h> #include <stdint.h> #include <stdint.h> #include <vector> #include <vector> #include <utils/RefBase.h> #include <utils/RefBase.h> Loading @@ -29,9 +30,9 @@ struct ADisplayLutsEntry_buffer { }; }; struct ADisplayLutsEntry_properties { struct ADisplayLutsEntry_properties { int32_t dimension; ADisplayLuts_Dimension dimension; int32_t size; int32_t size; int32_t samplingKey; ADisplayLuts_SamplingKey samplingKey; }; }; struct ADisplayLutsEntry: public RefBase { struct ADisplayLutsEntry: public RefBase { Loading libs/binder/Android.bp +26 −1 Original line number Original line Diff line number Diff line Loading @@ -477,9 +477,34 @@ libbinder_client_cache_config { }, }, } } soong_config_module_type { name: "libbinder_addservice_cache_config", module_type: "cc_defaults", config_namespace: "libbinder", bool_variables: ["release_libbinder_addservice_cache"], properties: [ "cflags", ], } libbinder_addservice_cache_config { name: "libbinder_addservice_cache_flag", soong_config_variables: { release_libbinder_addservice_cache: { cflags: ["-DLIBBINDER_ADDSERVICE_CACHE"], conditions_default: { cflags: ["-DNO_LIBBINDER_ADDSERVICE_CACHE"], }, }, }, } cc_defaults { cc_defaults { name: "libbinder_kernel_defaults", name: "libbinder_kernel_defaults", defaults: ["libbinder_client_cache_flag"], defaults: [ "libbinder_client_cache_flag", "libbinder_addservice_cache_flag", ], srcs: [ srcs: [ "BufferedTextOutput.cpp", "BufferedTextOutput.cpp", "BackendUnifiedServiceManager.cpp", "BackendUnifiedServiceManager.cpp", Loading libs/binder/BackendUnifiedServiceManager.cpp +37 −21 Original line number Original line Diff line number Diff line Loading @@ -30,6 +30,12 @@ constexpr bool kUseCache = true; constexpr bool kUseCache = false; constexpr bool kUseCache = false; #endif #endif #ifdef LIBBINDER_ADDSERVICE_CACHE constexpr bool kUseCacheInAddService = true; #else constexpr bool kUseCacheInAddService = false; #endif using AidlServiceManager = android::os::IServiceManager; using AidlServiceManager = android::os::IServiceManager; using android::os::IAccessor; using android::os::IAccessor; using binder::Status; using binder::Status; Loading Loading @@ -125,14 +131,20 @@ Status BackendUnifiedServiceManager::updateCache(const std::string& serviceName, if (!kUseCache) { if (!kUseCache) { return Status::ok(); return Status::ok(); } } if (service.getTag() == os::Service::Tag::binder) { return updateCache(serviceName, service.get<os::Service::Tag::binder>()); } return Status::ok(); } Status BackendUnifiedServiceManager::updateCache(const std::string& serviceName, const sp<IBinder>& binder) { std::string traceStr; std::string traceStr; if (atrace_is_tag_enabled(ATRACE_TAG_AIDL)) { if (atrace_is_tag_enabled(ATRACE_TAG_AIDL)) { traceStr = "BinderCacheWithInvalidation::updateCache : " + serviceName; traceStr = "BinderCacheWithInvalidation::updateCache : " + serviceName; } } binder::ScopedTrace aidlTrace(ATRACE_TAG_AIDL, traceStr.c_str()); binder::ScopedTrace aidlTrace(ATRACE_TAG_AIDL, traceStr.c_str()); if (service.getTag() == os::Service::Tag::binder) { sp<IBinder> binder = service.get<os::Service::Tag::binder>(); if (!binder) { if (!binder) { binder::ScopedTrace binder::ScopedTrace aidlTrace(ATRACE_TAG_AIDL, aidlTrace(ATRACE_TAG_AIDL, Loading @@ -150,7 +162,6 @@ Status BackendUnifiedServiceManager::updateCache(const std::string& serviceName, "BinderCacheWithInvalidation::updateCache failed: " "BinderCacheWithInvalidation::updateCache failed: " "caching_not_enabled"); "caching_not_enabled"); } } } return Status::ok(); return Status::ok(); } } Loading Loading @@ -277,7 +288,12 @@ Status BackendUnifiedServiceManager::toBinderService(const ::std::string& name, Status BackendUnifiedServiceManager::addService(const ::std::string& name, Status BackendUnifiedServiceManager::addService(const ::std::string& name, const sp<IBinder>& service, bool allowIsolated, const sp<IBinder>& service, bool allowIsolated, int32_t dumpPriority) { int32_t dumpPriority) { return mTheRealServiceManager->addService(name, service, allowIsolated, dumpPriority); Status status = mTheRealServiceManager->addService(name, service, allowIsolated, dumpPriority); // mEnableAddServiceCache is true by default. if (kUseCacheInAddService && mEnableAddServiceCache && status.isOk()) { return updateCache(name, service); } return status; } } Status BackendUnifiedServiceManager::listServices(int32_t dumpPriority, Status BackendUnifiedServiceManager::listServices(int32_t dumpPriority, ::std::vector<::std::string>* _aidl_return) { ::std::vector<::std::string>* _aidl_return) { Loading Loading
cmds/dumpsys/tests/dumpsys_test.cpp +2 −0 Original line number Original line Diff line number Diff line Loading @@ -67,6 +67,8 @@ class ServiceManagerMock : public IServiceManager { MOCK_METHOD2(unregisterForNotifications, status_t(const String16&, MOCK_METHOD2(unregisterForNotifications, status_t(const String16&, const sp<LocalRegistrationCallback>&)); const sp<LocalRegistrationCallback>&)); MOCK_METHOD0(getServiceDebugInfo, std::vector<ServiceDebugInfo>()); MOCK_METHOD0(getServiceDebugInfo, std::vector<ServiceDebugInfo>()); MOCK_METHOD1(enableAddServiceCache, void(bool)); protected: protected: MOCK_METHOD0(onAsBinder, IBinder*()); MOCK_METHOD0(onAsBinder, IBinder*()); }; }; Loading
include/android/display_luts.h +3 −1 Original line number Original line Diff line number Diff line Loading @@ -43,6 +43,7 @@ typedef enum ADisplayLuts_Dimension ADisplayLuts_Dimension; enum ADisplayLuts_SamplingKey : int32_t { enum ADisplayLuts_SamplingKey : int32_t { ADISPLAYLUTS_SAMPLINGKEY_RGB = 0, ADISPLAYLUTS_SAMPLINGKEY_RGB = 0, ADISPLAYLUTS_SAMPLINGKEY_MAX_RGB = 1, ADISPLAYLUTS_SAMPLINGKEY_MAX_RGB = 1, ADISPLAYLUTS_SAMPLINGKEY_CIE_Y = 2, }; }; typedef enum ADisplayLuts_SamplingKey ADisplayLuts_SamplingKey; typedef enum ADisplayLuts_SamplingKey ADisplayLuts_SamplingKey; Loading Loading @@ -74,7 +75,8 @@ typedef struct ADisplayLuts ADisplayLuts; * @return a new \a ADisplayLutsEntry instance. * @return a new \a ADisplayLutsEntry instance. */ */ ADisplayLutsEntry* _Nonnull ADisplayLutsEntry_createEntry(float* _Nonnull buffer, ADisplayLutsEntry* _Nonnull ADisplayLutsEntry_createEntry(float* _Nonnull buffer, int32_t length, int32_t dimension, int32_t key) __INTRODUCED_IN(36); int32_t length, ADisplayLuts_Dimension dimension, ADisplayLuts_SamplingKey key) __INTRODUCED_IN(36); /** /** * Destroy the \a ADisplayLutsEntry instance. * Destroy the \a ADisplayLutsEntry instance. Loading
include/private/display_luts_private.h +3 −2 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ #pragma once #pragma once #include <android/display_luts.h> #include <stdint.h> #include <stdint.h> #include <vector> #include <vector> #include <utils/RefBase.h> #include <utils/RefBase.h> Loading @@ -29,9 +30,9 @@ struct ADisplayLutsEntry_buffer { }; }; struct ADisplayLutsEntry_properties { struct ADisplayLutsEntry_properties { int32_t dimension; ADisplayLuts_Dimension dimension; int32_t size; int32_t size; int32_t samplingKey; ADisplayLuts_SamplingKey samplingKey; }; }; struct ADisplayLutsEntry: public RefBase { struct ADisplayLutsEntry: public RefBase { Loading
libs/binder/Android.bp +26 −1 Original line number Original line Diff line number Diff line Loading @@ -477,9 +477,34 @@ libbinder_client_cache_config { }, }, } } soong_config_module_type { name: "libbinder_addservice_cache_config", module_type: "cc_defaults", config_namespace: "libbinder", bool_variables: ["release_libbinder_addservice_cache"], properties: [ "cflags", ], } libbinder_addservice_cache_config { name: "libbinder_addservice_cache_flag", soong_config_variables: { release_libbinder_addservice_cache: { cflags: ["-DLIBBINDER_ADDSERVICE_CACHE"], conditions_default: { cflags: ["-DNO_LIBBINDER_ADDSERVICE_CACHE"], }, }, }, } cc_defaults { cc_defaults { name: "libbinder_kernel_defaults", name: "libbinder_kernel_defaults", defaults: ["libbinder_client_cache_flag"], defaults: [ "libbinder_client_cache_flag", "libbinder_addservice_cache_flag", ], srcs: [ srcs: [ "BufferedTextOutput.cpp", "BufferedTextOutput.cpp", "BackendUnifiedServiceManager.cpp", "BackendUnifiedServiceManager.cpp", Loading
libs/binder/BackendUnifiedServiceManager.cpp +37 −21 Original line number Original line Diff line number Diff line Loading @@ -30,6 +30,12 @@ constexpr bool kUseCache = true; constexpr bool kUseCache = false; constexpr bool kUseCache = false; #endif #endif #ifdef LIBBINDER_ADDSERVICE_CACHE constexpr bool kUseCacheInAddService = true; #else constexpr bool kUseCacheInAddService = false; #endif using AidlServiceManager = android::os::IServiceManager; using AidlServiceManager = android::os::IServiceManager; using android::os::IAccessor; using android::os::IAccessor; using binder::Status; using binder::Status; Loading Loading @@ -125,14 +131,20 @@ Status BackendUnifiedServiceManager::updateCache(const std::string& serviceName, if (!kUseCache) { if (!kUseCache) { return Status::ok(); return Status::ok(); } } if (service.getTag() == os::Service::Tag::binder) { return updateCache(serviceName, service.get<os::Service::Tag::binder>()); } return Status::ok(); } Status BackendUnifiedServiceManager::updateCache(const std::string& serviceName, const sp<IBinder>& binder) { std::string traceStr; std::string traceStr; if (atrace_is_tag_enabled(ATRACE_TAG_AIDL)) { if (atrace_is_tag_enabled(ATRACE_TAG_AIDL)) { traceStr = "BinderCacheWithInvalidation::updateCache : " + serviceName; traceStr = "BinderCacheWithInvalidation::updateCache : " + serviceName; } } binder::ScopedTrace aidlTrace(ATRACE_TAG_AIDL, traceStr.c_str()); binder::ScopedTrace aidlTrace(ATRACE_TAG_AIDL, traceStr.c_str()); if (service.getTag() == os::Service::Tag::binder) { sp<IBinder> binder = service.get<os::Service::Tag::binder>(); if (!binder) { if (!binder) { binder::ScopedTrace binder::ScopedTrace aidlTrace(ATRACE_TAG_AIDL, aidlTrace(ATRACE_TAG_AIDL, Loading @@ -150,7 +162,6 @@ Status BackendUnifiedServiceManager::updateCache(const std::string& serviceName, "BinderCacheWithInvalidation::updateCache failed: " "BinderCacheWithInvalidation::updateCache failed: " "caching_not_enabled"); "caching_not_enabled"); } } } return Status::ok(); return Status::ok(); } } Loading Loading @@ -277,7 +288,12 @@ Status BackendUnifiedServiceManager::toBinderService(const ::std::string& name, Status BackendUnifiedServiceManager::addService(const ::std::string& name, Status BackendUnifiedServiceManager::addService(const ::std::string& name, const sp<IBinder>& service, bool allowIsolated, const sp<IBinder>& service, bool allowIsolated, int32_t dumpPriority) { int32_t dumpPriority) { return mTheRealServiceManager->addService(name, service, allowIsolated, dumpPriority); Status status = mTheRealServiceManager->addService(name, service, allowIsolated, dumpPriority); // mEnableAddServiceCache is true by default. if (kUseCacheInAddService && mEnableAddServiceCache && status.isOk()) { return updateCache(name, service); } return status; } } Status BackendUnifiedServiceManager::listServices(int32_t dumpPriority, Status BackendUnifiedServiceManager::listServices(int32_t dumpPriority, ::std::vector<::std::string>* _aidl_return) { ::std::vector<::std::string>* _aidl_return) { Loading