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

Commit d4de2c34 authored by Michael Groover's avatar Michael Groover
Browse files

Make DPM#checkDeviceIdentifierAccess a SystemApi

The device identifier check is performed within Telephony; one of
the checks uses a hidden method within DevicePolicyManager to perform
a device / profile owner access check. In order for Telephony to
invoke this method as a mainline module it must be made into a
SystemApi.

Fixes: 145163986
Test: atest DeviceOwnerTest#testDeviceOwnerCanGetDeviceIdentifiers
Test: atest DeviceOwnerTest#testDeviceOwnerCannotGetDeviceIdentifiersWithoutPermission
Test: atest ManagedProfileTest#testProfileOwnerOnPersonalDeviceCannotGetDeviceIdentifiers
Test: atest CtsDevicePolicyManagerTestCases:com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testProfileOwnerCannotGetDeviceIdentifiersWithoutPermission
Test: atest CtsDevicePolicyManagerTestCases:com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testProfileOwnerCanGetDeviceIdentifiers
Test: atest TelephonyPermissionsTest
Change-Id: Ica015f848209fc693a44fa019b25796260191e64
parent 700c836e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -762,6 +762,7 @@ package android.app.admin {
    method @Nullable public android.content.ComponentName getProfileOwner() throws java.lang.IllegalArgumentException;
    method @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public String getProfileOwnerNameAsUser(int) throws java.lang.IllegalArgumentException;
    method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public int getUserProvisioningState();
    method public boolean hasDeviceIdentifierAccess(@NonNull String, int, int);
    method public boolean isDeviceManaged();
    method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isDeviceProvisioned();
    method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isDeviceProvisioningConfigApplied();
+3 −2
Original line number Diff line number Diff line
@@ -6708,8 +6708,9 @@ public class DevicePolicyManager {
     *
     * @hide
     */
    public boolean checkDeviceIdentifierAccess(String packageName, int pid, int uid) {
        throwIfParentInstance("checkDeviceIdentifierAccess");
    @SystemApi
    public boolean hasDeviceIdentifierAccess(@NonNull String packageName, int pid, int uid) {
        throwIfParentInstance("hasDeviceIdentifierAccess");
        if (packageName == null) {
            return false;
        }
+1 −1
Original line number Diff line number Diff line
@@ -403,7 +403,7 @@ public final class TelephonyPermissions {
            DevicePolicyManager devicePolicyManager =
                    (DevicePolicyManager) context.getSystemService(
                            Context.DEVICE_POLICY_SERVICE);
            if (devicePolicyManager != null && devicePolicyManager.checkDeviceIdentifierAccess(
            if (devicePolicyManager != null && devicePolicyManager.hasDeviceIdentifierAccess(
                    callingPackage, pid, uid)) {
                return true;
            }