diff --git a/sdrbase/util/android.cpp b/sdrbase/util/android.cpp index 40f95d5b8..3e72ca855 100644 --- a/sdrbase/util/android.cpp +++ b/sdrbase/util/android.cpp @@ -95,6 +95,38 @@ void Android::moveTaskToBack() } } +void Android::acquireWakeLock() +{ + QJniObject activity = QJniObject::callStaticObjectMethod("org/qtproject/qt5/android/QtNative", "activity", "()Landroid/app/Activity;"); + if (activity.isValid()) { + activity.callMethod("acquireWakeLock"); + } +} + +void Android::releaseWakeLock() +{ + QJniObject activity = QJniObject::callStaticObjectMethod("org/qtproject/qt5/android/QtNative", "activity", "()Landroid/app/Activity;"); + if (activity.isValid()) { + activity.callMethod("releaseWakeLock"); + } +} + +void Android::acquireScreenLock() +{ + QJniObject activity = QJniObject::callStaticObjectMethod("org/qtproject/qt5/android/QtNative", "activity", "()Landroid/app/Activity;"); + if (activity.isValid()) { + activity.callMethod("acquireScreenLock"); + } +} + +void Android::releaseScreenLock() +{ + QJniObject activity = QJniObject::callStaticObjectMethod("org/qtproject/qt5/android/QtNative", "activity", "()Landroid/app/Activity;"); + if (activity.isValid()) { + activity.callMethod("releaseScreenLock"); + } +} + #else // QT_VERSION #include diff --git a/sdrgui/mainwindow.cpp b/sdrgui/mainwindow.cpp index ebe0071d8..1b265f560 100644 --- a/sdrgui/mainwindow.cpp +++ b/sdrgui/mainwindow.cpp @@ -1143,7 +1143,7 @@ void LoadConfigurationFSM::restoreGeometry() m_mainWindow->m_workspaces[i]->adjustSubWindowsAfterRestore(); #ifdef ANDROID // On Android, workspaces seem to be restored to 0,20, rather than 0,0 - m_mainWindow->m_workspaces[i]->move(m_workspaces[i]->pos().x(), 0); + m_mainWindow->m_workspaces[i]->move(m_mainWindow->m_workspaces[i]->pos().x(), 0); // Need to call updateGeometry, otherwise sometimes the layout is corrupted m_mainWindow->m_workspaces[i]->updateGeometry(); #endif