From 75ca86f072f82d38b21e0a13234ecbc2c24cb6ab Mon Sep 17 00:00:00 2001 From: Jesse Hall Date: Wed, 7 Jun 2017 14:44:46 -0700 Subject: libui: Load a.h.graphics.mapper passthrough service on library load Zygote loads libui, this helps complete the chain from zygote -> libui -> a.h.graphics.mapper -> gralloc so that all of these libraries which are used by nearly every app are loaded by zygote and shared. Bug: 62353585 Test: boot to launcher, run calculator, confirm a.h.graphics.mapper implementation library is in /proc/`pid zygote64`/maps Change-Id: Ib505c926a410191e3e2ad809bfe98a73b21fac90 --- libs/ui/Gralloc2.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'libs/ui/Gralloc2.cpp') diff --git a/libs/ui/Gralloc2.cpp b/libs/ui/Gralloc2.cpp index 87dbaf47d3..e149803004 100644 --- a/libs/ui/Gralloc2.cpp +++ b/libs/ui/Gralloc2.cpp @@ -16,6 +16,7 @@ #define LOG_TAG "Gralloc2" +#include #include #include @@ -250,4 +251,17 @@ Error Allocator::allocate(BufferDescriptor descriptor, uint32_t count, } // namespace Gralloc2 +namespace { +// Load the IMapper implementation library when this shared library is loaded, rather than when +// we (lazily) create the Gralloc2::Mapper instance. Since these libraries will all be needed by +// nearly all apps, this allows us to load them in Zygote rather than on each app launch. +class PreloadMapperImpl { +public: + PreloadMapperImpl() { + android::hardware::preloadPassthroughService(); + } +}; +static PreloadMapperImpl preloadMapperImpl; +} // namespace + } // namespace android -- cgit v1.2.3-59-g8ed1b