Fix network logging on headless system user

Fix the logic to retrieve the right managed profile userId.

Bug: 254834861
Test: com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testNetworkLoggingLogged
      com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testNetworkLoggingDelegate
      com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testNetworkLogging
      FrameworksServicesTests:DevicePolicyManagerTest
Change-Id: I077a831ef0e52e61a942f7828bcb03f96900304d
2 files changed