Android: Fix Application becomes unresponsive issue
Block key events until the plugin is running. Fixes: QTBUG-67944 Change-Id: Iea47f2e94d850141834a7e8fc26218be2cacf660 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 2262a9cd2d135d5ea2ade42460496c88d8b2c292) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
fba271339b
commit
aca924f32c
@ -158,6 +158,7 @@ public class QtActivityDelegate
|
||||
private CursorHandle m_leftSelectionHandle;
|
||||
private CursorHandle m_rightSelectionHandle;
|
||||
private EditPopupMenu m_editPopupMenu;
|
||||
private boolean m_isPluginRunning = false;
|
||||
|
||||
private QtAccessibilityDelegate m_accessibilityDelegate = null;
|
||||
|
||||
@ -893,6 +894,11 @@ public class QtActivityDelegate
|
||||
m_accessibilityDelegate.notifyObjectFocus(viewId);
|
||||
}
|
||||
|
||||
public void notifyQtAndroidPluginRunning(boolean running)
|
||||
{
|
||||
m_isPluginRunning = running;
|
||||
}
|
||||
|
||||
public void initializeAccessibility()
|
||||
{
|
||||
m_accessibilityDelegate = new QtAccessibilityDelegate(m_activity, m_layout, this);
|
||||
@ -1000,7 +1006,7 @@ public class QtActivityDelegate
|
||||
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event)
|
||||
{
|
||||
if (!m_started)
|
||||
if (!m_started || !m_isPluginRunning)
|
||||
return false;
|
||||
|
||||
m_metaState = MetaKeyKeyListener.handleKeyDown(m_metaState, keyCode, event);
|
||||
@ -1034,7 +1040,7 @@ public class QtActivityDelegate
|
||||
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event)
|
||||
{
|
||||
if (!m_started)
|
||||
if (!m_started || !m_isPluginRunning)
|
||||
return false;
|
||||
|
||||
if ((keyCode == KeyEvent.KEYCODE_VOLUME_UP
|
||||
|
@ -970,6 +970,11 @@ public class QtNative
|
||||
});
|
||||
}
|
||||
|
||||
public static void notifyQtAndroidPluginRunning(final boolean running)
|
||||
{
|
||||
m_activityDelegate.notifyQtAndroidPluginRunning(running);
|
||||
}
|
||||
|
||||
private static void registerClipboardManager()
|
||||
{
|
||||
if (m_service == null || m_activity != null) { // Avoid freezing if only service
|
||||
|
@ -223,6 +223,11 @@ namespace QtAndroid
|
||||
QJniObject::callStaticMethod<void>(m_applicationClass, "notifyObjectFocus","(I)V", accessibilityObjectId);
|
||||
}
|
||||
|
||||
void notifyQtAndroidPluginRunning(bool running)
|
||||
{
|
||||
QJniObject::callStaticMethod<void>(m_applicationClass, "notifyQtAndroidPluginRunning","(Z)V", running);
|
||||
}
|
||||
|
||||
jobject createBitmap(QImage img, JNIEnv *env)
|
||||
{
|
||||
if (!m_bitmapClass)
|
||||
|
@ -103,6 +103,7 @@ namespace QtAndroid
|
||||
void notifyAccessibilityLocationChange();
|
||||
void notifyObjectHide(uint accessibilityObjectId);
|
||||
void notifyObjectFocus(uint accessibilityObjectId);
|
||||
void notifyQtAndroidPluginRunning(bool running);
|
||||
|
||||
const char *classErrorMsgFmt();
|
||||
const char *methodErrorMsgFmt();
|
||||
|
@ -88,6 +88,7 @@ Qt::ScreenOrientation QAndroidPlatformIntegration::m_orientation = Qt::PrimaryOr
|
||||
Qt::ScreenOrientation QAndroidPlatformIntegration::m_nativeOrientation = Qt::PrimaryOrientation;
|
||||
|
||||
bool QAndroidPlatformIntegration::m_showPasswordEnabled = false;
|
||||
static bool m_running = false;
|
||||
|
||||
void *QAndroidPlatformNativeInterface::nativeResourceForIntegration(const QByteArray &resource)
|
||||
{
|
||||
@ -156,6 +157,10 @@ void QAndroidPlatformNativeInterface::customEvent(QEvent *event)
|
||||
api->accessibility()->setActive(QtAndroidAccessibility::isActive());
|
||||
#endif // QT_NO_ACCESSIBILITY
|
||||
|
||||
if (!m_running) {
|
||||
m_running = true;
|
||||
QtAndroid::notifyQtAndroidPluginRunning(m_running);
|
||||
}
|
||||
api->flushPendingUpdates();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user