OSDN Git Service

Nullcheck to fix Autofill CTS
authorEugene Susla <eugenesusla@google.com>
Mon, 11 Dec 2017 18:07:03 +0000 (10:07 -0800)
committerEugene Susla <eugenesusla@google.com>
Mon, 11 Dec 2017 23:35:12 +0000 (15:35 -0800)
Test: presubmit
Fixes: 70506475
Change-Id: I187bed4889a4901a7137a2995178ea651ed09186

core/java/android/view/accessibility/AccessibilityInteractionClient.java

index e146555..72af203 100644 (file)
@@ -790,11 +790,14 @@ public final class AccessibilityInteractionClient
         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) {