Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit de5182d2 authored by Alex Johnston's avatar Alex Johnston
Browse files

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
parent a67c5344
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -58,4 +58,12 @@ class CallerIdentity {
    @Nullable public ComponentName getComponentName() {
        return mComponentName;
    }

    public boolean hasAdminComponent() {
        return mComponentName != null;
    }

    public boolean hasPackage() {
        return mPackageName != null;
    }
}
+139 −69

File changed.

Preview size limit exceeded, changes collapsed.