diff options
author | Assam Boudjelthia <assam.boudjelthia@qt.io> | 2023-09-17 23:13:04 +0300 |
---|---|---|
committer | Assam Boudjelthia <assam.boudjelthia@qt.io> | 2023-11-10 21:57:11 +0200 |
commit | f5e230285147efa95f32594f9b2e2581de819e47 (patch) | |
tree | 390361318043e9a156518c87512fc6983feedf9a /tests/auto/corelib/platform/android/tst_android.cpp | |
parent | 19baa077d9d2c3c8c10325ddb04e8f36112e477d (diff) |
Android: don't call delegates outside of the Activity
The delegate classes shouldn't be used outside of the Activity/Service
classes, since they're practically private implementation, so don't use
them anywhere outside Activity/Service.
Since Qt Android apps still mainly support having one QtActivity/
QtService, QtNative heavily uses those objects to do various operations.
For that reason, we still need to use the delegate there. The aim is
to change that in future patches and do the operations where they make
more sense for example directly under QtActivityBase/QtActivityDelegate
or Service counterpart.
The QtServiceDelegate is used no where and have no special
implementation, so it's removed here.
Task-number: QTBUG-118077
Change-Id: I5e106318169be19fec8163e8e500ee573af0e1bc
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'tests/auto/corelib/platform/android/tst_android.cpp')
-rw-r--r-- | tests/auto/corelib/platform/android/tst_android.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/auto/corelib/platform/android/tst_android.cpp b/tests/auto/corelib/platform/android/tst_android.cpp index 1be12e0c33..8d0bf1e72c 100644 --- a/tests/auto/corelib/platform/android/tst_android.cpp +++ b/tests/auto/corelib/platform/android/tst_android.cpp @@ -199,11 +199,14 @@ void tst_Android::testRunOnAndroidMainThread() } } +Q_DECLARE_JNI_CLASS(QtActivityDelegate, "org/qtproject/qt/android/QtActivityDelegate") + void setSystemUiVisibility(int visibility) { QNativeInterface::QAndroidApplication::runOnAndroidMainThread([visibility] { - QJniObject::callStaticMethod<void>("org/qtproject/qt/android/QtNative", - "setSystemUiVisibility", "(I)V", visibility); + auto context = QNativeInterface::QAndroidApplication::context(); + auto activityDelegate = context.callMethod<QtJniTypes::QtActivityDelegate>("getActivityDelegate"); + activityDelegate.callMethod<void>("setSystemUiVisibility", jint(visibility)); }).waitForFinished(); } |