Refactor caller identity checks

* getCallerIdentity(who) and getCallerIdentity(packageName)
  can take in null, where getCallerIdentity() will be called.
* If componentName is null, isDeviceOwner(caller),
  isProfileOwner(caller) and isProfileOwnerOnOrgOwnedDevice(caller)
  cannot be called.
* Add missing null componentName checks

Bug: 168510294
Bug: 169029194
Bug: 168594327
Test: atest com.android.server.devicepolicy.DevicePolicyManagerTest
      atest com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testScreenCaptureDisabled
      atest com.android.cts.devicepolicy.ManagedProfileWipeTest#testWipeDataWithReason
Change-Id: I1721ec3c1d18fb5be55cbec955d39686bbb9d268
2 files changed