Android: Fix Application becomes unresponsive issue
Block key events until the plugin is running. Fixes: QTBUG-67944 Pick-to: 5.15 6.1 Change-Id: Iea47f2e94d850141834a7e8fc26218be2cacf660 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
parent
3e2e0dde47
commit
2262a9cd2d
@ -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;
|
||||
|
||||
@ -903,6 +904,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);
|
||||
@ -1010,7 +1016,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);
|
||||
@ -1044,7 +1050,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
|
||||
|
@ -995,6 +995,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