[automerger] Nullcheck to fix Autofill CTS am: 6c68a69288 am: 743abb939a am: a99414f51f am: 6b95503960
Change-Id: Ia3658c17dc890ca2de951da5c701e953ce8c969b
diff --git a/core/java/android/view/accessibility/AccessibilityInteractionClient.java b/core/java/android/view/accessibility/AccessibilityInteractionClient.java
index 7b40bf9..cc2cd7e 100644
--- a/core/java/android/view/accessibility/AccessibilityInteractionClient.java
+++ b/core/java/android/view/accessibility/AccessibilityInteractionClient.java
@@ -734,11 +734,14 @@
if (info != null) {
info.setConnectionId(connectionId);
// Empty array means any package name is Okay
- if (!ArrayUtils.isEmpty(packageNames)
- && !ArrayUtils.contains(packageNames, info.getPackageName().toString())) {
- // If the node package not one of the valid ones, pick the top one - this
- // is one of the packages running in the introspected UID.
- info.setPackageName(packageNames[0]);
+ if (!ArrayUtils.isEmpty(packageNames)) {
+ CharSequence packageName = info.getPackageName();
+ if (packageName == null
+ || !ArrayUtils.contains(packageNames, packageName.toString())) {
+ // If the node package not one of the valid ones, pick the top one - this
+ // is one of the packages running in the introspected UID.
+ info.setPackageName(packageNames[0]);
+ }
}
info.setSealed(true);
if (!bypassCache) {