CVS*_*CVS 8 java android webview android-autofill-manager android-8.1-oreo
我有自动填充管理器的错误,当我关注任何输入时 - 它会引发异常:
W/System.err: java.lang.NullPointerException: activityToken
W/System.err: at android.os.Parcel.readException(Parcel.java:2011)
W/System.err: at android.os.Parcel.readException(Parcel.java:1951)
at android.view.autofill.IAutoFillManager$Stub$Proxy.startSession(IAutoFillManager.java:397)
at android.view.autofill.AutofillManager.startSessionLocked(AutofillManager.java:1012) W/System.err: at android.view.autofill.AutofillManager.notifyViewEntered(AutofillManager.java:734) android.view.autofill.AutofillManager.notifyViewEntered(AutofillManager.java:706)
Run Code Online (Sandbox Code Playgroud)
我能够通过在基础活动中添加下一个代码来修复它onCreate():
public static void preventViewAutoFill(@NonNull Window window) {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1) {
final Method method;
try {
method = View.class.getMethod(AUTO_FILL_MANAGER_METHOD, Integer.TYPE);
} catch (Exception ignore) {
return;
}
if (method != null) {
try {
method.invoke(window.getDecorView(), IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS);
} catch (Exception ignore) {
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
这个问题在除了输入内部的所有视图中都有WebView.当用户专注于WebView应用程序崩溃中的任何输入时,我有一个带有输入字段的WebView .
有没有办法在应用程序层或WebView端修复此问题?
应用程序定位25 API,最小16.