Don't request profile owner as user if we don't have a valid user

ag/4891733 changed DevicePolicyManager#getProfileOwnerAsUser() to call
into DPMService.getProfileOwnerAsUser() instead of getProfileOwner(). It
turns out that getProfileOwnerAsUser doesn't accept invalid userIds but
the latter method did.

This CL guards against calling that method if we don't have a valid
userId. The calling code just wants to know if a profile is managed but
I'm pretty sure a UserRecord pointing at a non-user can't be managed.

Test: Expand QS, tap user switcher icon
Change-Id: Idfe46cb6c0d25ba3817ae3639f87de70bbce2d0b
Fixes: 113777483
2 files changed