From bf322c836b3b3dbbca2dfce5407211171efc719b Mon Sep 17 00:00:00 2001 From: AlexVincent525 Date: Fri, 17 Jan 2020 14:29:53 +0800 Subject: [PATCH] Fix crash when `prompt` was called on Android Q. --- .../InAppWebView/InputAwareWebView.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppWebView/InputAwareWebView.java b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppWebView/InputAwareWebView.java index 6c2ed1f7..92d8b613 100644 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppWebView/InputAwareWebView.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppWebView/InputAwareWebView.java @@ -3,6 +3,7 @@ package com.pichillilorenzo.flutter_inappwebview.InAppWebView; import static android.content.Context.INPUT_METHOD_SERVICE; import android.content.Context; +import android.os.Build; import android.util.AttributeSet; import android.util.Log; import android.view.View; @@ -190,7 +191,11 @@ public class InputAwareWebView extends WebView { // onCreateInputConnection() on targetView on the same thread as // targetView.getHandler(). It will also call subsequent InputConnection methods on this // thread. This is the IME thread in cases where targetView is our proxyAdapterView. - imm.isActive(containerView); + + // TODO (ALexVincent525): Currently only prompt has been tested, still needs more test cases. + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) { + imm.isActive(containerView); + } } }); }