summaryrefslogtreecommitdiff
path: root/native/android/surface_control.cpp
diff options
context:
space:
mode:
authorDominik Laskowski <domlaskowski@google.com>2019-02-06 22:46:09 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-02-06 22:46:09 +0000
commit9e7dce383317d29659d5652c6f12b034345fdc29 (patch)
tree4eb4d3eb9b67d7165f286067820782b90d04494d /native/android/surface_control.cpp
parent300cdfcd1b8cd46e469d56d9d76961a60be4d1ba (diff)
parent3316a0a08e79739b0508087232efcb3f2803dafe (diff)
Merge "Generalize physical display management"
Diffstat (limited to 'native/android/surface_control.cpp')
-rw-r--r--native/android/surface_control.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/native/android/surface_control.cpp b/native/android/surface_control.cpp
index 416ef42d21a7..7d2934b8554e 100644
--- a/native/android/surface_control.cpp
+++ b/native/android/surface_control.cpp
@@ -46,7 +46,13 @@ using Transaction = SurfaceComposerClient::Transaction;
static bool getWideColorSupport(const sp<SurfaceControl>& surfaceControl) {
sp<SurfaceComposerClient> client = surfaceControl->getClient();
- sp<IBinder> display(client->getBuiltInDisplay(ISurfaceComposer::eDisplayIdMain));
+
+ const sp<IBinder> display = client->getInternalDisplayToken();
+ if (display == nullptr) {
+ ALOGE("unable to get wide color support for disconnected internal display");
+ return false;
+ }
+
bool isWideColorDisplay = false;
status_t err = client->isWideColorDisplay(display, &isWideColorDisplay);
if (err) {
@@ -58,7 +64,12 @@ static bool getWideColorSupport(const sp<SurfaceControl>& surfaceControl) {
static bool getHdrSupport(const sp<SurfaceControl>& surfaceControl) {
sp<SurfaceComposerClient> client = surfaceControl->getClient();
- sp<IBinder> display(client->getBuiltInDisplay(ISurfaceComposer::eDisplayIdMain));
+
+ const sp<IBinder> display = client->getInternalDisplayToken();
+ if (display == nullptr) {
+ ALOGE("unable to get hdr capabilities for disconnected internal display");
+ return false;
+ }
HdrCapabilities hdrCapabilities;
status_t err = client->getHdrCapabilities(display, &hdrCapabilities);