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