Merge "Refactor HDMI related AIDL packages" am: e6c4ebb0de
am: 8047dfe2ed
am: dc0a6dcb9c
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2347525 Change-Id: I5954f3b0106b9a01ae174fe787f0fe751f9295f0 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
16fed02090
77 changed files with 372 additions and 224 deletions
|
@ -643,23 +643,23 @@
|
|||
</interface>
|
||||
</hal>
|
||||
<hal format="aidl" optional="true">
|
||||
<name>android.hardware.tv.cec</name>
|
||||
<name>android.hardware.tv.hdmi.cec</name>
|
||||
<interface>
|
||||
<name>IHdmiCec</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="aidl" optional="true">
|
||||
<name>android.hardware.tv.earc</name>
|
||||
<name>android.hardware.tv.hdmi.earc</name>
|
||||
<interface>
|
||||
<name>IEArc</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="aidl" optional="true">
|
||||
<name>android.hardware.tv.hdmi</name>
|
||||
<name>android.hardware.tv.hdmi.connection</name>
|
||||
<interface>
|
||||
<name>IHdmi</name>
|
||||
<name>IHdmiConnection</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"presubmit": [
|
||||
{
|
||||
"name": "VtsHalTvCecAidlTargetTest"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
service vendor.cec-default /vendor/bin/hw/android.hardware.tv.cec-service
|
||||
interface aidl android.hardware.tv.cec.IHdmiCec/default
|
||||
class hal
|
||||
user system
|
||||
group system
|
|
@ -1,5 +0,0 @@
|
|||
service vendor.earc-default /vendor/bin/hw/android.hardware.tv.earc-service
|
||||
interface aidl android.hardware.tv.earc.IEArc/default
|
||||
class hal
|
||||
user system
|
||||
group system
|
|
@ -17,9 +17,9 @@ package {
|
|||
}
|
||||
|
||||
aidl_interface {
|
||||
name: "android.hardware.tv.cec",
|
||||
name: "android.hardware.tv.hdmi.cec",
|
||||
vendor_available: true,
|
||||
srcs: ["android/hardware/tv/cec/*.aidl"],
|
||||
srcs: ["android/hardware/tv/hdmi/cec/*.aidl"],
|
||||
stability: "vintf",
|
||||
backend: {
|
||||
java: {
|
7
tv/hdmi/cec/aidl/TEST_MAPPING
Normal file
7
tv/hdmi/cec/aidl/TEST_MAPPING
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"presubmit": [
|
||||
{
|
||||
"name": "VtsHalTvHdmiCecAidlTargetTest"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -31,7 +31,7 @@
|
|||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package android.hardware.tv.cec;
|
||||
package android.hardware.tv.hdmi.cec;
|
||||
@Backing(type="int") @VintfStability
|
||||
enum AbortReason {
|
||||
UNRECOGNIZED_MODE = 0,
|
|
@ -31,7 +31,7 @@
|
|||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package android.hardware.tv.cec;
|
||||
package android.hardware.tv.hdmi.cec;
|
||||
@Backing(type="byte") @VintfStability
|
||||
enum CecDeviceType {
|
||||
INACTIVE = -1,
|
|
@ -31,7 +31,7 @@
|
|||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package android.hardware.tv.cec;
|
||||
package android.hardware.tv.hdmi.cec;
|
||||
@Backing(type="byte") @VintfStability
|
||||
enum CecLogicalAddress {
|
||||
TV = 0,
|
|
@ -31,11 +31,11 @@
|
|||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package android.hardware.tv.cec;
|
||||
package android.hardware.tv.hdmi.cec;
|
||||
@VintfStability
|
||||
parcelable CecMessage {
|
||||
android.hardware.tv.cec.CecLogicalAddress initiator;
|
||||
android.hardware.tv.cec.CecLogicalAddress destination;
|
||||
android.hardware.tv.hdmi.cec.CecLogicalAddress initiator;
|
||||
android.hardware.tv.hdmi.cec.CecLogicalAddress destination;
|
||||
byte[] body;
|
||||
const int MAX_MESSAGE_BODY_LENGTH = 15;
|
||||
}
|
|
@ -31,7 +31,7 @@
|
|||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package android.hardware.tv.cec;
|
||||
package android.hardware.tv.hdmi.cec;
|
||||
@Backing(type="int") @VintfStability
|
||||
enum CecMessageType {
|
||||
FEATURE_ABORT = 0,
|
|
@ -31,17 +31,17 @@
|
|||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package android.hardware.tv.cec;
|
||||
package android.hardware.tv.hdmi.cec;
|
||||
@VintfStability
|
||||
interface IHdmiCec {
|
||||
android.hardware.tv.cec.Result addLogicalAddress(in android.hardware.tv.cec.CecLogicalAddress addr);
|
||||
android.hardware.tv.hdmi.cec.Result addLogicalAddress(in android.hardware.tv.hdmi.cec.CecLogicalAddress addr);
|
||||
void clearLogicalAddress();
|
||||
void enableAudioReturnChannel(in int portId, in boolean enable);
|
||||
int getCecVersion();
|
||||
int getPhysicalAddress();
|
||||
int getVendorId();
|
||||
android.hardware.tv.cec.SendMessageResult sendMessage(in android.hardware.tv.cec.CecMessage message);
|
||||
void setCallback(in android.hardware.tv.cec.IHdmiCecCallback callback);
|
||||
android.hardware.tv.hdmi.cec.SendMessageResult sendMessage(in android.hardware.tv.hdmi.cec.CecMessage message);
|
||||
void setCallback(in android.hardware.tv.hdmi.cec.IHdmiCecCallback callback);
|
||||
void setLanguage(in String language);
|
||||
void enableWakeupByOtp(in boolean value);
|
||||
void enableCec(in boolean value);
|
|
@ -31,8 +31,8 @@
|
|||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package android.hardware.tv.cec;
|
||||
package android.hardware.tv.hdmi.cec;
|
||||
@VintfStability
|
||||
interface IHdmiCecCallback {
|
||||
oneway void onCecMessage(in android.hardware.tv.cec.CecMessage message);
|
||||
oneway void onCecMessage(in android.hardware.tv.hdmi.cec.CecMessage message);
|
||||
}
|
|
@ -31,7 +31,7 @@
|
|||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package android.hardware.tv.cec;
|
||||
package android.hardware.tv.hdmi.cec;
|
||||
@Backing(type="byte") @VintfStability
|
||||
enum Result {
|
||||
SUCCESS = 0,
|
|
@ -31,7 +31,7 @@
|
|||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package android.hardware.tv.cec;
|
||||
package android.hardware.tv.hdmi.cec;
|
||||
@Backing(type="byte") @VintfStability
|
||||
enum SendMessageResult {
|
||||
SUCCESS = 0,
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.tv.cec;
|
||||
package android.hardware.tv.hdmi.cec;
|
||||
|
||||
/**
|
||||
* Operand description [Abort Reason]
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.tv.cec;
|
||||
package android.hardware.tv.hdmi.cec;
|
||||
|
||||
@VintfStability
|
||||
@Backing(type="byte")
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.tv.cec;
|
||||
package android.hardware.tv.hdmi.cec;
|
||||
|
||||
@VintfStability
|
||||
@Backing(type="byte")
|
|
@ -14,9 +14,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.tv.cec;
|
||||
package android.hardware.tv.hdmi.cec;
|
||||
|
||||
import android.hardware.tv.cec.CecLogicalAddress;
|
||||
import android.hardware.tv.hdmi.cec.CecLogicalAddress;
|
||||
|
||||
@VintfStability
|
||||
parcelable CecMessage {
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.tv.cec;
|
||||
package android.hardware.tv.hdmi.cec;
|
||||
|
||||
@VintfStability
|
||||
@Backing(type="int")
|
|
@ -14,13 +14,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.tv.cec;
|
||||
package android.hardware.tv.hdmi.cec;
|
||||
|
||||
import android.hardware.tv.cec.CecLogicalAddress;
|
||||
import android.hardware.tv.cec.CecMessage;
|
||||
import android.hardware.tv.cec.IHdmiCecCallback;
|
||||
import android.hardware.tv.cec.Result;
|
||||
import android.hardware.tv.cec.SendMessageResult;
|
||||
import android.hardware.tv.hdmi.cec.CecLogicalAddress;
|
||||
import android.hardware.tv.hdmi.cec.CecMessage;
|
||||
import android.hardware.tv.hdmi.cec.IHdmiCecCallback;
|
||||
import android.hardware.tv.hdmi.cec.Result;
|
||||
import android.hardware.tv.hdmi.cec.SendMessageResult;
|
||||
|
||||
/**
|
||||
* HDMI-CEC HAL interface definition.
|
|
@ -14,9 +14,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.tv.cec;
|
||||
package android.hardware.tv.hdmi.cec;
|
||||
|
||||
import android.hardware.tv.cec.CecMessage;
|
||||
import android.hardware.tv.hdmi.cec.CecMessage;
|
||||
|
||||
/**
|
||||
* Callbacks from the HAL implementation to notify the system of new events.
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.tv.cec;
|
||||
package android.hardware.tv.hdmi.cec;
|
||||
|
||||
@VintfStability
|
||||
@Backing(type="byte")
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.tv.cec;
|
||||
package android.hardware.tv.hdmi.cec;
|
||||
|
||||
/**
|
||||
* error code used for send_message.
|
|
@ -17,15 +17,15 @@ package {
|
|||
}
|
||||
|
||||
cc_binary {
|
||||
name: "android.hardware.tv.cec-service",
|
||||
vintf_fragments: ["android.hardware.tv.cec-service.xml"],
|
||||
name: "android.hardware.tv.hdmi.cec-service",
|
||||
vintf_fragments: ["android.hardware.tv.hdmi.cec-service.xml"],
|
||||
relative_install_path: "hw",
|
||||
vendor: true,
|
||||
cflags: [
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
],
|
||||
init_rc: ["android.hardware.tv.cec-service.rc"],
|
||||
init_rc: ["android.hardware.tv.hdmi.cec-service.rc"],
|
||||
srcs: [
|
||||
"serviceMock.cpp",
|
||||
"HdmiCecMock.cpp",
|
||||
|
@ -37,15 +37,15 @@ cc_binary {
|
|||
"libutils",
|
||||
"libhardware",
|
||||
"libhidlbase",
|
||||
"android.hardware.tv.cec-V1-ndk",
|
||||
"android.hardware.tv.hdmi.cec-V1-ndk",
|
||||
],
|
||||
}
|
||||
|
||||
cc_fuzz {
|
||||
name: "android.hardware.tv.cec-service_fuzzer",
|
||||
name: "android.hardware.tv.hdmi.cec-service_fuzzer",
|
||||
defaults: ["service_fuzzer_defaults"],
|
||||
static_libs: [
|
||||
"android.hardware.tv.cec-V1-ndk",
|
||||
"android.hardware.tv.hdmi.cec-V1-ndk",
|
||||
"liblog",
|
||||
],
|
||||
srcs: [
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "android.hardware.tv.cec"
|
||||
#define LOG_TAG "android.hardware.tv.hdmi.cec"
|
||||
#include <android-base/logging.h>
|
||||
#include <fcntl.h>
|
||||
#include <utils/Log.h>
|
||||
|
@ -28,6 +28,7 @@ using ndk::ScopedAStatus;
|
|||
namespace android {
|
||||
namespace hardware {
|
||||
namespace tv {
|
||||
namespace hdmi {
|
||||
namespace cec {
|
||||
namespace implementation {
|
||||
|
||||
|
@ -261,6 +262,7 @@ HdmiCecMock::HdmiCecMock() {
|
|||
|
||||
} // namespace implementation
|
||||
} // namespace cec
|
||||
} // namespace hdmi
|
||||
} // namespace tv
|
||||
} // namespace hardware
|
||||
} // namespace android
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <aidl/android/hardware/tv/cec/BnHdmiCec.h>
|
||||
#include <aidl/android/hardware/tv/hdmi/cec/BnHdmiCec.h>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
|
@ -23,16 +23,17 @@ using namespace std;
|
|||
namespace android {
|
||||
namespace hardware {
|
||||
namespace tv {
|
||||
namespace hdmi {
|
||||
namespace cec {
|
||||
namespace implementation {
|
||||
|
||||
using ::aidl::android::hardware::tv::cec::BnHdmiCec;
|
||||
using ::aidl::android::hardware::tv::cec::CecLogicalAddress;
|
||||
using ::aidl::android::hardware::tv::cec::CecMessage;
|
||||
using ::aidl::android::hardware::tv::cec::IHdmiCec;
|
||||
using ::aidl::android::hardware::tv::cec::IHdmiCecCallback;
|
||||
using ::aidl::android::hardware::tv::cec::Result;
|
||||
using ::aidl::android::hardware::tv::cec::SendMessageResult;
|
||||
using ::aidl::android::hardware::tv::hdmi::cec::BnHdmiCec;
|
||||
using ::aidl::android::hardware::tv::hdmi::cec::CecLogicalAddress;
|
||||
using ::aidl::android::hardware::tv::hdmi::cec::CecMessage;
|
||||
using ::aidl::android::hardware::tv::hdmi::cec::IHdmiCec;
|
||||
using ::aidl::android::hardware::tv::hdmi::cec::IHdmiCecCallback;
|
||||
using ::aidl::android::hardware::tv::hdmi::cec::Result;
|
||||
using ::aidl::android::hardware::tv::hdmi::cec::SendMessageResult;
|
||||
|
||||
#define CEC_MSG_IN_FIFO "/dev/cec_aidl_in_pipe"
|
||||
#define CEC_MSG_OUT_FIFO "/dev/cec_aidl_out_pipe"
|
||||
|
@ -89,6 +90,7 @@ struct HdmiCecMock : public BnHdmiCec {
|
|||
};
|
||||
} // namespace implementation
|
||||
} // namespace cec
|
||||
} // namespace hdmi
|
||||
} // namespace tv
|
||||
} // namespace hardware
|
||||
} // namespace android
|
|
@ -0,0 +1,5 @@
|
|||
service vendor.cec-default /vendor/bin/hw/android.hardware.tv.hdmi.cec-service
|
||||
interface aidl android.hardware.tv.hdmi.cec.IHdmiCec/default
|
||||
class hal
|
||||
user system
|
||||
group system
|
|
@ -1,6 +1,6 @@
|
|||
<manifest version="1.0" type="device">
|
||||
<hal format="aidl">
|
||||
<name>android.hardware.tv.cec</name>
|
||||
<name>android.hardware.tv.hdmi.cec</name>
|
||||
<version>1</version>
|
||||
<interface>
|
||||
<name>IHdmiCec</name>
|
|
@ -18,7 +18,7 @@
|
|||
#include <fuzzer/FuzzedDataProvider.h>
|
||||
|
||||
using android::fuzzService;
|
||||
using android::hardware::tv::cec::implementation::HdmiCecMock;
|
||||
using android::hardware::tv::hdmi::cec::implementation::HdmiCecMock;
|
||||
using ndk::SharedRefBase;
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "android.hardware.tv.cec-service-shim"
|
||||
#define LOG_TAG "android.hardware.tv.hdmi.cec-service-shim"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <android/binder_manager.h>
|
||||
|
@ -23,7 +23,7 @@
|
|||
#include <utils/Log.h>
|
||||
#include "HdmiCecMock.h"
|
||||
|
||||
using android::hardware::tv::cec::implementation::HdmiCecMock;
|
||||
using android::hardware::tv::hdmi::cec::implementation::HdmiCecMock;
|
||||
|
||||
int main() {
|
||||
ABinderProcess_setThreadPoolMaxThreadCount(1);
|
|
@ -17,15 +17,15 @@ package {
|
|||
}
|
||||
|
||||
cc_test {
|
||||
name: "VtsHalTvCecAidlTargetTest",
|
||||
name: "VtsHalTvHdmiCecAidlTargetTest",
|
||||
defaults: [
|
||||
"VtsHalTargetTestDefaults",
|
||||
"use_libaidlvintf_gtest_helper_static",
|
||||
],
|
||||
srcs: ["VtsHalTvCecAidlTargetTest.cpp"],
|
||||
srcs: ["VtsHalTvHdmiCecAidlTargetTest.cpp"],
|
||||
static_libs: [
|
||||
"android.hardware.tv.cec-V1-ndk",
|
||||
"android.hardware.tv.hdmi-V1-ndk",
|
||||
"android.hardware.tv.hdmi.cec-V1-ndk",
|
||||
"android.hardware.tv.hdmi.connection-V1-ndk",
|
||||
],
|
||||
shared_libs: [
|
||||
"libbinder_ndk",
|
|
@ -13,7 +13,7 @@
|
|||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<configuration description="Runs VtsHalTvCecAidlTargetTest.">
|
||||
<configuration description="Runs VtsHalTvHdmiCecAidlTargetTest.">
|
||||
<option name="test-suite-tag" value="apct" />
|
||||
<option name="test-suite-tag" value="apct-native" />
|
||||
|
||||
|
@ -22,12 +22,12 @@
|
|||
|
||||
<target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
|
||||
<option name="cleanup" value="true" />
|
||||
<option name="push" value="VtsHalTvCecAidlTargetTest->/data/local/tmp/VtsHalTvCecAidlTargetTest" />
|
||||
<option name="push" value="VtsHalTvHdmiCecAidlTargetTest->/data/local/tmp/VtsHalTvHdmiCecAidlTargetTest" />
|
||||
</target_preparer>
|
||||
|
||||
<test class="com.android.tradefed.testtype.GTest" >
|
||||
<option name="native-test-device-path" value="/data/local/tmp" />
|
||||
<option name="module-name" value="VtsHalTvCecAidlTargetTest" />
|
||||
<option name="module-name" value="VtsHalTvHdmiCecAidlTargetTest" />
|
||||
<option name="native-test-timeout" value="30m" />
|
||||
</test>
|
||||
</configuration>
|
|
@ -18,10 +18,10 @@
|
|||
|
||||
#include <aidl/Gtest.h>
|
||||
#include <aidl/Vintf.h>
|
||||
#include <aidl/android/hardware/tv/cec/BnHdmiCec.h>
|
||||
#include <aidl/android/hardware/tv/cec/BnHdmiCecCallback.h>
|
||||
#include <aidl/android/hardware/tv/cec/CecDeviceType.h>
|
||||
#include <aidl/android/hardware/tv/hdmi/BnHdmi.h>
|
||||
#include <aidl/android/hardware/tv/hdmi/cec/BnHdmiCec.h>
|
||||
#include <aidl/android/hardware/tv/hdmi/cec/BnHdmiCecCallback.h>
|
||||
#include <aidl/android/hardware/tv/hdmi/cec/CecDeviceType.h>
|
||||
#include <aidl/android/hardware/tv/hdmi/connection/BnHdmiConnection.h>
|
||||
#include <android-base/logging.h>
|
||||
#include <android/binder_manager.h>
|
||||
#include <android/binder_process.h>
|
||||
|
@ -30,15 +30,15 @@
|
|||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
using ::aidl::android::hardware::tv::cec::BnHdmiCecCallback;
|
||||
using ::aidl::android::hardware::tv::cec::CecDeviceType;
|
||||
using ::aidl::android::hardware::tv::cec::CecLogicalAddress;
|
||||
using ::aidl::android::hardware::tv::cec::CecMessage;
|
||||
using ::aidl::android::hardware::tv::cec::IHdmiCec;
|
||||
using ::aidl::android::hardware::tv::cec::IHdmiCecCallback;
|
||||
using ::aidl::android::hardware::tv::cec::Result;
|
||||
using ::aidl::android::hardware::tv::cec::SendMessageResult;
|
||||
using ::aidl::android::hardware::tv::hdmi::HdmiPortInfo;
|
||||
using ::aidl::android::hardware::tv::hdmi::cec::BnHdmiCecCallback;
|
||||
using ::aidl::android::hardware::tv::hdmi::cec::CecDeviceType;
|
||||
using ::aidl::android::hardware::tv::hdmi::cec::CecLogicalAddress;
|
||||
using ::aidl::android::hardware::tv::hdmi::cec::CecMessage;
|
||||
using ::aidl::android::hardware::tv::hdmi::cec::IHdmiCec;
|
||||
using ::aidl::android::hardware::tv::hdmi::cec::IHdmiCecCallback;
|
||||
using ::aidl::android::hardware::tv::hdmi::cec::Result;
|
||||
using ::aidl::android::hardware::tv::hdmi::cec::SendMessageResult;
|
||||
using ::aidl::android::hardware::tv::hdmi::connection::HdmiPortInfo;
|
||||
using ::ndk::SpAIBinder;
|
||||
|
||||
#define CEC_VERSION 0x05
|
|
@ -17,9 +17,9 @@ package {
|
|||
}
|
||||
|
||||
aidl_interface {
|
||||
name: "android.hardware.tv.hdmi",
|
||||
name: "android.hardware.tv.hdmi.connection",
|
||||
vendor_available: true,
|
||||
srcs: ["android/hardware/tv/hdmi/*.aidl"],
|
||||
srcs: ["android/hardware/tv/hdmi/connection/*.aidl"],
|
||||
stability: "vintf",
|
||||
backend: {
|
||||
java: {
|
|
@ -31,10 +31,10 @@
|
|||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package android.hardware.tv.hdmi;
|
||||
package android.hardware.tv.hdmi.connection;
|
||||
@VintfStability
|
||||
parcelable HdmiPortInfo {
|
||||
android.hardware.tv.hdmi.HdmiPortType type;
|
||||
android.hardware.tv.hdmi.connection.HdmiPortType type;
|
||||
int portId;
|
||||
boolean cecSupported;
|
||||
boolean arcSupported;
|
|
@ -31,7 +31,7 @@
|
|||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package android.hardware.tv.hdmi;
|
||||
package android.hardware.tv.hdmi.connection;
|
||||
@Backing(type="byte") @VintfStability
|
||||
enum HdmiPortType {
|
||||
INPUT = 0,
|
|
@ -31,7 +31,7 @@
|
|||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package android.hardware.tv.hdmi;
|
||||
package android.hardware.tv.hdmi.connection;
|
||||
@Backing(type="byte") @VintfStability
|
||||
enum HpdSignal {
|
||||
HDMI_HPD_PHYSICAL = 0,
|
|
@ -31,12 +31,12 @@
|
|||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package android.hardware.tv.hdmi;
|
||||
package android.hardware.tv.hdmi.connection;
|
||||
@VintfStability
|
||||
interface IHdmi {
|
||||
android.hardware.tv.hdmi.HdmiPortInfo[] getPortInfo();
|
||||
interface IHdmiConnection {
|
||||
android.hardware.tv.hdmi.connection.HdmiPortInfo[] getPortInfo();
|
||||
boolean isConnected(in int portId);
|
||||
void setCallback(in android.hardware.tv.hdmi.IHdmiCallback callback);
|
||||
void setHpdSignal(android.hardware.tv.hdmi.HpdSignal signal);
|
||||
android.hardware.tv.hdmi.HpdSignal getHpdSignal();
|
||||
void setCallback(in android.hardware.tv.hdmi.connection.IHdmiConnectionCallback callback);
|
||||
void setHpdSignal(android.hardware.tv.hdmi.connection.HpdSignal signal);
|
||||
android.hardware.tv.hdmi.connection.HpdSignal getHpdSignal();
|
||||
}
|
|
@ -31,8 +31,8 @@
|
|||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package android.hardware.tv.hdmi;
|
||||
package android.hardware.tv.hdmi.connection;
|
||||
@VintfStability
|
||||
interface IHdmiCallback {
|
||||
interface IHdmiConnectionCallback {
|
||||
oneway void onHotplugEvent(in boolean connected, in int portId);
|
||||
}
|
|
@ -31,7 +31,7 @@
|
|||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package android.hardware.tv.hdmi;
|
||||
package android.hardware.tv.hdmi.connection;
|
||||
@VintfStability
|
||||
enum Result {
|
||||
SUCCESS = 0,
|
|
@ -14,9 +14,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.tv.hdmi;
|
||||
package android.hardware.tv.hdmi.connection;
|
||||
|
||||
import android.hardware.tv.hdmi.HdmiPortType;
|
||||
import android.hardware.tv.hdmi.connection.HdmiPortType;
|
||||
|
||||
/**
|
||||
* HDMI port descriptor
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.tv.hdmi;
|
||||
package android.hardware.tv.hdmi.connection;
|
||||
|
||||
/**
|
||||
* HDMI port type.
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.tv.hdmi;
|
||||
package android.hardware.tv.hdmi.connection;
|
||||
|
||||
/**
|
||||
* HPD (Hotplug Detection) Signal Types
|
|
@ -14,17 +14,17 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.tv.hdmi;
|
||||
package android.hardware.tv.hdmi.connection;
|
||||
|
||||
import android.hardware.tv.hdmi.HdmiPortInfo;
|
||||
import android.hardware.tv.hdmi.HpdSignal;
|
||||
import android.hardware.tv.hdmi.IHdmiCallback;
|
||||
import android.hardware.tv.hdmi.connection.HdmiPortInfo;
|
||||
import android.hardware.tv.hdmi.connection.HpdSignal;
|
||||
import android.hardware.tv.hdmi.connection.IHdmiConnectionCallback;
|
||||
|
||||
/**
|
||||
* HDMI HAL interface definition.
|
||||
* HDMI Connection HAL interface definition.
|
||||
*/
|
||||
@VintfStability
|
||||
interface IHdmi {
|
||||
interface IHdmiConnection {
|
||||
/**
|
||||
* Gets the hdmi port information of underlying hardware.
|
||||
*
|
||||
|
@ -48,13 +48,18 @@ interface IHdmi {
|
|||
* previously registered callback must be replaced with this one.
|
||||
* setCallback(null) should deregister the callback.
|
||||
*/
|
||||
void setCallback(in IHdmiCallback callback);
|
||||
void setCallback(in IHdmiConnectionCallback callback);
|
||||
|
||||
/**
|
||||
* Method to set the HPD (Hot Plug Detection) signal the HAL should use for HPD signaling (e.g.
|
||||
* signaling EDID updates). By default, the HAL will use {@code HDMI_HPD_PHYSICAL} (the physical
|
||||
* hotplug signal). When set to {@code HDMI_HPD_STATUS_BIT} the HAL should use the HDP status
|
||||
* bit.
|
||||
* @throws ServiceSpecificException with error code set to
|
||||
* {@code Result::FAILURE_NOT_SUPPORTED} if the signal type is not supported.
|
||||
* {@code Result::FAILURE_INVALID_ARGS} if the signal type is invalid.
|
||||
* {@code Result::FAILURE_UNKNOWN} if the signal type could not be set because of an
|
||||
* unknown failure.
|
||||
*/
|
||||
void setHpdSignal(HpdSignal signal);
|
||||
|
|
@ -14,13 +14,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.tv.hdmi;
|
||||
package android.hardware.tv.hdmi.connection;
|
||||
|
||||
/**
|
||||
* Callbacks from the HDMI HAL implementation to notify the system of new events.
|
||||
*/
|
||||
@VintfStability
|
||||
oneway interface IHdmiCallback {
|
||||
oneway interface IHdmiConnectionCallback {
|
||||
/**
|
||||
* The callback function that must be called by HAL implementation to notify
|
||||
* the system of new hotplug event.
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.tv.hdmi;
|
||||
package android.hardware.tv.hdmi.connection;
|
||||
|
||||
/**
|
||||
* Result enum for return values. Used by the HDMI related AIDL.
|
|
@ -17,18 +17,18 @@ package {
|
|||
}
|
||||
|
||||
cc_binary {
|
||||
name: "android.hardware.tv.hdmi-service",
|
||||
vintf_fragments: ["android.hardware.tv.hdmi-service.xml"],
|
||||
name: "android.hardware.tv.hdmi.connection-service",
|
||||
vintf_fragments: ["android.hardware.tv.hdmi.connection-service.xml"],
|
||||
relative_install_path: "hw",
|
||||
vendor: true,
|
||||
cflags: [
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
],
|
||||
init_rc: ["android.hardware.tv.hdmi-service.rc"],
|
||||
init_rc: ["android.hardware.tv.hdmi.connection-service.rc"],
|
||||
srcs: [
|
||||
"serviceMock.cpp",
|
||||
"HdmiMock.cpp",
|
||||
"HdmiConnectionMock.cpp",
|
||||
],
|
||||
shared_libs: [
|
||||
"libbinder_ndk",
|
||||
|
@ -37,20 +37,20 @@ cc_binary {
|
|||
"libutils",
|
||||
"libhardware",
|
||||
"libhidlbase",
|
||||
"android.hardware.tv.hdmi-V1-ndk",
|
||||
"android.hardware.tv.hdmi.connection-V1-ndk",
|
||||
],
|
||||
}
|
||||
|
||||
cc_fuzz {
|
||||
name: "android.hardware.tv.hdmi-service_fuzzer",
|
||||
name: "android.hardware.tv.hdmi.connection-service_fuzzer",
|
||||
defaults: ["service_fuzzer_defaults"],
|
||||
static_libs: [
|
||||
"android.hardware.tv.hdmi-V1-ndk",
|
||||
"android.hardware.tv.hdmi.connection-V1-ndk",
|
||||
"liblog",
|
||||
],
|
||||
srcs: [
|
||||
"fuzzer.cpp",
|
||||
"HdmiMock.cpp",
|
||||
"HdmiConnectionMock.cpp",
|
||||
],
|
||||
fuzz_config: {
|
||||
componentid: 826094,
|
|
@ -14,12 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "android.hardware.tv.hdmi"
|
||||
#define LOG_TAG "android.hardware.tv.hdmi.connection"
|
||||
#include <android-base/logging.h>
|
||||
#include <fcntl.h>
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include "HdmiMock.h"
|
||||
#include "HdmiConnectionMock.h"
|
||||
|
||||
using ndk::ScopedAStatus;
|
||||
|
||||
|
@ -27,20 +27,21 @@ namespace android {
|
|||
namespace hardware {
|
||||
namespace tv {
|
||||
namespace hdmi {
|
||||
namespace connection {
|
||||
namespace implementation {
|
||||
|
||||
void HdmiMock::serviceDied(void* cookie) {
|
||||
ALOGE("HdmiMock died");
|
||||
auto hdmi = static_cast<HdmiMock*>(cookie);
|
||||
void HdmiConnectionMock::serviceDied(void* cookie) {
|
||||
ALOGE("HdmiConnectionMock died");
|
||||
auto hdmi = static_cast<HdmiConnectionMock*>(cookie);
|
||||
hdmi->mHdmiThreadRun = false;
|
||||
}
|
||||
|
||||
ScopedAStatus HdmiMock::getPortInfo(std::vector<HdmiPortInfo>* _aidl_return) {
|
||||
ScopedAStatus HdmiConnectionMock::getPortInfo(std::vector<HdmiPortInfo>* _aidl_return) {
|
||||
*_aidl_return = mPortInfos;
|
||||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ScopedAStatus HdmiMock::isConnected(int32_t portId, bool* _aidl_return) {
|
||||
ScopedAStatus HdmiConnectionMock::isConnected(int32_t portId, bool* _aidl_return) {
|
||||
// Maintain port connection status and update on hotplug event
|
||||
if (portId <= mTotalPorts && portId >= 1) {
|
||||
*_aidl_return = mPortConnectionStatus[portId];
|
||||
|
@ -51,7 +52,8 @@ ScopedAStatus HdmiMock::isConnected(int32_t portId, bool* _aidl_return) {
|
|||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ScopedAStatus HdmiMock::setCallback(const std::shared_ptr<IHdmiCallback>& callback) {
|
||||
ScopedAStatus HdmiConnectionMock::setCallback(
|
||||
const std::shared_ptr<IHdmiConnectionCallback>& callback) {
|
||||
if (mCallback != nullptr) {
|
||||
mCallback = nullptr;
|
||||
}
|
||||
|
@ -67,7 +69,7 @@ ScopedAStatus HdmiMock::setCallback(const std::shared_ptr<IHdmiCallback>& callba
|
|||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ScopedAStatus HdmiMock::setHpdSignal(HpdSignal signal) {
|
||||
ScopedAStatus HdmiConnectionMock::setHpdSignal(HpdSignal signal) {
|
||||
if (mHdmiThreadRun) {
|
||||
mHpdSignal = signal;
|
||||
return ScopedAStatus::ok();
|
||||
|
@ -77,18 +79,18 @@ ScopedAStatus HdmiMock::setHpdSignal(HpdSignal signal) {
|
|||
}
|
||||
}
|
||||
|
||||
ScopedAStatus HdmiMock::getHpdSignal(HpdSignal* _aidl_return) {
|
||||
ScopedAStatus HdmiConnectionMock::getHpdSignal(HpdSignal* _aidl_return) {
|
||||
*_aidl_return = mHpdSignal;
|
||||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
void* HdmiMock::__threadLoop(void* user) {
|
||||
HdmiMock* const self = static_cast<HdmiMock*>(user);
|
||||
void* HdmiConnectionMock::__threadLoop(void* user) {
|
||||
HdmiConnectionMock* const self = static_cast<HdmiConnectionMock*>(user);
|
||||
self->threadLoop();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int HdmiMock::readMessageFromFifo(unsigned char* buf, int msgCount) {
|
||||
int HdmiConnectionMock::readMessageFromFifo(unsigned char* buf, int msgCount) {
|
||||
if (msgCount <= 0 || !buf) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -104,7 +106,7 @@ int HdmiMock::readMessageFromFifo(unsigned char* buf, int msgCount) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
void HdmiMock::printEventBuf(const char* msg_buf, int len) {
|
||||
void HdmiConnectionMock::printEventBuf(const char* msg_buf, int len) {
|
||||
int i, size = 0;
|
||||
const int bufSize = MESSAGE_BODY_MAX_LENGTH * 3;
|
||||
// Use 2 characters for each byte in the message plus 1 space
|
||||
|
@ -117,7 +119,7 @@ void HdmiMock::printEventBuf(const char* msg_buf, int len) {
|
|||
ALOGD("[halimp_aidl] %s, msg:%.*s", __FUNCTION__, size, buf);
|
||||
}
|
||||
|
||||
void HdmiMock::handleHotplugMessage(unsigned char* msgBuf) {
|
||||
void HdmiConnectionMock::handleHotplugMessage(unsigned char* msgBuf) {
|
||||
bool connected = ((msgBuf[3]) & 0xf) > 0;
|
||||
int32_t portId = static_cast<uint32_t>(msgBuf[0] & 0xf);
|
||||
|
||||
|
@ -140,7 +142,7 @@ void HdmiMock::handleHotplugMessage(unsigned char* msgBuf) {
|
|||
}
|
||||
}
|
||||
|
||||
void HdmiMock::threadLoop() {
|
||||
void HdmiConnectionMock::threadLoop() {
|
||||
ALOGD("[halimp_aidl] threadLoop start.");
|
||||
unsigned char msgBuf[MESSAGE_BODY_MAX_LENGTH];
|
||||
int r = -1;
|
||||
|
@ -172,7 +174,7 @@ void HdmiMock::threadLoop() {
|
|||
ALOGD("[halimp_aidl] thread end.");
|
||||
}
|
||||
|
||||
HdmiMock::HdmiMock() {
|
||||
HdmiConnectionMock::HdmiConnectionMock() {
|
||||
ALOGE("[halimp_aidl] Opening a virtual HDMI HAL for testing and virtual machine.");
|
||||
mCallback = nullptr;
|
||||
mPortInfos.resize(mTotalPorts);
|
||||
|
@ -188,6 +190,7 @@ HdmiMock::HdmiMock() {
|
|||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace connection
|
||||
} // namespace hdmi
|
||||
} // namespace tv
|
||||
} // namespace hardware
|
|
@ -14,8 +14,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <aidl/android/hardware/tv/hdmi/BnHdmi.h>
|
||||
#include <aidl/android/hardware/tv/hdmi/Result.h>
|
||||
#include <aidl/android/hardware/tv/hdmi/connection/BnHdmiConnection.h>
|
||||
#include <aidl/android/hardware/tv/hdmi/connection/Result.h>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
|
@ -25,25 +25,27 @@ namespace android {
|
|||
namespace hardware {
|
||||
namespace tv {
|
||||
namespace hdmi {
|
||||
namespace connection {
|
||||
namespace implementation {
|
||||
|
||||
using ::aidl::android::hardware::tv::hdmi::BnHdmi;
|
||||
using ::aidl::android::hardware::tv::hdmi::HdmiPortInfo;
|
||||
using ::aidl::android::hardware::tv::hdmi::HdmiPortType;
|
||||
using ::aidl::android::hardware::tv::hdmi::HpdSignal;
|
||||
using ::aidl::android::hardware::tv::hdmi::IHdmi;
|
||||
using ::aidl::android::hardware::tv::hdmi::IHdmiCallback;
|
||||
using ::aidl::android::hardware::tv::hdmi::Result;
|
||||
using ::aidl::android::hardware::tv::hdmi::connection::BnHdmiConnection;
|
||||
using ::aidl::android::hardware::tv::hdmi::connection::HdmiPortInfo;
|
||||
using ::aidl::android::hardware::tv::hdmi::connection::HdmiPortType;
|
||||
using ::aidl::android::hardware::tv::hdmi::connection::HpdSignal;
|
||||
using ::aidl::android::hardware::tv::hdmi::connection::IHdmiConnection;
|
||||
using ::aidl::android::hardware::tv::hdmi::connection::IHdmiConnectionCallback;
|
||||
using ::aidl::android::hardware::tv::hdmi::connection::Result;
|
||||
|
||||
#define HDMI_MSG_IN_FIFO "/dev/hdmi_in_pipe"
|
||||
#define MESSAGE_BODY_MAX_LENGTH 4
|
||||
|
||||
struct HdmiMock : public BnHdmi {
|
||||
HdmiMock();
|
||||
struct HdmiConnectionMock : public BnHdmiConnection {
|
||||
HdmiConnectionMock();
|
||||
|
||||
::ndk::ScopedAStatus getPortInfo(std::vector<HdmiPortInfo>* _aidl_return) override;
|
||||
::ndk::ScopedAStatus isConnected(int32_t portId, bool* _aidl_return) override;
|
||||
::ndk::ScopedAStatus setCallback(const std::shared_ptr<IHdmiCallback>& callback) override;
|
||||
::ndk::ScopedAStatus setCallback(
|
||||
const std::shared_ptr<IHdmiConnectionCallback>& callback) override;
|
||||
::ndk::ScopedAStatus setHpdSignal(HpdSignal signal) override;
|
||||
::ndk::ScopedAStatus getHpdSignal(HpdSignal* _aidl_return) override;
|
||||
|
||||
|
@ -57,7 +59,7 @@ struct HdmiMock : public BnHdmi {
|
|||
|
||||
private:
|
||||
static void serviceDied(void* cookie);
|
||||
std::shared_ptr<IHdmiCallback> mCallback;
|
||||
std::shared_ptr<IHdmiConnectionCallback> mCallback;
|
||||
|
||||
// Variables for the virtual HDMI hal impl
|
||||
std::vector<HdmiPortInfo> mPortInfos;
|
||||
|
@ -79,6 +81,7 @@ struct HdmiMock : public BnHdmi {
|
|||
::ndk::ScopedAIBinder_DeathRecipient mDeathRecipient;
|
||||
};
|
||||
} // namespace implementation
|
||||
} // namespace connection
|
||||
} // namespace hdmi
|
||||
} // Namespace tv
|
||||
} // namespace hardware
|
|
@ -1,5 +1,5 @@
|
|||
service vendor.hdmi-default /vendor/bin/hw/android.hardware.tv.hdmi-service
|
||||
interface aidl android.hardware.tv.hdmi.IHdmi/default
|
||||
service vendor.hdmi-default /vendor/bin/hw/android.hardware.tv.hdmi.connection-service
|
||||
interface aidl android.hardware.tv.hdmi.connection.IHdmiConnection/default
|
||||
class hal
|
||||
user system
|
||||
group system
|
|
@ -1,9 +1,9 @@
|
|||
<manifest version="1.0" type="device">
|
||||
<hal format="aidl">
|
||||
<name>android.hardware.tv.hdmi</name>
|
||||
<name>android.hardware.tv.hdmi.connection</name>
|
||||
<version>1</version>
|
||||
<interface>
|
||||
<name>IHdmi</name>
|
||||
<name>IHdmiConnection</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
|
@ -13,16 +13,16 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include <HdmiMock.h>
|
||||
#include <HdmiConnectionMock.h>
|
||||
#include <fuzzbinder/libbinder_ndk_driver.h>
|
||||
#include <fuzzer/FuzzedDataProvider.h>
|
||||
|
||||
using android::fuzzService;
|
||||
using android::hardware::tv::hdmi::implementation::HdmiMock;
|
||||
using android::hardware::tv::hdmi::connection::implementation::HdmiConnectionMock;
|
||||
using ndk::SharedRefBase;
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||
auto hdmiAidl = SharedRefBase::make<HdmiMock>();
|
||||
auto hdmiAidl = SharedRefBase::make<HdmiConnectionMock>();
|
||||
|
||||
fuzzService(hdmiAidl->asBinder().get(), FuzzedDataProvider(data, size));
|
||||
|
|
@ -14,23 +14,23 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "android.hardware.tv.hdmi-service-shim"
|
||||
#define LOG_TAG "android.hardware.tv.hdmi.connection-service-shim"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <android/binder_manager.h>
|
||||
#include <android/binder_process.h>
|
||||
#include <hidl/HidlTransportSupport.h>
|
||||
#include <utils/Log.h>
|
||||
#include "HdmiMock.h"
|
||||
#include "HdmiConnectionMock.h"
|
||||
|
||||
using android::hardware::tv::hdmi::implementation::HdmiMock;
|
||||
using android::hardware::tv::hdmi::connection::implementation::HdmiConnectionMock;
|
||||
|
||||
int main() {
|
||||
ABinderProcess_setThreadPoolMaxThreadCount(1);
|
||||
ABinderProcess_startThreadPool();
|
||||
|
||||
std::shared_ptr<HdmiMock> hdmiAidl = ndk::SharedRefBase::make<HdmiMock>();
|
||||
const std::string instance = std::string() + HdmiMock::descriptor + "/default";
|
||||
std::shared_ptr<HdmiConnectionMock> hdmiAidl = ndk::SharedRefBase::make<HdmiConnectionMock>();
|
||||
const std::string instance = std::string() + HdmiConnectionMock::descriptor + "/default";
|
||||
binder_status_t status =
|
||||
AServiceManager_addService(hdmiAidl->asBinder().get(), instance.c_str());
|
||||
CHECK_EQ(status, STATUS_OK);
|
|
@ -17,14 +17,14 @@ package {
|
|||
}
|
||||
|
||||
cc_test {
|
||||
name: "VtsHalTvEArcAidlTargetTest",
|
||||
name: "VtsHalTvHdmiConnectionAidlTargetTest",
|
||||
defaults: [
|
||||
"VtsHalTargetTestDefaults",
|
||||
"use_libaidlvintf_gtest_helper_static",
|
||||
],
|
||||
srcs: ["VtsHalTvEArcAidlTargetTest.cpp"],
|
||||
srcs: ["VtsHalTvHdmiConnectionAidlTargetTest.cpp"],
|
||||
static_libs: [
|
||||
"android.hardware.tv.earc-V1-ndk",
|
||||
"android.hardware.tv.hdmi.connection-V1-ndk",
|
||||
],
|
||||
shared_libs: [
|
||||
"libbinder_ndk",
|
|
@ -0,0 +1,126 @@
|
|||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "Hdmi_Connection_hal_test"
|
||||
|
||||
#include <aidl/Gtest.h>
|
||||
#include <aidl/Vintf.h>
|
||||
#include <aidl/android/hardware/tv/hdmi/connection/BnHdmiConnection.h>
|
||||
#include <aidl/android/hardware/tv/hdmi/connection/BnHdmiConnectionCallback.h>
|
||||
#include <android-base/logging.h>
|
||||
#include <android/binder_manager.h>
|
||||
#include <android/binder_process.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <log/log.h>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
using ::aidl::android::hardware::tv::hdmi::connection::BnHdmiConnectionCallback;
|
||||
using ::aidl::android::hardware::tv::hdmi::connection::HdmiPortInfo;
|
||||
using ::aidl::android::hardware::tv::hdmi::connection::HdmiPortType;
|
||||
using ::aidl::android::hardware::tv::hdmi::connection::HpdSignal;
|
||||
using ::aidl::android::hardware::tv::hdmi::connection::IHdmiConnection;
|
||||
using ::aidl::android::hardware::tv::hdmi::connection::IHdmiConnectionCallback;
|
||||
using ::ndk::SpAIBinder;
|
||||
|
||||
#define INCORRECT_VENDOR_ID 0x00
|
||||
#define TV_PHYSICAL_ADDRESS 0x0000
|
||||
|
||||
// The main test class for TV HDMI Connection HAL.
|
||||
class HdmiConnectionTest : public ::testing::TestWithParam<std::string> {
|
||||
static void serviceDied(void* /* cookie */) {
|
||||
ALOGE("VtsHalTvHdmiConnectionAidlTargetTest died");
|
||||
}
|
||||
|
||||
public:
|
||||
void SetUp() override {
|
||||
hdmiConnection = IHdmiConnection::fromBinder(
|
||||
SpAIBinder(AServiceManager_waitForService(GetParam().c_str())));
|
||||
ASSERT_NE(hdmiConnection, nullptr);
|
||||
ALOGI("%s: getService() for hdmiConnection is %s", __func__,
|
||||
hdmiConnection->isRemote() ? "remote" : "local");
|
||||
|
||||
hdmiConnectionCallback = ::ndk::SharedRefBase::make<HdmiConnectionCallback>();
|
||||
ASSERT_NE(hdmiConnectionCallback, nullptr);
|
||||
hdmiConnectionDeathRecipient =
|
||||
ndk::ScopedAIBinder_DeathRecipient(AIBinder_DeathRecipient_new(&serviceDied));
|
||||
ASSERT_EQ(AIBinder_linkToDeath(hdmiConnection->asBinder().get(),
|
||||
hdmiConnectionDeathRecipient.get(), 0),
|
||||
STATUS_OK);
|
||||
}
|
||||
|
||||
class HdmiConnectionCallback : public BnHdmiConnectionCallback {
|
||||
public:
|
||||
::ndk::ScopedAStatus onHotplugEvent(bool connected __unused, int32_t portId __unused) {
|
||||
return ::ndk::ScopedAStatus::ok();
|
||||
};
|
||||
};
|
||||
|
||||
std::shared_ptr<IHdmiConnection> hdmiConnection;
|
||||
std::shared_ptr<IHdmiConnectionCallback> hdmiConnectionCallback;
|
||||
::ndk::ScopedAIBinder_DeathRecipient hdmiConnectionDeathRecipient;
|
||||
};
|
||||
|
||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(HdmiConnectionTest);
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, HdmiConnectionTest,
|
||||
testing::ValuesIn(android::getAidlHalInstanceNames(IHdmiConnection::descriptor)),
|
||||
android::PrintInstanceNameToString);
|
||||
|
||||
TEST_P(HdmiConnectionTest, SetCallback) {
|
||||
ASSERT_TRUE(hdmiConnection->setCallback(::ndk::SharedRefBase::make<HdmiConnectionCallback>())
|
||||
.isOk());
|
||||
}
|
||||
|
||||
TEST_P(HdmiConnectionTest, GetPortInfo) {
|
||||
std::vector<HdmiPortInfo> ports;
|
||||
ASSERT_TRUE(hdmiConnection->getPortInfo(&ports).isOk());
|
||||
|
||||
bool cecSupportedOnDevice = false;
|
||||
for (size_t i = 0; i < ports.size(); ++i) {
|
||||
EXPECT_TRUE((ports[i].type == HdmiPortType::OUTPUT) ||
|
||||
(ports[i].type == HdmiPortType::INPUT));
|
||||
if (ports[i].portId == 0) {
|
||||
ALOGW("%s: Port id should start from 1", __func__);
|
||||
}
|
||||
cecSupportedOnDevice = cecSupportedOnDevice | ports[i].cecSupported;
|
||||
}
|
||||
EXPECT_NE(cecSupportedOnDevice, false) << "At least one port should support CEC";
|
||||
}
|
||||
|
||||
TEST_P(HdmiConnectionTest, IsConnected) {
|
||||
std::vector<HdmiPortInfo> ports;
|
||||
ASSERT_TRUE(hdmiConnection->getPortInfo(&ports).isOk());
|
||||
for (size_t i = 0; i < ports.size(); ++i) {
|
||||
bool connected;
|
||||
ASSERT_TRUE(hdmiConnection->isConnected(ports[i].portId, &connected).isOk());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(HdmiConnectionTest, HdpSignal) {
|
||||
HpdSignal originalSignal;
|
||||
HpdSignal signal = HpdSignal::HDMI_HPD_STATUS_BIT;
|
||||
HpdSignal readSignal;
|
||||
ASSERT_TRUE(hdmiConnection->getHpdSignal(&originalSignal).isOk());
|
||||
ASSERT_TRUE(hdmiConnection->setHpdSignal(signal).isOk());
|
||||
ASSERT_TRUE(hdmiConnection->getHpdSignal(&readSignal).isOk());
|
||||
EXPECT_EQ(readSignal, signal);
|
||||
signal = HpdSignal::HDMI_HPD_PHYSICAL;
|
||||
ASSERT_TRUE(hdmiConnection->setHpdSignal(signal).isOk());
|
||||
ASSERT_TRUE(hdmiConnection->getHpdSignal(&readSignal).isOk());
|
||||
EXPECT_EQ(readSignal, signal);
|
||||
ASSERT_TRUE(hdmiConnection->setHpdSignal(originalSignal).isOk());
|
||||
}
|
|
@ -17,9 +17,10 @@ package {
|
|||
}
|
||||
|
||||
aidl_interface {
|
||||
name: "android.hardware.tv.earc",
|
||||
name: "android.hardware.tv.hdmi.earc",
|
||||
vendor_available: true,
|
||||
srcs: ["android/hardware/tv/earc/*.aidl"],
|
||||
srcs: ["android/hardware/tv/hdmi/earc/*.aidl"],
|
||||
imports: ["android.hardware.tv.hdmi.connection-V1"],
|
||||
stability: "vintf",
|
||||
backend: {
|
||||
java: {
|
|
@ -31,12 +31,12 @@
|
|||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package android.hardware.tv.earc;
|
||||
package android.hardware.tv.hdmi.earc;
|
||||
@VintfStability
|
||||
interface IEArc {
|
||||
void setEArcEnabled(in boolean enabled);
|
||||
boolean isEArcEnabled();
|
||||
void setCallback(in android.hardware.tv.earc.IEArcCallback callback);
|
||||
android.hardware.tv.earc.IEArcStatus getState(in int portId);
|
||||
void setCallback(in android.hardware.tv.hdmi.earc.IEArcCallback callback);
|
||||
android.hardware.tv.hdmi.earc.IEArcStatus getState(in int portId);
|
||||
byte[] getLastReportedAudioCapabilities(in int portId);
|
||||
}
|
|
@ -31,9 +31,9 @@
|
|||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package android.hardware.tv.earc;
|
||||
package android.hardware.tv.hdmi.earc;
|
||||
@VintfStability
|
||||
interface IEArcCallback {
|
||||
oneway void onStateChange(in android.hardware.tv.earc.IEArcStatus status, in int portId);
|
||||
oneway void onStateChange(in android.hardware.tv.hdmi.earc.IEArcStatus status, in int portId);
|
||||
oneway void onCapabilitiesReported(in byte[] rawCapabilities, in int portId);
|
||||
}
|
|
@ -31,7 +31,7 @@
|
|||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package android.hardware.tv.earc;
|
||||
package android.hardware.tv.hdmi.earc;
|
||||
@Backing(type="byte") @VintfStability
|
||||
enum IEArcStatus {
|
||||
STATUS_IDLE = 0,
|
|
@ -31,7 +31,7 @@
|
|||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package android.hardware.tv.earc;
|
||||
package android.hardware.tv.hdmi.earc;
|
||||
@VintfStability
|
||||
enum Result {
|
||||
SUCCESS = 0,
|
|
@ -14,10 +14,10 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.tv.earc;
|
||||
package android.hardware.tv.hdmi.earc;
|
||||
|
||||
import android.hardware.tv.earc.IEArcCallback;
|
||||
import android.hardware.tv.earc.IEArcStatus;
|
||||
import android.hardware.tv.hdmi.earc.IEArcCallback;
|
||||
import android.hardware.tv.hdmi.earc.IEArcStatus;
|
||||
|
||||
/**
|
||||
* eARC HAL interface definition
|
||||
|
@ -30,11 +30,13 @@ interface IEArc {
|
|||
* updates with IEArcCallback callbacks. If disabled, the driver and HAL shall not attempt to
|
||||
* establish an eARC connection and shall not send any IEArcCallback callbacks to the Android
|
||||
* framework.
|
||||
* The error status is set to
|
||||
* {@code SUCCESS} if the setting could be changed to the value passed.
|
||||
* {@code FAILURE_NOT_SUPPORTED} if the setting is not supported.
|
||||
* {@code FAILURE_INVALID_ARGS} if the setting value is invalid.
|
||||
* {@code FAILURE_UNKNOWN} if there was an unknown failure.
|
||||
* @throws ServiceSpecificException with error code set to
|
||||
* {@code Result::FAILURE_NOT_SUPPORTED} if the eARC enabled setting could not be set
|
||||
* because this is not supported.
|
||||
* {@code Result::FAILURE_INVALID_ARGS} if the eARC enabled setting could not be set
|
||||
* because the method argument is invalid.
|
||||
* {@code Result::FAILURE_UNKNOWN} if the eARC enabled setting could not be set because
|
||||
* there was an unknown failure.
|
||||
*/
|
||||
void setEArcEnabled(in boolean enabled);
|
||||
|
|
@ -14,9 +14,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.tv.earc;
|
||||
package android.hardware.tv.hdmi.earc;
|
||||
|
||||
import android.hardware.tv.earc.IEArcStatus;
|
||||
import android.hardware.tv.hdmi.earc.IEArcStatus;
|
||||
|
||||
/**
|
||||
* eARC HAL callback methods
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.tv.earc;
|
||||
package android.hardware.tv.hdmi.earc;
|
||||
|
||||
/**
|
||||
* eARC HAL connection states
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.tv.earc;
|
||||
package android.hardware.tv.hdmi.earc;
|
||||
|
||||
/**
|
||||
* Result enum for return values. Used by the HDMI related AIDL.
|
|
@ -17,15 +17,15 @@ package {
|
|||
}
|
||||
|
||||
cc_binary {
|
||||
name: "android.hardware.tv.earc-service",
|
||||
vintf_fragments: ["android.hardware.tv.earc-service.xml"],
|
||||
name: "android.hardware.tv.hdmi.earc-service",
|
||||
vintf_fragments: ["android.hardware.tv.hdmi.earc-service.xml"],
|
||||
relative_install_path: "hw",
|
||||
vendor: true,
|
||||
cflags: [
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
],
|
||||
init_rc: ["android.hardware.tv.earc-service.rc"],
|
||||
init_rc: ["android.hardware.tv.hdmi.earc-service.rc"],
|
||||
srcs: [
|
||||
"serviceMock.cpp",
|
||||
"EArcMock.cpp",
|
||||
|
@ -37,15 +37,15 @@ cc_binary {
|
|||
"libutils",
|
||||
"libhardware",
|
||||
"libhidlbase",
|
||||
"android.hardware.tv.earc-V1-ndk",
|
||||
"android.hardware.tv.hdmi.earc-V1-ndk",
|
||||
],
|
||||
}
|
||||
|
||||
cc_fuzz {
|
||||
name: "android.hardware.tv.earc-service_fuzzer",
|
||||
name: "android.hardware.tv.hdmi.earc-service_fuzzer",
|
||||
defaults: ["service_fuzzer_defaults"],
|
||||
static_libs: [
|
||||
"android.hardware.tv.earc-V1-ndk",
|
||||
"android.hardware.tv.hdmi.earc-V1-ndk",
|
||||
"liblog",
|
||||
],
|
||||
srcs: [
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "android.hardware.tv.earc"
|
||||
#define LOG_TAG "android.hardware.tv.hdmi.earc"
|
||||
#include <android-base/logging.h>
|
||||
#include <fcntl.h>
|
||||
#include <utils/Log.h>
|
||||
|
@ -26,6 +26,7 @@ using ndk::ScopedAStatus;
|
|||
namespace android {
|
||||
namespace hardware {
|
||||
namespace tv {
|
||||
namespace hdmi {
|
||||
namespace earc {
|
||||
namespace implementation {
|
||||
|
||||
|
@ -114,6 +115,7 @@ EArcMock::EArcMock() {
|
|||
|
||||
} // namespace implementation
|
||||
} // namespace earc
|
||||
} // namespace hdmi
|
||||
} // namespace tv
|
||||
} // namespace hardware
|
||||
} // namespace android
|
|
@ -14,8 +14,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <aidl/android/hardware/tv/earc/BnEArc.h>
|
||||
#include <aidl/android/hardware/tv/earc/Result.h>
|
||||
#include <aidl/android/hardware/tv/hdmi/earc/BnEArc.h>
|
||||
#include <aidl/android/hardware/tv/hdmi/earc/Result.h>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
|
@ -24,14 +24,15 @@ using namespace std;
|
|||
namespace android {
|
||||
namespace hardware {
|
||||
namespace tv {
|
||||
namespace hdmi {
|
||||
namespace earc {
|
||||
namespace implementation {
|
||||
|
||||
using ::aidl::android::hardware::tv::earc::BnEArc;
|
||||
using ::aidl::android::hardware::tv::earc::IEArc;
|
||||
using ::aidl::android::hardware::tv::earc::IEArcCallback;
|
||||
using ::aidl::android::hardware::tv::earc::IEArcStatus;
|
||||
using ::aidl::android::hardware::tv::earc::Result;
|
||||
using ::aidl::android::hardware::tv::hdmi::earc::BnEArc;
|
||||
using ::aidl::android::hardware::tv::hdmi::earc::IEArc;
|
||||
using ::aidl::android::hardware::tv::hdmi::earc::IEArcCallback;
|
||||
using ::aidl::android::hardware::tv::hdmi::earc::IEArcStatus;
|
||||
using ::aidl::android::hardware::tv::hdmi::earc::Result;
|
||||
|
||||
struct EArcMock : public BnEArc {
|
||||
EArcMock();
|
||||
|
@ -69,6 +70,7 @@ struct EArcMock : public BnEArc {
|
|||
};
|
||||
} // namespace implementation
|
||||
} // namespace earc
|
||||
} // Namespace hdmi
|
||||
} // Namespace tv
|
||||
} // namespace hardware
|
||||
} // namespace android
|
|
@ -0,0 +1,5 @@
|
|||
service vendor.earc-default /vendor/bin/hw/android.hardware.tv.hdmi.earc-service
|
||||
interface aidl android.hardware.tv.hdmi.earc.IEArc/default
|
||||
class hal
|
||||
user system
|
||||
group system
|
|
@ -1,6 +1,6 @@
|
|||
<manifest version="1.0" type="device">
|
||||
<hal format="aidl">
|
||||
<name>android.hardware.tv.earc</name>
|
||||
<name>android.hardware.tv.hdmi.earc</name>
|
||||
<version>1</version>
|
||||
<interface>
|
||||
<name>IEArc</name>
|
|
@ -18,7 +18,7 @@
|
|||
#include <fuzzer/FuzzedDataProvider.h>
|
||||
|
||||
using android::fuzzService;
|
||||
using android::hardware::tv::earc::implementation::EArcMock;
|
||||
using android::hardware::tv::hdmi::earc::implementation::EArcMock;
|
||||
using ndk::SharedRefBase;
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "android.hardware.tv.earc-service-shim"
|
||||
#define LOG_TAG "android.hardware.tv.hdmi.earc-service-shim"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <android/binder_manager.h>
|
||||
|
@ -23,7 +23,7 @@
|
|||
#include <utils/Log.h>
|
||||
#include "EArcMock.h"
|
||||
|
||||
using android::hardware::tv::earc::implementation::EArcMock;
|
||||
using android::hardware::tv::hdmi::earc::implementation::EArcMock;
|
||||
|
||||
int main() {
|
||||
ABinderProcess_setThreadPoolMaxThreadCount(1);
|
|
@ -17,14 +17,14 @@ package {
|
|||
}
|
||||
|
||||
cc_test {
|
||||
name: "VtsHalTvHdmiAidlTargetTest",
|
||||
name: "VtsHalTvHdmiEArcAidlTargetTest",
|
||||
defaults: [
|
||||
"VtsHalTargetTestDefaults",
|
||||
"use_libaidlvintf_gtest_helper_static",
|
||||
],
|
||||
srcs: ["VtsHalTvHdmiAidlTargetTest.cpp"],
|
||||
srcs: ["VtsHalTvHdmiEArcAidlTargetTest.cpp"],
|
||||
static_libs: [
|
||||
"android.hardware.tv.hdmi-V1-ndk",
|
||||
"android.hardware.tv.hdmi.earc-V1-ndk",
|
||||
],
|
||||
shared_libs: [
|
||||
"libbinder_ndk",
|
|
@ -18,9 +18,9 @@
|
|||
|
||||
#include <aidl/Gtest.h>
|
||||
#include <aidl/Vintf.h>
|
||||
#include <aidl/android/hardware/tv/earc/BnEArcCallback.h>
|
||||
#include <aidl/android/hardware/tv/earc/IEArc.h>
|
||||
#include <aidl/android/hardware/tv/earc/IEArcStatus.h>
|
||||
#include <aidl/android/hardware/tv/hdmi/earc/BnEArcCallback.h>
|
||||
#include <aidl/android/hardware/tv/hdmi/earc/IEArc.h>
|
||||
#include <aidl/android/hardware/tv/hdmi/earc/IEArcStatus.h>
|
||||
#include <android-base/logging.h>
|
||||
#include <android/binder_manager.h>
|
||||
#include <android/binder_process.h>
|
||||
|
@ -29,10 +29,10 @@
|
|||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
using ::aidl::android::hardware::tv::earc::BnEArcCallback;
|
||||
using ::aidl::android::hardware::tv::earc::IEArc;
|
||||
using ::aidl::android::hardware::tv::earc::IEArcCallback;
|
||||
using ::aidl::android::hardware::tv::earc::IEArcStatus;
|
||||
using ::aidl::android::hardware::tv::hdmi::earc::BnEArcCallback;
|
||||
using ::aidl::android::hardware::tv::hdmi::earc::IEArc;
|
||||
using ::aidl::android::hardware::tv::hdmi::earc::IEArcCallback;
|
||||
using ::aidl::android::hardware::tv::hdmi::earc::IEArcStatus;
|
||||
using ::ndk::SpAIBinder;
|
||||
|
||||
// The main test class for TV EARC HAL.
|
Loading…
Reference in a new issue