Refactored same profile group check for CrossProfileApps.

Moved isSameProfileGroup check to it's own method where the calling
identity is cleared so that the calling application doesn't need
extra permissions.

Bug: 121180087
Test: atest com.android.server.pm.CrossProfileAppsServiceImplTest
Change-Id: I36c830136509255b19b7912ea6259e21413caabd
1 file changed