Add a null check in canForwardTo for getProfileParent.

PackageManagerService#canForwardTo assumes the method is called
from a work profile. However, with the new changes in the intent
resolver and share sheet, we use this method from the personal
profile as well, in order to determine if an intent is
cross-profile or not. Without this null check, we get a NPE
when we call canForwardTo from the personal profile.

Test: CTS tests are not relevant in this case, as
PackageManagerService#canForwardTo is not a public API
and the only place it's called from is IntentForwarderActivity,
which does not have CTS coverage.
Fixes: 149311698
Change-Id: I172f572920c258723b6a51ac35f2abc0c3aabbf8
1 file changed