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

Commit 9ac405b3 authored by Eran Messeri's avatar Eran Messeri
Browse files

DPMS refactoring: Get Profile / Device owner

Get the Profile Owner or Device Owner directly, rather than using the
ComponentName provided by the caller to look it up.

For DevicePolicyManager methods that are only callable by DO or PO,
there is no need to use the ComponentName to distinguish between
different potential admins, as there could be only one.

Bug: 163028934
Test: atest FrameworksServicesTests:DevicePolicyManagerTest
Test: atest com.android.cts.devicepolicy.MixedDeviceOwnerTest
Change-Id: I5fc3345101c8f61c12a9bbdbd224e95e719a0795
parent 9fd6be5d
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -199,6 +199,20 @@ public class Preconditions {
        }
    }

    /**
     * Ensures the truth of an expression involving whether the calling identity is authorized to
     * call the calling method.
     *
     * @param expression a boolean expression
     * @param message the message of the security exception to be thrown
     * @throws SecurityException if {@code expression} is false
     */
    public static void checkSecurity(final boolean expression, final String message) {
        if (!expression) {
            throw new SecurityException(message);
        }
    }

    /**
     * Ensures the truth of an expression involving whether the calling user is authorized to
     * call the calling method.
+200 −91

File changed.

Preview size limit exceeded, changes collapsed.