blob: 8980a927768cc6700d27b1965cbcd497dea22631 [file] [log] [blame]
Alex Vakulenkoa8a92782017-01-27 14:41:57 -08001#include "display_service.h"
2
Hendrik Wagenaareaa55222017-04-06 10:56:23 -07003#include <unistd.h>
Corey Tabaka0b485c92017-05-19 12:02:58 -07004
5#include <algorithm>
6#include <sstream>
7#include <string>
Alex Vakulenkoa8a92782017-01-27 14:41:57 -08008#include <vector>
9
Hendrik Wagenaarbcb03d02017-05-23 14:59:08 -070010#include <android-base/file.h>
11#include <android-base/properties.h>
Corey Tabaka2251d822017-04-20 16:04:07 -070012#include <dvr/dvr_display_types.h>
Alex Vakulenkoa8a92782017-01-27 14:41:57 -080013#include <pdx/default_transport/service_endpoint.h>
14#include <pdx/rpc/remote_method.h>
Corey Tabaka99c2d732017-06-07 17:54:33 -070015#include <private/android_filesystem_config.h>
Corey Tabaka3f82d312017-04-20 14:42:08 -070016#include <private/dvr/display_protocol.h>
Alex Vakulenkoa8a92782017-01-27 14:41:57 -080017#include <private/dvr/numeric.h>
Corey Tabaka99c2d732017-06-07 17:54:33 -070018#include <private/dvr/trusted_uids.h>
Alex Vakulenkoa8a92782017-01-27 14:41:57 -080019#include <private/dvr/types.h>
20
Corey Tabaka2251d822017-04-20 16:04:07 -070021using android::dvr::display::DisplayProtocol;
Alex Vakulenkoa8a92782017-01-27 14:41:57 -080022using android::pdx::Channel;
Corey Tabaka2251d822017-04-20 16:04:07 -070023using android::pdx::ErrorStatus;
Alex Vakulenkoa8a92782017-01-27 14:41:57 -080024using android::pdx::Message;
Corey Tabaka2251d822017-04-20 16:04:07 -070025using android::pdx::Status;
Alex Vakulenkoa8a92782017-01-27 14:41:57 -080026using android::pdx::default_transport::Endpoint;
27using android::pdx::rpc::DispatchRemoteMethod;
Alex Vakulenkoa8a92782017-01-27 14:41:57 -080028
Hendrik Wagenaarbcb03d02017-05-23 14:59:08 -070029namespace {
30
31const char kDvrLensMetricsProperty[] = "ro.dvr.lens_metrics";
32const char kDvrDeviceMetricsProperty[] = "ro.dvr.device_metrics";
33const char kDvrDeviceConfigProperty[] = "ro.dvr.device_configuration";
34
35} // namespace
36
Alex Vakulenkoa8a92782017-01-27 14:41:57 -080037namespace android {
38namespace dvr {
39
Corey Tabaka2251d822017-04-20 16:04:07 -070040DisplayService::DisplayService(Hwc2::Composer* hidl,
Steven Thomas6e8f7062017-11-22 14:15:29 -080041 hwc2_display_t primary_display_id,
Corey Tabaka2251d822017-04-20 16:04:07 -070042 RequestDisplayCallback request_display_callback)
43 : BASE("DisplayService",
Steven Thomasd7f49c52017-07-26 18:48:28 -070044 Endpoint::Create(display::DisplayProtocol::kClientPath)) {
Steven Thomas6e8f7062017-11-22 14:15:29 -080045 hardware_composer_.Initialize(
46 hidl, primary_display_id, request_display_callback);
mamika08194b2019-07-25 13:07:21 -070047
48 uint8_t port;
49 const auto error = hidl->getDisplayIdentificationData(
50 primary_display_id, &port, &display_identification_data_);
51 if (error != android::hardware::graphics::composer::V2_1::Error::NONE) {
52 if (error !=
53 android::hardware::graphics::composer::V2_1::Error::UNSUPPORTED) {
54 ALOGI("DisplayService: identification data error\n");
55 } else {
56 ALOGI("DisplayService: identification data unsupported\n");
57 }
58 }
Stephen Kiazyk016e5e32017-02-21 17:09:22 -080059}
60
61bool DisplayService::IsInitialized() const {
62 return BASE::IsInitialized() && hardware_composer_.IsInitialized();
63}
Alex Vakulenkoa8a92782017-01-27 14:41:57 -080064
Corey Tabaka2251d822017-04-20 16:04:07 -070065std::string DisplayService::DumpState(size_t /*max_length*/) {
Corey Tabaka0b485c92017-05-19 12:02:58 -070066 std::ostringstream stream;
67
68 auto surfaces = GetDisplaySurfaces();
69 std::sort(surfaces.begin(), surfaces.end(), [](const auto& a, const auto& b) {
70 return a->surface_id() < b->surface_id();
71 });
72
73 stream << "Application Surfaces:" << std::endl;
74
75 size_t count = 0;
76 for (const auto& surface : surfaces) {
77 if (surface->surface_type() == SurfaceType::Application) {
78 stream << "Surface " << count++ << ":";
79 stream << " surface_id=" << surface->surface_id()
80 << " process_id=" << surface->process_id()
81 << " user_id=" << surface->user_id()
82 << " visible=" << surface->visible()
83 << " z_order=" << surface->z_order();
84
85 stream << " queue_ids=";
86 auto queue_ids = surface->GetQueueIds();
87 std::sort(queue_ids.begin(), queue_ids.end());
88 for (int32_t id : queue_ids) {
89 if (id != queue_ids[0])
90 stream << ",";
91 stream << id;
92 }
93 stream << std::endl;
94 }
95 }
96 stream << std::endl;
97
98 stream << "Direct Surfaces:" << std::endl;
99
100 count = 0;
101 for (const auto& surface : surfaces) {
102 if (surface->surface_type() == SurfaceType::Direct) {
103 stream << "Surface " << count++ << ":";
104 stream << " surface_id=" << surface->surface_id()
105 << " process_id=" << surface->process_id()
106 << " user_id=" << surface->user_id()
107 << " visible=" << surface->visible()
108 << " z_order=" << surface->z_order();
109
110 stream << " queue_ids=";
111 auto queue_ids = surface->GetQueueIds();
112 std::sort(queue_ids.begin(), queue_ids.end());
113 for (int32_t id : queue_ids) {
114 if (id != queue_ids[0])
115 stream << ",";
116 stream << id;
117 }
118 stream << std::endl;
119 }
120 }
121 stream << std::endl;
122
123 stream << hardware_composer_.Dump();
124 return stream.str();
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800125}
126
Corey Tabaka2251d822017-04-20 16:04:07 -0700127void DisplayService::OnChannelClose(pdx::Message& message,
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800128 const std::shared_ptr<Channel>& channel) {
Corey Tabaka2251d822017-04-20 16:04:07 -0700129 if (auto surface = std::static_pointer_cast<DisplaySurface>(channel)) {
130 surface->OnSetAttributes(message,
131 {{display::SurfaceAttribute::Visible,
132 display::SurfaceAttributeValue{false}}});
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800133 }
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800134}
135
136// First-level dispatch for display service messages. Directly handles messages
137// that are independent of the display surface (metrics, creation) and routes
138// surface-specific messages to the per-instance handlers.
Corey Tabaka2251d822017-04-20 16:04:07 -0700139Status<void> DisplayService::HandleMessage(pdx::Message& message) {
140 ALOGD_IF(TRACE, "DisplayService::HandleMessage: opcode=%d", message.GetOp());
Corey Tabakab3732f02017-09-16 00:58:54 -0700141 ATRACE_NAME("DisplayService::HandleMessage");
142
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800143 switch (message.GetOp()) {
Corey Tabaka2251d822017-04-20 16:04:07 -0700144 case DisplayProtocol::GetMetrics::Opcode:
145 DispatchRemoteMethod<DisplayProtocol::GetMetrics>(
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800146 *this, &DisplayService::OnGetMetrics, message);
Alex Vakulenkof0a7bd02017-03-31 18:06:19 -0700147 return {};
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800148
Hendrik Wagenaarbcb03d02017-05-23 14:59:08 -0700149 case DisplayProtocol::GetConfigurationData::Opcode:
150 DispatchRemoteMethod<DisplayProtocol::GetConfigurationData>(
151 *this, &DisplayService::OnGetConfigurationData, message);
152 return {};
153
Corey Tabaka2251d822017-04-20 16:04:07 -0700154 case DisplayProtocol::CreateSurface::Opcode:
155 DispatchRemoteMethod<DisplayProtocol::CreateSurface>(
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800156 *this, &DisplayService::OnCreateSurface, message);
Alex Vakulenkof0a7bd02017-03-31 18:06:19 -0700157 return {};
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800158
Corey Tabaka99c2d732017-06-07 17:54:33 -0700159 case DisplayProtocol::SetupGlobalBuffer::Opcode:
160 DispatchRemoteMethod<DisplayProtocol::SetupGlobalBuffer>(
161 *this, &DisplayService::OnSetupGlobalBuffer, message);
162 return {};
163
164 case DisplayProtocol::DeleteGlobalBuffer::Opcode:
165 DispatchRemoteMethod<DisplayProtocol::DeleteGlobalBuffer>(
166 *this, &DisplayService::OnDeleteGlobalBuffer, message);
167 return {};
168
Okan Arikan36d23802017-05-15 15:20:39 -0700169 case DisplayProtocol::GetGlobalBuffer::Opcode:
170 DispatchRemoteMethod<DisplayProtocol::GetGlobalBuffer>(
171 *this, &DisplayService::OnGetGlobalBuffer, message);
Alex Vakulenkof0a7bd02017-03-31 18:06:19 -0700172 return {};
Hendrik Wagenaar10e68eb2017-03-15 13:29:02 -0700173
Corey Tabaka2251d822017-04-20 16:04:07 -0700174 case DisplayProtocol::IsVrAppRunning::Opcode:
175 DispatchRemoteMethod<DisplayProtocol::IsVrAppRunning>(
Albert Chaulkb7c8a4b2017-03-20 13:03:39 -0400176 *this, &DisplayService::IsVrAppRunning, message);
Alex Vakulenkof0a7bd02017-03-31 18:06:19 -0700177 return {};
Albert Chaulkb7c8a4b2017-03-20 13:03:39 -0400178
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800179 // Direct the surface specific messages to the surface instance.
Corey Tabaka2251d822017-04-20 16:04:07 -0700180 case DisplayProtocol::SetAttributes::Opcode:
181 case DisplayProtocol::CreateQueue::Opcode:
182 case DisplayProtocol::GetSurfaceInfo::Opcode:
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800183 return HandleSurfaceMessage(message);
184
185 default:
186 return Service::HandleMessage(message);
187 }
188}
189
Corey Tabaka2251d822017-04-20 16:04:07 -0700190Status<display::Metrics> DisplayService::OnGetMetrics(
191 pdx::Message& /*message*/) {
Steven Thomasbfe46a02018-02-16 14:27:35 -0800192 const auto& params = hardware_composer_.GetPrimaryDisplayParams();
193 return {{static_cast<uint32_t>(params.width),
194 static_cast<uint32_t>(params.height),
195 static_cast<uint32_t>(params.dpi.x),
196 static_cast<uint32_t>(params.dpi.y),
197 static_cast<uint32_t>(params.vsync_period_ns),
Corey Tabaka2251d822017-04-20 16:04:07 -0700198 0,
199 0,
200 0,
201 0.0,
202 {},
203 {}}};
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800204}
205
Hendrik Wagenaarbcb03d02017-05-23 14:59:08 -0700206pdx::Status<std::string> DisplayService::OnGetConfigurationData(
207 pdx::Message& /*message*/, display::ConfigFileType config_type) {
208 std::string property_name;
209 switch (config_type) {
210 case display::ConfigFileType::kLensMetrics:
211 property_name = kDvrLensMetricsProperty;
212 break;
213 case display::ConfigFileType::kDeviceMetrics:
214 property_name = kDvrDeviceMetricsProperty;
215 break;
216 case display::ConfigFileType::kDeviceConfiguration:
217 property_name = kDvrDeviceConfigProperty;
218 break;
mamika08194b2019-07-25 13:07:21 -0700219 case display::ConfigFileType::kDeviceEdid:
220 if (display_identification_data_.size() == 0) {
221 return ErrorStatus(ENOENT);
222 }
223 return std::string(display_identification_data_.begin(),
224 display_identification_data_.end());
Hendrik Wagenaarbcb03d02017-05-23 14:59:08 -0700225 default:
226 return ErrorStatus(EINVAL);
227 }
228 std::string file_path = base::GetProperty(property_name, "");
229 if (file_path.empty()) {
230 return ErrorStatus(ENOENT);
231 }
232
233 std::string data;
234 if (!base::ReadFileToString(file_path, &data)) {
235 return ErrorStatus(errno);
236 }
237
238 return std::move(data);
239}
240
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800241// Creates a new DisplaySurface and associates it with this channel. This may
242// only be done once per channel.
Corey Tabaka2251d822017-04-20 16:04:07 -0700243Status<display::SurfaceInfo> DisplayService::OnCreateSurface(
244 pdx::Message& message, const display::SurfaceAttributes& attributes) {
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800245 // A surface may only be created once per channel.
246 if (message.GetChannel())
Corey Tabaka2251d822017-04-20 16:04:07 -0700247 return ErrorStatus(EINVAL);
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800248
249 ALOGI_IF(TRACE, "DisplayService::OnCreateSurface: cid=%d",
250 message.GetChannelId());
251
252 // Use the channel id as the unique surface id.
253 const int surface_id = message.GetChannelId();
254 const int process_id = message.GetProcessId();
Corey Tabaka2251d822017-04-20 16:04:07 -0700255 const int user_id = message.GetEffectiveUserId();
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800256
257 ALOGI_IF(TRACE,
Corey Tabaka2251d822017-04-20 16:04:07 -0700258 "DisplayService::OnCreateSurface: surface_id=%d process_id=%d",
259 surface_id, process_id);
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800260
Corey Tabaka2251d822017-04-20 16:04:07 -0700261 auto surface_status =
262 DisplaySurface::Create(this, surface_id, process_id, user_id, attributes);
263 if (!surface_status) {
264 ALOGE("DisplayService::OnCreateSurface: Failed to create surface: %s",
265 surface_status.GetErrorMessage().c_str());
266 return ErrorStatus(surface_status.error());
267 }
Corey Tabaka00d9bb32017-08-16 19:59:48 -0700268 auto surface = surface_status.take();
269 message.SetChannel(surface);
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800270
Corey Tabaka00d9bb32017-08-16 19:59:48 -0700271 // Update the surface with the attributes supplied with the create call. For
272 // application surfaces this has the side effect of notifying the display
273 // manager of the new surface. For direct surfaces, this may trigger a mode
274 // change, depending on the value of the visible attribute.
275 surface->OnSetAttributes(message, attributes);
Corey Tabaka2251d822017-04-20 16:04:07 -0700276
Corey Tabaka00d9bb32017-08-16 19:59:48 -0700277 return {{surface->surface_id(), surface->visible(), surface->z_order()}};
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800278}
279
Corey Tabaka2251d822017-04-20 16:04:07 -0700280void DisplayService::SurfaceUpdated(SurfaceType surface_type,
281 display::SurfaceUpdateFlags update_flags) {
282 ALOGD_IF(TRACE, "DisplayService::SurfaceUpdated: update_flags=%x",
283 update_flags.value());
284 if (update_flags.value() != 0) {
285 if (surface_type == SurfaceType::Application)
286 NotifyDisplayConfigurationUpdate();
287 else
288 UpdateActiveDisplaySurfaces();
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800289 }
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800290}
291
Corey Tabaka99c2d732017-06-07 17:54:33 -0700292pdx::Status<BorrowedNativeBufferHandle> DisplayService::OnSetupGlobalBuffer(
293 pdx::Message& message, DvrGlobalBufferKey key, size_t size,
294 uint64_t usage) {
295 const int user_id = message.GetEffectiveUserId();
296 const bool trusted = user_id == AID_ROOT || IsTrustedUid(user_id);
297
298 if (!trusted) {
299 ALOGE(
300 "DisplayService::OnSetupGlobalBuffer: Permission denied for user_id=%d",
301 user_id);
302 return ErrorStatus(EPERM);
303 }
304 return SetupGlobalBuffer(key, size, usage);
305}
306
307pdx::Status<void> DisplayService::OnDeleteGlobalBuffer(pdx::Message& message,
308 DvrGlobalBufferKey key) {
309 const int user_id = message.GetEffectiveUserId();
310 const bool trusted = (user_id == AID_ROOT) || IsTrustedUid(user_id);
311
312 if (!trusted) {
313 ALOGE(
314 "DisplayService::OnDeleteGlobalBuffer: Permission denied for "
315 "user_id=%d",
316 user_id);
317 return ErrorStatus(EPERM);
318 }
319 return DeleteGlobalBuffer(key);
320}
321
Okan Arikan36d23802017-05-15 15:20:39 -0700322pdx::Status<BorrowedNativeBufferHandle> DisplayService::OnGetGlobalBuffer(
323 pdx::Message& /* message */, DvrGlobalBufferKey key) {
324 ALOGD_IF(TRACE, "DisplayService::OnGetGlobalBuffer: key=%d", key);
325 auto global_buffer = global_buffers_.find(key);
326 if (global_buffer != global_buffers_.end())
327 return {BorrowedNativeBufferHandle(*global_buffer->second, 0)};
Corey Tabaka2251d822017-04-20 16:04:07 -0700328 else
329 return pdx::ErrorStatus(EINVAL);
Hendrik Wagenaar10e68eb2017-03-15 13:29:02 -0700330}
331
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800332// Calls the message handler for the DisplaySurface associated with this
333// channel.
Corey Tabaka2251d822017-04-20 16:04:07 -0700334Status<void> DisplayService::HandleSurfaceMessage(pdx::Message& message) {
335 auto surface = std::static_pointer_cast<DisplaySurface>(message.GetChannel());
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800336 ALOGW_IF(!surface,
337 "DisplayService::HandleSurfaceMessage: surface is nullptr!");
338
339 if (surface)
340 return surface->HandleMessage(message);
341 else
Corey Tabaka2251d822017-04-20 16:04:07 -0700342 return ErrorStatus(EINVAL);
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800343}
344
345std::shared_ptr<DisplaySurface> DisplayService::GetDisplaySurface(
346 int surface_id) const {
347 return std::static_pointer_cast<DisplaySurface>(GetChannel(surface_id));
348}
349
350std::vector<std::shared_ptr<DisplaySurface>>
351DisplayService::GetDisplaySurfaces() const {
352 return GetChannels<DisplaySurface>();
353}
354
Corey Tabaka2251d822017-04-20 16:04:07 -0700355std::vector<std::shared_ptr<DirectDisplaySurface>>
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800356DisplayService::GetVisibleDisplaySurfaces() const {
Corey Tabaka2251d822017-04-20 16:04:07 -0700357 std::vector<std::shared_ptr<DirectDisplaySurface>> visible_surfaces;
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800358
359 ForEachDisplaySurface(
Corey Tabaka2251d822017-04-20 16:04:07 -0700360 SurfaceType::Direct,
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800361 [&](const std::shared_ptr<DisplaySurface>& surface) mutable {
Corey Tabaka2251d822017-04-20 16:04:07 -0700362 if (surface->visible()) {
363 visible_surfaces.push_back(
364 std::static_pointer_cast<DirectDisplaySurface>(surface));
365 surface->ClearUpdate();
366 }
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800367 });
368
369 return visible_surfaces;
370}
371
Steven Thomas050b2c82017-03-06 11:45:16 -0800372void DisplayService::UpdateActiveDisplaySurfaces() {
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800373 auto visible_surfaces = GetVisibleDisplaySurfaces();
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800374 ALOGD_IF(TRACE,
375 "DisplayService::UpdateActiveDisplaySurfaces: %zd visible surfaces",
376 visible_surfaces.size());
Steven Thomas050b2c82017-03-06 11:45:16 -0800377 hardware_composer_.SetDisplaySurfaces(std::move(visible_surfaces));
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800378}
379
Okan Arikan36d23802017-05-15 15:20:39 -0700380pdx::Status<BorrowedNativeBufferHandle> DisplayService::SetupGlobalBuffer(
381 DvrGlobalBufferKey key, size_t size, uint64_t usage) {
382 auto global_buffer = global_buffers_.find(key);
383 if (global_buffer == global_buffers_.end()) {
Jiwen 'Steve' Cai0057fdd2017-05-02 11:21:18 -0700384 auto ion_buffer = std::make_unique<IonBuffer>(static_cast<int>(size), 1,
385 HAL_PIXEL_FORMAT_BLOB, usage);
John Bates954796e2017-05-11 11:00:31 -0700386
387 // Some buffers are used internally. If they were configured with an
388 // invalid size or format, this will fail.
389 int result = hardware_composer_.OnNewGlobalBuffer(key, *ion_buffer.get());
390 if (result < 0)
391 return ErrorStatus(result);
Okan Arikan36d23802017-05-15 15:20:39 -0700392 global_buffer =
393 global_buffers_.insert(std::make_pair(key, std::move(ion_buffer)))
Hendrik Wagenaareaa55222017-04-06 10:56:23 -0700394 .first;
Hendrik Wagenaar10e68eb2017-03-15 13:29:02 -0700395 }
396
Okan Arikan36d23802017-05-15 15:20:39 -0700397 return {BorrowedNativeBufferHandle(*global_buffer->second, 0)};
Hendrik Wagenaar10e68eb2017-03-15 13:29:02 -0700398}
399
John Bates954796e2017-05-11 11:00:31 -0700400pdx::Status<void> DisplayService::DeleteGlobalBuffer(DvrGlobalBufferKey key) {
401 auto global_buffer = global_buffers_.find(key);
402 if (global_buffer != global_buffers_.end()) {
403 // Some buffers are used internally.
404 hardware_composer_.OnDeletedGlobalBuffer(key);
405 global_buffers_.erase(global_buffer);
406 }
407
408 return {0};
409}
410
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800411void DisplayService::SetDisplayConfigurationUpdateNotifier(
412 DisplayConfigurationUpdateNotifier update_notifier) {
413 update_notifier_ = update_notifier;
414}
415
416void DisplayService::NotifyDisplayConfigurationUpdate() {
417 if (update_notifier_)
418 update_notifier_();
419}
420
Corey Tabaka2251d822017-04-20 16:04:07 -0700421Status<bool> DisplayService::IsVrAppRunning(pdx::Message& /*message*/) {
Albert Chaulk356bc372017-04-05 18:01:58 -0400422 bool visible = false;
Hendrik Wagenaareaa55222017-04-06 10:56:23 -0700423 ForEachDisplaySurface(
Corey Tabaka2251d822017-04-20 16:04:07 -0700424 SurfaceType::Application,
Hendrik Wagenaareaa55222017-04-06 10:56:23 -0700425 [&visible](const std::shared_ptr<DisplaySurface>& surface) {
Corey Tabaka2251d822017-04-20 16:04:07 -0700426 if (surface->visible())
Hendrik Wagenaareaa55222017-04-06 10:56:23 -0700427 visible = true;
428 });
Albert Chaulkb7c8a4b2017-03-20 13:03:39 -0400429
Corey Tabaka2251d822017-04-20 16:04:07 -0700430 return {visible};
Albert Chaulkb7c8a4b2017-03-20 13:03:39 -0400431}
432
Alex Vakulenkoa8a92782017-01-27 14:41:57 -0800433} // namespace dvr
434} // namespace android