• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include "include/private/dvr/display_manager_client.h"
2 
3 #include <pdx/default_transport/client_channel_factory.h>
4 #include <private/dvr/buffer_hub_client.h>
5 #include <private/dvr/buffer_hub_queue_client.h>
6 #include <private/dvr/display_protocol.h>
7 #include <utils/Log.h>
8 
9 using android::pdx::ErrorStatus;
10 using android::pdx::LocalChannelHandle;
11 using android::pdx::Transaction;
12 
13 namespace android {
14 namespace dvr {
15 namespace display {
16 
DisplayManagerClient()17 DisplayManagerClient::DisplayManagerClient()
18     : BASE(pdx::default_transport::ClientChannelFactory::Create(
19           DisplayManagerProtocol::kClientPath)) {}
20 
~DisplayManagerClient()21 DisplayManagerClient::~DisplayManagerClient() {}
22 
23 pdx::Status<std::vector<display::SurfaceState>>
GetSurfaceState()24 DisplayManagerClient::GetSurfaceState() {
25   auto status = InvokeRemoteMethod<DisplayManagerProtocol::GetSurfaceState>();
26   if (!status) {
27     ALOGE(
28         "DisplayManagerClient::GetSurfaceState: Failed to get surface info: %s",
29         status.GetErrorMessage().c_str());
30   }
31 
32   return status;
33 }
34 
35 pdx::Status<std::unique_ptr<ConsumerQueue>>
GetSurfaceQueue(int surface_id,int queue_id)36 DisplayManagerClient::GetSurfaceQueue(int surface_id, int queue_id) {
37   auto status = InvokeRemoteMethod<DisplayManagerProtocol::GetSurfaceQueue>(
38       surface_id, queue_id);
39   if (!status) {
40     ALOGE(
41         "DisplayManagerClient::GetSurfaceQueue: Failed to get queue for "
42         "surface_id=%d queue_id=%d: %s",
43         surface_id, queue_id, status.GetErrorMessage().c_str());
44     return status.error_status();
45   }
46 
47   return {ConsumerQueue::Import(status.take())};
48 }
49 
50 }  // namespace display
51 }  // namespace dvr
52 }  // namespace android
53