You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
1.9 KiB

/*
* Copyright (c) Hisilicon Technologies Co., Ltd.. 2019-2022. All rights reserved.
* Description: Support hwdisplay hal adaptation interface
* Author: Hisilicon
* Created: 2022-12-28
*/
#define LOG_NDEBUG 0
#define LOG_TAG "DispManager"
#include "DispManager.h"
#include "LogTool.h"
#include "IDispManager.h"
namespace android {
IDispManager *DispCreator::mITVManager = nullptr;
Mutex DispCreator::mITVManagerLock;
int DispManager::SetListener(const sp<IDispListener> &listener)
{
TLOGI("setListener");
Mutex::Autolock lock(mLock);
mListener = listener;
return NO_ERROR;
}
void DispManager::Notify(unsigned int type, const void *data, unsigned int len)
{
TLOGI("enter notifyReceived type=0x%X (%d)", type, type);
if (mListener.get() != nullptr) {
TLOGI("notifyReceived");
mListener->Notify(type, data, len);
}
}
status_t DispManager::Invoke(const hardware::Parcel &request, hardware::Parcel *reply)
{
if (reply == nullptr) {
TLOGE("reply is NULL");
return TD_FAILURE;
}
if (mClient.get() != nullptr) {
if (mClient->Invoke(request, reply) != TD_SUCCESS) {
TLOGE("invoke failure");
} else {
return reply->readInt32();
}
}
TLOGE("===========DispManager::invoke failed=========");
return TD_FAILURE;
}
void DispManager::RegisterCallback(const unsigned int eventId)
{
mClient->RegisterCallback(eventId, this);
}
void DispManager::UnRegisterCallback(const unsigned int eventId)
{
mClient->UnRegisterCallback(eventId, this);
}
void DispManager::InitTvClient()
{
mClient = new DispClient();
}
IDispManager *DispCreator::Create()
{
Mutex::Autolock lock(mITVManagerLock);
if (mITVManager == nullptr) {
mITVManager = new DispManager();
}
return mITVManager;
}
IDispManager *DispCreator::GetmITVManagerValue()
{
return mITVManager;
}
}; // namespace android