From 564284759f014c141cb8b8403b036833f50f49ef Mon Sep 17 00:00:00 2001 From: John Reck Date: Fri, 16 Mar 2018 17:27:17 -0700 Subject: Don't use IPC in isolateProcess Fixes: 74395652 Test: hwuiunit passes in 'shell stop' state (pseudo-isolated process), manually checked non-isolated processes still have working vsync via systrace of RT animations demo Change-Id: I630ea011dc7eb2efa265b25673d3304b3b2510d3 --- libs/hwui/DeviceInfo.cpp | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'libs/hwui/DeviceInfo.cpp') diff --git a/libs/hwui/DeviceInfo.cpp b/libs/hwui/DeviceInfo.cpp index e4162875279c..40cc73a82846 100644 --- a/libs/hwui/DeviceInfo.cpp +++ b/libs/hwui/DeviceInfo.cpp @@ -16,6 +16,8 @@ #include +#include "Properties.h" + #include #include @@ -29,6 +31,19 @@ namespace android { namespace uirenderer { +static constexpr android::DisplayInfo sDummyDisplay { + 1080, // w + 1920, // h + 320.0, // xdpi + 320.0, // ydpi + 60.0, // fps + 2.0, // density + 0, // orientation + false, // secure? + 0, // appVsyncOffset + 0, // presentationDeadline +}; + static DeviceInfo* sDeviceInfo = nullptr; static std::once_flag sInitializedFlag; @@ -47,20 +62,26 @@ void DeviceInfo::initialize() { void DeviceInfo::initialize(int maxTextureSize) { std::call_once(sInitializedFlag, [maxTextureSize]() { sDeviceInfo = new DeviceInfo(); - sDeviceInfo->loadDisplayInfo(); + sDeviceInfo->mDisplayInfo = DeviceInfo::queryDisplayInfo(); sDeviceInfo->mMaxTextureSize = maxTextureSize; }); } void DeviceInfo::load() { - loadDisplayInfo(); + mDisplayInfo = queryDisplayInfo(); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize); } -void DeviceInfo::loadDisplayInfo() { +DisplayInfo DeviceInfo::queryDisplayInfo() { + if (Properties::isolatedProcess) { + return sDummyDisplay; + } + + DisplayInfo displayInfo; sp dtoken(SurfaceComposerClient::getBuiltInDisplay(ISurfaceComposer::eDisplayIdMain)); - status_t status = SurfaceComposerClient::getDisplayInfo(dtoken, &mDisplayInfo); + status_t status = SurfaceComposerClient::getDisplayInfo(dtoken, &displayInfo); LOG_ALWAYS_FATAL_IF(status, "Failed to get display info, error %d", status); + return displayInfo; } } /* namespace uirenderer */ -- cgit v1.2.3-59-g8ed1b