Skip to content

Commit

Permalink
Merge pull request xbmc#24993 from hugbug/hdmi-wakeup-omega
Browse files Browse the repository at this point in the history
[backport][Android] Fix wake-up when sleeping with active hdmi
  • Loading branch information
ksooo committed Apr 16, 2024
2 parents 3fd3402 + 0bd4b28 commit 6e73650
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
Expand Up @@ -1333,22 +1333,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 @@ -1362,11 +1361,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
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 6e73650

Please sign in to comment.