Get profile parent's context in case of work profile

In the headless system user mode a non-system user can also have
a work profile.
Refactor DatabaseUtils to get the profile parent's context when
the user is a work profile.

Bug: 270039752
Test: make RunSettingsRoboTests
Change-Id: I1fb78c9d91d59d50880a1ea0dd5f83a3d11dd08f
2 files changed