Don't send app links to the parent if status = never (part 2)

To qualify for cross-profile app linking, an intent should resolve
with a better status than "NEVER". Moved this check from canForwardTo
into the source method, getCrossProfileDomainPreferredLpr, to stop
bad resolutions leaking out.

BUG:22287521
Change-Id: I195979d78a783864d841a81f358780912bbf168e
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index eb84e18..2a08c34 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -4417,9 +4417,7 @@
             synchronized(mPackages) {
                 CrossProfileDomainInfo xpDomainInfo = getCrossProfileDomainPreferredLpr(
                         intent, resolvedType, 0, sourceUserId, parent.id);
-                return xpDomainInfo != null
-                        && xpDomainInfo.bestDomainVerificationStatus !=
-                                INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER;
+                return xpDomainInfo != null;
             }
         }
         return false;
@@ -4576,6 +4574,11 @@
                         result.bestDomainVerificationStatus);
             }
         }
+        // Don't consider matches with status NEVER across profiles.
+        if (result != null && result.bestDomainVerificationStatus
+                == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER) {
+            return null;
+        }
         return result;
     }