From 4181cc8819f3cf9b62a87da7b7fddf9a8b81ea73 Mon Sep 17 00:00:00 2001 From: ksrinath Date: Mon, 18 Jan 2021 16:49:31 +0530 Subject: [PATCH] displayconfig: Add dummy display config API Dummy display config API is added to check the backward compatibility of IDisplayConfig2.0 with vendor freeze. CRs-Fixed: 2855291 Change-Id: I4f3ddd5c1a9bb660ab252b9024650a9bd63a4ccf --- services/config/config_defs.h | 5 ++++- services/config/src/client_impl.cpp | 14 +++++++++++++- services/config/src/client_impl.h | 3 ++- services/config/src/device_impl.cpp | 5 ++++- services/config/src/opcode_types.h | 3 ++- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/services/config/config_defs.h b/services/config/config_defs.h index 7f51c70a..ab51a0e9 100644 --- a/services/config/config_defs.h +++ b/services/config/config_defs.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2020 The Linux Foundation. All rights reserved. +* Copyright (c) 2020-2021 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -32,6 +32,8 @@ #include #include +#include +#include // #defines specifying the API level supported // Client can use these API level #ifdefs in their implementation to call the @@ -322,6 +324,7 @@ class ConfigInterface { bool* /* supported */) DEFAULT_RET virtual int GetDisplayType(uint64_t /* physical_disp_id */, DisplayType* /* disp_type */) DEFAULT_RET + virtual int DummyDisplayConfigAPI() DEFAULT_RET // deprecated APIs virtual int GetDebugProperty(const std::string /* prop_name */, diff --git a/services/config/src/client_impl.cpp b/services/config/src/client_impl.cpp index 3309f52d..38dca8c8 100644 --- a/services/config/src/client_impl.cpp +++ b/services/config/src/client_impl.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2020 The Linux Foundation. All rights reserved. +* Copyright (c) 2020-2021 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -934,6 +934,18 @@ int ClientImpl::IsRCSupported(uint32_t disp_id, bool *supported) { return error; } +int ClientImpl::DummyDisplayConfigAPI() { + int error = 0; + auto hidl_cb = [&error] (int32_t err, ByteStream params, HandleStream handles) { + error = err; + }; + display_config_->perform(client_handle_, kDummyOpcode, {}, {}, hidl_cb); + if (error) { + return -EINVAL; + } + return error; +} + int ClientImpl::IsSupportedConfigSwitch(uint32_t disp_id, uint32_t config, bool *supported) { struct SupportedModesParams input = {disp_id, config}; ByteStream input_params; diff --git a/services/config/src/client_impl.h b/services/config/src/client_impl.h index 72089007..b21bc4d3 100644 --- a/services/config/src/client_impl.h +++ b/services/config/src/client_impl.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2020 The Linux Foundation. All rights reserved. +* Copyright (c) 2020-2021 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -126,6 +126,7 @@ class ClientImpl : public ClientInterface { 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); + virtual int DummyDisplayConfigAPI(); private: android::sp display_config_ = nullptr; diff --git a/services/config/src/device_impl.cpp b/services/config/src/device_impl.cpp index 50b3ecb4..72f7a3f3 100644 --- a/services/config/src/device_impl.cpp +++ b/services/config/src/device_impl.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2020 The Linux Foundation. All rights reserved. +* Copyright (c) 2020-2021 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -1019,6 +1019,9 @@ Return DeviceImpl::perform(uint64_t client_handle, uint32_t op_code, case kGetDisplayType: client->ParseGetDisplayType(input_params, _hidl_cb); break; + case kDummyOpcode: + _hidl_cb(-EINVAL, {}, {}); + break; default: _hidl_cb(-EINVAL, {}, {}); break; diff --git a/services/config/src/opcode_types.h b/services/config/src/opcode_types.h index b1bc4d22..2a881fd3 100644 --- a/services/config/src/opcode_types.h +++ b/services/config/src/opcode_types.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2020 The Linux Foundation. All rights reserved. +* Copyright (c) 2020-2021 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -82,6 +82,7 @@ enum OpCode { kControlIdleStatusCallback = 46, kIsSupportedConfigSwitch = 47, kGetDisplayType = 48, + kDummyOpcode = 49, kDestroy = 0xFFFF, // Destroy sequence execution };