Merge "Fix the problem that AccessibilityNodeInfo maybe null and cause a crash."

This commit is contained in:
Daniel Norman
2023-06-02 21:25:54 +00:00
committed by Gerrit Code Review

View File

@@ -9097,8 +9097,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
final AccessibilityNodeInfo info = createAccessibilityNodeInfo();
structure.setChildCount(1);
final ViewStructure root = structure.newChild(0);
populateVirtualStructure(root, provider, info, forAutofill);
info.recycle();
if (info != null) {
populateVirtualStructure(root, provider, info, forAutofill);
info.recycle();
} else {
Log.w(AUTOFILL_LOG_TAG, "AccessibilityNodeInfo is null.");
}
}
}