From 8e09730244a3fb935d5fdae94c572bb3946c5c6e Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Mon, 8 Jul 2019 16:11:12 -0700 Subject: GpuStats: Cache the gpu service binder Cache the gpu service binder in the app process so that sending stats pieces won't try to find gpu service every time. If gpu service accidentally restarts, just ignore the later stats from the app, since the memory that holds GpuStats for that app is gone already during the gpu service restart. Test: systrace while try killing gpu service Change-Id: Ib9c38a3592f509f18d146b6c6e8f14e9e997c994 --- libs/graphicsenv/GraphicsEnv.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libs/graphicsenv/GraphicsEnv.cpp') diff --git a/libs/graphicsenv/GraphicsEnv.cpp b/libs/graphicsenv/GraphicsEnv.cpp index a411dd56f6..1eedac111a 100644 --- a/libs/graphicsenv/GraphicsEnv.cpp +++ b/libs/graphicsenv/GraphicsEnv.cpp @@ -258,7 +258,7 @@ void GraphicsEnv::setDriverLoaded(GpuStatsInfo::Api api, bool isDriverLoaded, } static sp getGpuService() { - const sp binder = defaultServiceManager()->checkService(String16("gpu")); + static const sp binder = defaultServiceManager()->checkService(String16("gpu")); if (!binder) { ALOGE("Failed to get gpu service"); return nullptr; -- cgit v1.2.3-59-g8ed1b