diff options
author | John Reck <jreck@google.com> | 2018-03-16 17:27:17 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2018-03-16 17:34:02 -0700 |
commit | 564284759f014c141cb8b8403b036833f50f49ef (patch) | |
tree | 3bef3a4db7c34d3b62d54f746c5da6854b2c35a0 /libs/hwui/DeviceInfo.cpp | |
parent | 3912a7f54466f258c5b2597eebdb54cfe0f8281c (diff) |
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
Diffstat (limited to 'libs/hwui/DeviceInfo.cpp')
-rw-r--r-- | libs/hwui/DeviceInfo.cpp | 29 |
1 files changed, 25 insertions, 4 deletions
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 <DeviceInfo.h> +#include "Properties.h" + #include <gui/ISurfaceComposer.h> #include <gui/SurfaceComposerClient.h> @@ -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<IBinder> 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 */ |