Skip to content

Commit

Permalink
Merge pull request xbmc#24969 from hugbug/hdmi-wakeup
Browse files Browse the repository at this point in the history
[Android] Fix wake-up when sleeping with active hdmi
  • Loading branch information
thexai authored Apr 12, 2024
2 parents 3b8ff14 + cf5b427 commit 72c6e74
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions xbmc/platform/android/activity/XBMCApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1332,22 +1332,21 @@ void CXBMCApp::onReceive(CJNIIntent intent)
}
else if (action == CJNIAudioManager::ACTION_HDMI_AUDIO_PLUG)
{
m_supportsHdmiAudioPlug = true;
const bool hdmiPlugged = (intent.getIntExtra(CJNIAudioManager::EXTRA_AUDIO_PLUG_STATE, 0) != 0);
android_printf("-- HDMI is plugged in: %s", hdmiPlugged ? "yes" : "no");
m_hdmiPlugged = (intent.getIntExtra(CJNIAudioManager::EXTRA_AUDIO_PLUG_STATE, 0) != 0);
android_printf("-- HDMI is plugged in: %s", m_hdmiPlugged ? "yes" : "no");
if (g_application.IsInitialized())
{
CWinSystemBase* winSystem = CServiceBroker::GetWinSystem();
if (winSystem && dynamic_cast<CWinSystemAndroid*>(winSystem))
dynamic_cast<CWinSystemAndroid*>(winSystem)->SetHdmiState(hdmiPlugged);
dynamic_cast<CWinSystemAndroid*>(winSystem)->SetHdmiState(m_hdmiPlugged);
}
if (hdmiPlugged && m_aeReset)
if (m_hdmiPlugged && m_aeReset)
{
android_printf("CXBMCApp::onReceive: Reset audio engine");
CServiceBroker::GetActiveAE()->DeviceChange();
m_aeReset = false;
}
if (hdmiPlugged && m_wakeUp)
if (m_hdmiPlugged && m_wakeUp)
{
OnWakeup();
m_wakeUp = false;
Expand All @@ -1361,11 +1360,11 @@ void CXBMCApp::onReceive(CJNIIntent intent)
// screen but it is actually sent in response to changes in the overall interactive state of
// the device.
CLog::Log(LOGINFO, "Got device wakeup intent");
if (m_supportsHdmiAudioPlug)
if (m_hdmiPlugged)
OnWakeup();
else
// wake-up sequence continues in ACTION_HDMI_AUDIO_PLUG intent
m_wakeUp = true;
else
OnWakeup();
}
else if (action == CJNIIntent::ACTION_SCREEN_OFF)
{
Expand Down
2 changes: 1 addition & 1 deletion xbmc/platform/android/activity/XBMCApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ class CXBMCApp : public IActivityHandler,
bool m_hdmiSource{false};
bool m_wakeUp{false};
bool m_aeReset{false};
bool m_supportsHdmiAudioPlug{false};
bool m_hdmiPlugged{true};
IInputDeviceCallbacks* m_inputDeviceCallbacks{nullptr};
IInputDeviceEventHandler* m_inputDeviceEventHandler{nullptr};
bool m_hasReqVisible{false};
Expand Down

0 comments on commit 72c6e74

Please sign in to comment.