Fix the problem that AccessibilityNodeInfo maybe null and cause a crash.
If the mAccessibilityDelegate of a view is not null, the mAccessibilityDelegate also has a corresponding AccessibilityNodeProvider object. If the AccessibilityNodeProvider does not overload the createAccessibilityNodeInfo(int virtualViewId) method, the app will crash. This bugfix is to add a non-null judgment here. Bug:285078234 Change-Id: Iaccca83e9e47cfeb271186d0a4344555d6b433b6 Signed-off-by: liangguihao1 <liangguihao1@xiaomi.corp-partner.google.com>
This commit is contained in:
committed by
Guihao Liang
parent
9a35062714
commit
629e52b9d9
@@ -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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user