Define hidl interface to query display type for TUI client
Add hidl interface to query display type information for a given physical display id Change-Id: Iebe1f243225d26c24584b57a02df2aef57ef1a4c
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
parent
058b55de20
commit
ea0145c72d
@@ -320,6 +320,8 @@ class ConfigInterface {
|
||||
virtual int ControlIdleStatusCallback(bool /* enable */) DEFAULT_RET
|
||||
virtual int IsSupportedConfigSwitch(uint32_t /* disp_id */, uint32_t /* config */,
|
||||
bool* /* supported */) DEFAULT_RET
|
||||
virtual int GetDisplayType(uint64_t /* physical_disp_id */,
|
||||
DisplayType* /* disp_type */) DEFAULT_RET
|
||||
|
||||
// deprecated APIs
|
||||
virtual int GetDebugProperty(const std::string /* prop_name */,
|
||||
|
||||
@@ -946,7 +946,6 @@ int ClientImpl::IsSupportedConfigSwitch(uint32_t disp_id, uint32_t config, bool
|
||||
error = err;
|
||||
output_params = params;
|
||||
};
|
||||
|
||||
if (display_config_) {
|
||||
display_config_->perform(client_handle_, kIsSupportedConfigSwitch, input_params, {}, hidl_cb);
|
||||
}
|
||||
@@ -960,6 +959,30 @@ int ClientImpl::IsSupportedConfigSwitch(uint32_t disp_id, uint32_t config, bool
|
||||
return error;
|
||||
}
|
||||
|
||||
int ClientImpl::GetDisplayType(uint64_t physical_disp_id, DisplayType *disp_type) {
|
||||
if (!disp_type) {
|
||||
return -EINVAL;
|
||||
}
|
||||
ByteStream input_params;
|
||||
input_params.setToExternal(reinterpret_cast<uint8_t*>(&physical_disp_id), sizeof(uint64_t));
|
||||
ByteStream output_params;
|
||||
int error = 0;
|
||||
auto hidl_cb = [&error, &output_params] (int32_t err, ByteStream params, HandleStream handles) {
|
||||
error = err;
|
||||
output_params = params;
|
||||
};
|
||||
if (display_config_) {
|
||||
display_config_->perform(client_handle_, kGetDisplayType, input_params, {}, hidl_cb);
|
||||
}
|
||||
|
||||
if (!error) {
|
||||
const uint8_t *data = output_params.data();
|
||||
const DisplayType *output = reinterpret_cast<const DisplayType*>(data);
|
||||
*disp_type = *output;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
void ClientCallback::ParseNotifyCWBBufferDone(const ByteStream &input_params,
|
||||
const HandleStream &input_handles) {
|
||||
const int *error;
|
||||
|
||||
@@ -125,6 +125,7 @@ class ClientImpl : public ClientInterface {
|
||||
virtual int IsRCSupported(uint32_t disp_id, bool *supported);
|
||||
virtual int ControlIdleStatusCallback(bool enable);
|
||||
virtual int IsSupportedConfigSwitch(uint32_t disp_id, uint32_t config, bool *supported);
|
||||
virtual int GetDisplayType(uint64_t physical_disp_id, DisplayType *disp_type);
|
||||
|
||||
private:
|
||||
android::sp<IDisplayConfig> display_config_ = nullptr;
|
||||
|
||||
@@ -839,6 +839,18 @@ void DeviceImpl::DeviceClientContext::ParseIsSupportedConfigSwitch(const ByteStr
|
||||
_hidl_cb(error, output_params, {});
|
||||
}
|
||||
|
||||
void DeviceImpl::DeviceClientContext::ParseGetDisplayType(const ByteStream &input_params,
|
||||
perform_cb _hidl_cb) {
|
||||
const uint8_t *data = input_params.data();
|
||||
const uint64_t *physical_disp_id = reinterpret_cast<const uint64_t*>(data);
|
||||
DisplayType disp_type = DisplayConfig::DisplayType::kInvalid;
|
||||
int32_t error = intf_->GetDisplayType(*physical_disp_id, &disp_type);
|
||||
ByteStream output_params;
|
||||
output_params.setToExternal(reinterpret_cast<uint8_t*>(&disp_type), sizeof(DisplayType));
|
||||
|
||||
_hidl_cb(error, output_params, {});
|
||||
}
|
||||
|
||||
Return<void> DeviceImpl::perform(uint64_t client_handle, uint32_t op_code,
|
||||
const ByteStream &input_params, const HandleStream &input_handles,
|
||||
perform_cb _hidl_cb) {
|
||||
@@ -1004,6 +1016,9 @@ Return<void> DeviceImpl::perform(uint64_t client_handle, uint32_t op_code,
|
||||
case kIsSupportedConfigSwitch:
|
||||
client->ParseIsSupportedConfigSwitch(input_params, _hidl_cb);
|
||||
break;
|
||||
case kGetDisplayType:
|
||||
client->ParseGetDisplayType(input_params, _hidl_cb);
|
||||
break;
|
||||
default:
|
||||
_hidl_cb(-EINVAL, {}, {});
|
||||
break;
|
||||
|
||||
@@ -124,6 +124,7 @@ class DeviceImpl : public IDisplayConfig, public android::hardware::hidl_death_r
|
||||
void ParseControlIdleStatusCallback(uint64_t client_handle, const ByteStream &input_params,
|
||||
perform_cb _hidl_cb);
|
||||
void ParseIsSupportedConfigSwitch(const ByteStream &input_params, perform_cb _hidl_cb);
|
||||
void ParseGetDisplayType(const ByteStream &input_params, perform_cb _hidl_cb);
|
||||
|
||||
private:
|
||||
ConfigInterface *intf_ = nullptr;
|
||||
|
||||
@@ -81,6 +81,7 @@ enum OpCode {
|
||||
kIsRCSupported = 45,
|
||||
kControlIdleStatusCallback = 46,
|
||||
kIsSupportedConfigSwitch = 47,
|
||||
kGetDisplayType = 48,
|
||||
|
||||
kDestroy = 0xFFFF, // Destroy sequence execution
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user