From f2d7a45b74e42a69070d08d65052b293af3ea4ef Mon Sep 17 00:00:00 2001 From: Mykola Baibuz Date: Fri, 23 Sep 2022 21:50:25 +0300 Subject: [PATCH] Set security screen for Android app This will guarantee that even apps running with root privileges are unable to directly capture information displayed by the app on the screen. --- client/ui/pages_logic/StartPageLogic.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/client/ui/pages_logic/StartPageLogic.cpp b/client/ui/pages_logic/StartPageLogic.cpp index de3173b5..1e28d6cd 100644 --- a/client/ui/pages_logic/StartPageLogic.cpp +++ b/client/ui/pages_logic/StartPageLogic.cpp @@ -11,6 +11,7 @@ #include #ifdef Q_OS_ANDROID +#include #include "platforms/android/android_controller.h" #endif @@ -23,7 +24,16 @@ StartPageLogic::StartPageLogic(UiLogic *logic, QObject *parent): m_pushButtonBackFromStartVisible{true}, m_ipAddressPortRegex{Utils::ipAddressPortRegExp()} { - +#ifdef Q_OS_ANDROID + // Set security screen for Android app + QtAndroid::runOnAndroidThread([]() { + QAndroidJniObject window = QtAndroid::androidActivity().callObjectMethod("getWindow", "()Landroid/view/Window;"); + if (window.isValid()){ + const int FLAG_SECURE = 8192; + window.callMethod("addFlags", "(I)V", FLAG_SECURE); + } + }); +#endif } void StartPageLogic::onUpdatePage()