| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 1 | #include "display_service.h" | 
|  | 2 |  | 
| Hendrik Wagenaar | eaa5522 | 2017-04-06 10:56:23 -0700 | [diff] [blame] | 3 | #include <unistd.h> | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 4 | #include <vector> | 
|  | 5 |  | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 6 | #include <dvr/dvr_display_types.h> | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 7 | #include <pdx/default_transport/service_endpoint.h> | 
|  | 8 | #include <pdx/rpc/remote_method.h> | 
| Corey Tabaka | 3f82d31 | 2017-04-20 14:42:08 -0700 | [diff] [blame] | 9 | #include <private/dvr/display_protocol.h> | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 10 | #include <private/dvr/numeric.h> | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 11 | #include <private/dvr/types.h> | 
|  | 12 |  | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 13 | using android::dvr::display::DisplayProtocol; | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 14 | using android::pdx::Channel; | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 15 | using android::pdx::ErrorStatus; | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 16 | using android::pdx::Message; | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 17 | using android::pdx::Status; | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 18 | using android::pdx::default_transport::Endpoint; | 
|  | 19 | using android::pdx::rpc::DispatchRemoteMethod; | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 20 |  | 
|  | 21 | namespace android { | 
|  | 22 | namespace dvr { | 
|  | 23 |  | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 24 | DisplayService::DisplayService(Hwc2::Composer* hidl, | 
|  | 25 | RequestDisplayCallback request_display_callback) | 
|  | 26 | : BASE("DisplayService", | 
|  | 27 | Endpoint::Create(display::DisplayProtocol::kClientPath)), | 
|  | 28 | hardware_composer_(hidl, request_display_callback), | 
|  | 29 | request_display_callback_(request_display_callback) { | 
| Stephen Kiazyk | 016e5e3 | 2017-02-21 17:09:22 -0800 | [diff] [blame] | 30 | hardware_composer_.Initialize(); | 
|  | 31 | } | 
|  | 32 |  | 
|  | 33 | bool DisplayService::IsInitialized() const { | 
|  | 34 | return BASE::IsInitialized() && hardware_composer_.IsInitialized(); | 
|  | 35 | } | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 36 |  | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 37 | std::string DisplayService::DumpState(size_t /*max_length*/) { | 
|  | 38 | return hardware_composer_.Dump(); | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 39 | } | 
|  | 40 |  | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 41 | void DisplayService::OnChannelClose(pdx::Message& message, | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 42 | const std::shared_ptr<Channel>& channel) { | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 43 | if (auto surface = std::static_pointer_cast<DisplaySurface>(channel)) { | 
|  | 44 | surface->OnSetAttributes(message, | 
|  | 45 | {{display::SurfaceAttribute::Visible, | 
|  | 46 | display::SurfaceAttributeValue{false}}}); | 
|  | 47 | SurfaceUpdated(surface->surface_type(), | 
|  | 48 | display::SurfaceUpdateFlags::VisibilityChanged); | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 49 | } | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 50 | } | 
|  | 51 |  | 
|  | 52 | // First-level dispatch for display service messages. Directly handles messages | 
|  | 53 | // that are independent of the display surface (metrics, creation) and routes | 
|  | 54 | // surface-specific messages to the per-instance handlers. | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 55 | Status<void> DisplayService::HandleMessage(pdx::Message& message) { | 
|  | 56 | ALOGD_IF(TRACE, "DisplayService::HandleMessage: opcode=%d", message.GetOp()); | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 57 | switch (message.GetOp()) { | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 58 | case DisplayProtocol::GetMetrics::Opcode: | 
|  | 59 | DispatchRemoteMethod<DisplayProtocol::GetMetrics>( | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 60 | *this, &DisplayService::OnGetMetrics, message); | 
| Alex Vakulenko | f0a7bd0 | 2017-03-31 18:06:19 -0700 | [diff] [blame] | 61 | return {}; | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 62 |  | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 63 | case DisplayProtocol::CreateSurface::Opcode: | 
|  | 64 | DispatchRemoteMethod<DisplayProtocol::CreateSurface>( | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 65 | *this, &DisplayService::OnCreateSurface, message); | 
| Alex Vakulenko | f0a7bd0 | 2017-03-31 18:06:19 -0700 | [diff] [blame] | 66 | return {}; | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 67 |  | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 68 | case DisplayProtocol::GetNamedBuffer::Opcode: | 
|  | 69 | DispatchRemoteMethod<DisplayProtocol::GetNamedBuffer>( | 
| Hendrik Wagenaar | eaa5522 | 2017-04-06 10:56:23 -0700 | [diff] [blame] | 70 | *this, &DisplayService::OnGetNamedBuffer, message); | 
| Alex Vakulenko | f0a7bd0 | 2017-03-31 18:06:19 -0700 | [diff] [blame] | 71 | return {}; | 
| Hendrik Wagenaar | 10e68eb | 2017-03-15 13:29:02 -0700 | [diff] [blame] | 72 |  | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 73 | case DisplayProtocol::IsVrAppRunning::Opcode: | 
|  | 74 | DispatchRemoteMethod<DisplayProtocol::IsVrAppRunning>( | 
| Albert Chaulk | b7c8a4b | 2017-03-20 13:03:39 -0400 | [diff] [blame] | 75 | *this, &DisplayService::IsVrAppRunning, message); | 
| Alex Vakulenko | f0a7bd0 | 2017-03-31 18:06:19 -0700 | [diff] [blame] | 76 | return {}; | 
| Albert Chaulk | b7c8a4b | 2017-03-20 13:03:39 -0400 | [diff] [blame] | 77 |  | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 78 | // Direct the surface specific messages to the surface instance. | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 79 | case DisplayProtocol::SetAttributes::Opcode: | 
|  | 80 | case DisplayProtocol::CreateQueue::Opcode: | 
|  | 81 | case DisplayProtocol::GetSurfaceInfo::Opcode: | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 82 | return HandleSurfaceMessage(message); | 
|  | 83 |  | 
|  | 84 | default: | 
|  | 85 | return Service::HandleMessage(message); | 
|  | 86 | } | 
|  | 87 | } | 
|  | 88 |  | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 89 | Status<display::Metrics> DisplayService::OnGetMetrics( | 
|  | 90 | pdx::Message& /*message*/) { | 
|  | 91 | return {{static_cast<uint32_t>(GetDisplayMetrics().width), | 
|  | 92 | static_cast<uint32_t>(GetDisplayMetrics().height), | 
|  | 93 | static_cast<uint32_t>(GetDisplayMetrics().dpi.x), | 
|  | 94 | static_cast<uint32_t>(GetDisplayMetrics().dpi.y), | 
|  | 95 | static_cast<uint32_t>( | 
|  | 96 | hardware_composer_.native_display_metrics().vsync_period_ns), | 
|  | 97 | 0, | 
|  | 98 | 0, | 
|  | 99 | 0, | 
|  | 100 | 0.0, | 
|  | 101 | {}, | 
|  | 102 | {}}}; | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 103 | } | 
|  | 104 |  | 
|  | 105 | // Creates a new DisplaySurface and associates it with this channel. This may | 
|  | 106 | // only be done once per channel. | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 107 | Status<display::SurfaceInfo> DisplayService::OnCreateSurface( | 
|  | 108 | pdx::Message& message, const display::SurfaceAttributes& attributes) { | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 109 | // A surface may only be created once per channel. | 
|  | 110 | if (message.GetChannel()) | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 111 | return ErrorStatus(EINVAL); | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 112 |  | 
|  | 113 | ALOGI_IF(TRACE, "DisplayService::OnCreateSurface: cid=%d", | 
|  | 114 | message.GetChannelId()); | 
|  | 115 |  | 
|  | 116 | // Use the channel id as the unique surface id. | 
|  | 117 | const int surface_id = message.GetChannelId(); | 
|  | 118 | const int process_id = message.GetProcessId(); | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 119 | const int user_id = message.GetEffectiveUserId(); | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 120 |  | 
|  | 121 | ALOGI_IF(TRACE, | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 122 | "DisplayService::OnCreateSurface: surface_id=%d process_id=%d", | 
|  | 123 | surface_id, process_id); | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 124 |  | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 125 | auto surface_status = | 
|  | 126 | DisplaySurface::Create(this, surface_id, process_id, user_id, attributes); | 
|  | 127 | if (!surface_status) { | 
|  | 128 | ALOGE("DisplayService::OnCreateSurface: Failed to create surface: %s", | 
|  | 129 | surface_status.GetErrorMessage().c_str()); | 
|  | 130 | return ErrorStatus(surface_status.error()); | 
|  | 131 | } | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 132 |  | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 133 | SurfaceType surface_type = surface_status.get()->surface_type(); | 
|  | 134 | display::SurfaceUpdateFlags update_flags = | 
|  | 135 | surface_status.get()->update_flags(); | 
|  | 136 | display::SurfaceInfo surface_info{surface_status.get()->surface_id(), | 
|  | 137 | surface_status.get()->visible(), | 
|  | 138 | surface_status.get()->z_order()}; | 
|  | 139 |  | 
|  | 140 | message.SetChannel(surface_status.take()); | 
|  | 141 |  | 
|  | 142 | SurfaceUpdated(surface_type, update_flags); | 
|  | 143 | return {surface_info}; | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 144 | } | 
|  | 145 |  | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 146 | void DisplayService::SurfaceUpdated(SurfaceType surface_type, | 
|  | 147 | display::SurfaceUpdateFlags update_flags) { | 
|  | 148 | ALOGD_IF(TRACE, "DisplayService::SurfaceUpdated: update_flags=%x", | 
|  | 149 | update_flags.value()); | 
|  | 150 | if (update_flags.value() != 0) { | 
|  | 151 | if (surface_type == SurfaceType::Application) | 
|  | 152 | NotifyDisplayConfigurationUpdate(); | 
|  | 153 | else | 
|  | 154 | UpdateActiveDisplaySurfaces(); | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 155 | } | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 156 | } | 
|  | 157 |  | 
| Hendrik Wagenaar | eaa5522 | 2017-04-06 10:56:23 -0700 | [diff] [blame] | 158 | pdx::Status<BorrowedNativeBufferHandle> DisplayService::OnGetNamedBuffer( | 
|  | 159 | pdx::Message& /* message */, const std::string& name) { | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 160 | ALOGD_IF(TRACE, "displayService::OnGetNamedBuffer: name=%s", name.c_str()); | 
| Hendrik Wagenaar | eaa5522 | 2017-04-06 10:56:23 -0700 | [diff] [blame] | 161 | auto named_buffer = named_buffers_.find(name); | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 162 | if (named_buffer != named_buffers_.end()) | 
| Hendrik Wagenaar | eaa5522 | 2017-04-06 10:56:23 -0700 | [diff] [blame] | 163 | return {BorrowedNativeBufferHandle(*named_buffer->second, 0)}; | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 164 | else | 
|  | 165 | return pdx::ErrorStatus(EINVAL); | 
| Hendrik Wagenaar | 10e68eb | 2017-03-15 13:29:02 -0700 | [diff] [blame] | 166 | } | 
|  | 167 |  | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 168 | // Calls the message handler for the DisplaySurface associated with this | 
|  | 169 | // channel. | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 170 | Status<void> DisplayService::HandleSurfaceMessage(pdx::Message& message) { | 
|  | 171 | auto surface = std::static_pointer_cast<DisplaySurface>(message.GetChannel()); | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 172 | ALOGW_IF(!surface, | 
|  | 173 | "DisplayService::HandleSurfaceMessage: surface is nullptr!"); | 
|  | 174 |  | 
|  | 175 | if (surface) | 
|  | 176 | return surface->HandleMessage(message); | 
|  | 177 | else | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 178 | return ErrorStatus(EINVAL); | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 179 | } | 
|  | 180 |  | 
|  | 181 | std::shared_ptr<DisplaySurface> DisplayService::GetDisplaySurface( | 
|  | 182 | int surface_id) const { | 
|  | 183 | return std::static_pointer_cast<DisplaySurface>(GetChannel(surface_id)); | 
|  | 184 | } | 
|  | 185 |  | 
|  | 186 | std::vector<std::shared_ptr<DisplaySurface>> | 
|  | 187 | DisplayService::GetDisplaySurfaces() const { | 
|  | 188 | return GetChannels<DisplaySurface>(); | 
|  | 189 | } | 
|  | 190 |  | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 191 | std::vector<std::shared_ptr<DirectDisplaySurface>> | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 192 | DisplayService::GetVisibleDisplaySurfaces() const { | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 193 | std::vector<std::shared_ptr<DirectDisplaySurface>> visible_surfaces; | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 194 |  | 
|  | 195 | ForEachDisplaySurface( | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 196 | SurfaceType::Direct, | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 197 | [&](const std::shared_ptr<DisplaySurface>& surface) mutable { | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 198 | if (surface->visible()) { | 
|  | 199 | visible_surfaces.push_back( | 
|  | 200 | std::static_pointer_cast<DirectDisplaySurface>(surface)); | 
|  | 201 | surface->ClearUpdate(); | 
|  | 202 | } | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 203 | }); | 
|  | 204 |  | 
|  | 205 | return visible_surfaces; | 
|  | 206 | } | 
|  | 207 |  | 
| Steven Thomas | 050b2c8 | 2017-03-06 11:45:16 -0800 | [diff] [blame] | 208 | void DisplayService::UpdateActiveDisplaySurfaces() { | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 209 | auto visible_surfaces = GetVisibleDisplaySurfaces(); | 
|  | 210 |  | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 211 | std::sort(visible_surfaces.begin(), visible_surfaces.end(), | 
|  | 212 | [](const std::shared_ptr<DisplaySurface>& a, | 
|  | 213 | const std::shared_ptr<DisplaySurface>& b) { | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 214 | return a->z_order() < b->z_order(); | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 215 | }); | 
|  | 216 |  | 
|  | 217 | ALOGD_IF(TRACE, | 
|  | 218 | "DisplayService::UpdateActiveDisplaySurfaces: %zd visible surfaces", | 
|  | 219 | visible_surfaces.size()); | 
|  | 220 |  | 
| Steven Thomas | 050b2c8 | 2017-03-06 11:45:16 -0800 | [diff] [blame] | 221 | hardware_composer_.SetDisplaySurfaces(std::move(visible_surfaces)); | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 222 | } | 
|  | 223 |  | 
| Hendrik Wagenaar | eaa5522 | 2017-04-06 10:56:23 -0700 | [diff] [blame] | 224 | pdx::Status<BorrowedNativeBufferHandle> DisplayService::SetupNamedBuffer( | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 225 | const std::string& name, size_t size, uint64_t usage) { | 
| Hendrik Wagenaar | eaa5522 | 2017-04-06 10:56:23 -0700 | [diff] [blame] | 226 | auto named_buffer = named_buffers_.find(name); | 
|  | 227 | if (named_buffer == named_buffers_.end()) { | 
| Jiwen 'Steve' Cai | 0057fdd | 2017-05-02 11:21:18 -0700 | [diff] [blame] | 228 | auto ion_buffer = std::make_unique<IonBuffer>(static_cast<int>(size), 1, | 
|  | 229 | HAL_PIXEL_FORMAT_BLOB, usage); | 
| Hendrik Wagenaar | eaa5522 | 2017-04-06 10:56:23 -0700 | [diff] [blame] | 230 | named_buffer = | 
|  | 231 | named_buffers_.insert(std::make_pair(name, std::move(ion_buffer))) | 
|  | 232 | .first; | 
| Hendrik Wagenaar | 10e68eb | 2017-03-15 13:29:02 -0700 | [diff] [blame] | 233 | } | 
|  | 234 |  | 
| Hendrik Wagenaar | eaa5522 | 2017-04-06 10:56:23 -0700 | [diff] [blame] | 235 | return {BorrowedNativeBufferHandle(*named_buffer->second, 0)}; | 
| Hendrik Wagenaar | 10e68eb | 2017-03-15 13:29:02 -0700 | [diff] [blame] | 236 | } | 
|  | 237 |  | 
| Steven Thomas | 3cfac28 | 2017-02-06 12:29:30 -0800 | [diff] [blame] | 238 | void DisplayService::OnHardwareComposerRefresh() { | 
|  | 239 | hardware_composer_.OnHardwareComposerRefresh(); | 
|  | 240 | } | 
|  | 241 |  | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 242 | void DisplayService::SetDisplayConfigurationUpdateNotifier( | 
|  | 243 | DisplayConfigurationUpdateNotifier update_notifier) { | 
|  | 244 | update_notifier_ = update_notifier; | 
|  | 245 | } | 
|  | 246 |  | 
|  | 247 | void DisplayService::NotifyDisplayConfigurationUpdate() { | 
|  | 248 | if (update_notifier_) | 
|  | 249 | update_notifier_(); | 
|  | 250 | } | 
|  | 251 |  | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 252 | Status<bool> DisplayService::IsVrAppRunning(pdx::Message& /*message*/) { | 
| Albert Chaulk | 356bc37 | 2017-04-05 18:01:58 -0400 | [diff] [blame] | 253 | bool visible = false; | 
| Hendrik Wagenaar | eaa5522 | 2017-04-06 10:56:23 -0700 | [diff] [blame] | 254 | ForEachDisplaySurface( | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 255 | SurfaceType::Application, | 
| Hendrik Wagenaar | eaa5522 | 2017-04-06 10:56:23 -0700 | [diff] [blame] | 256 | [&visible](const std::shared_ptr<DisplaySurface>& surface) { | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 257 | if (surface->visible()) | 
| Hendrik Wagenaar | eaa5522 | 2017-04-06 10:56:23 -0700 | [diff] [blame] | 258 | visible = true; | 
|  | 259 | }); | 
| Albert Chaulk | b7c8a4b | 2017-03-20 13:03:39 -0400 | [diff] [blame] | 260 |  | 
| Corey Tabaka | 2251d82 | 2017-04-20 16:04:07 -0700 | [diff] [blame] | 261 | return {visible}; | 
| Albert Chaulk | b7c8a4b | 2017-03-20 13:03:39 -0400 | [diff] [blame] | 262 | } | 
|  | 263 |  | 
| Alex Vakulenko | a8a9278 | 2017-01-27 14:41:57 -0800 | [diff] [blame] | 264 | }  // namespace dvr | 
|  | 265 | }  // namespace android |