hdmi插入,信号源app hdmi连接logo显示
hdmi拔掉,信号源app hdmi连接logo不显示
代码流程分析。
一,
hdmi在插入时,5v检测会探测到是哪个hdmi插入的。
我猜测tv_input.amlogic.so会一直read这个状态。
tv_input( 4331): TvCallback::onTvEvent source = 7, status = 0
hdmi拔掉的时候,amlogic不开源的tv_input.amlogic.so向上层callback一个消息。source=7 代表是hdmi3,status = 0代表拔掉。
vendor/amlogic/apps/TvLibRelease/tv_input/tv_input.cpp
static int notify_HDMI_device_available(tv_input_private_t *priv, tv_source_input_t source_input, uint32_t port_id, int type)
{
tv_input_event_t event;
event.device_info.device_id = source_input;
event.device_info.type = TV_INPUT_TYPE_HDMI;
event.type = type;
event.device_info.hdmi.port_id = port_id;
event.device_info.audio_type = AUDIO_DEVICE_NONE;
event.device_info.audio_address = NULL;
priv->callback->notify(&priv->device, &event, priv->callback_data);
return 0;
}
二,frameworks/base/services/core/jni/com_android_server_tv_TvInputHal.cpp
void JTvInputHal::notify(
tv_input_device_t* dev, tv_input_event_t* event, void* data) {
JTvInputHal* thiz = (JTvInputHal*)data;
ALOGE("JTvInputHal notify sendMessage"+event->type);
thiz->mLooper->sendMessage(new NotifyHandler(thiz, event), event->type);
}
void JTvInputHal::NotifyHandler::handleMessage(const Message& message) {
switch (mEvent.type) {
case TV_INPUT_EVENT_DEVICE_AVAILABLE: {
mHal->onDeviceAvailable(mEvent.device_info);
} break;
case TV_INPUT_EVENT_DEVICE_UNAVAILABLE: {
ALOGE("TV_INPUT_EVENT_DEVICE_UNAVAILABLE device_id"+mEvent.device_info.device_id);
mHal->onDeviceUnavailable(mEvent.device_info.device_id);
} break;
case TV_INPUT_EVENT_STREAM_CONFIGURATIONS_CHANGED: {
mHal->onStreamConfigurationsChanged(mEvent.device_info.device_id);
} break;
case TV_INPUT_EVENT_CAPTURE_SUCCEEDED: {
mHal->onCaptured(mEvent.capture_result.device_id,
mEvent.capture_result.stream_id,
mEvent.capture_result.seq,
true /* succeeded */);
} break;
case TV_INPUT_EVENT_CAPTURE_FAILED: {
mHal->onCaptured(mEvent.capture_result.device_id,
mEvent.capture_result.stream_id,
mEvent.capture_result.seq,
false /* succeeded */);
} break;
default:
ALOGE("Unrecognizable event");
}
}
走到这, case TV_INPUT_EVENT_DEVICE_UNAVAILABLE: {
ALOGE("TV_INPUT_EVENT_DEVICE_UNAVAILABLE device_id"+mEvent.device_info.device_id);
mHal->onDeviceUnavailable(mEvent.device_info.device_id);
} break;
void JTvInputHal::onDeviceUnavailable(int deviceId) {
{
Mutex::Autolock autoLock(&mLock);
KeyedVector<int, Connection>& connections = mConnections.editValueFor(deviceId);
for (size_t i = 0; i < connections.size(); ++i) {
removeStream(deviceId, connections.keyAt(i));
}
connections.clear();
mConnections.removeItem(deviceId);