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

Commit e21482f6 authored by Alex Johnston's avatar Alex Johnston Committed by Automerger Merge Worker
Browse files

Merge "Require TRIGGER_LOST_MODE permission for sendLostModeLocationUpdate"...

Merge "Require TRIGGER_LOST_MODE permission for sendLostModeLocationUpdate" into tm-dev am: c7df8de8

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17223103

Change-Id: I6aa66c42bac176524337da096d5b1b07f0a01c1a
parents 9d786f29 c7df8de8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1108,7 +1108,7 @@ package android.app.admin {
    method @RequiresPermission("android.permission.NOTIFY_PENDING_SYSTEM_UPDATE") public void notifyPendingSystemUpdate(long, boolean);
    method @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL) public boolean packageHasActiveAdmins(String);
    method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS, android.Manifest.permission.PROVISION_DEMO_DEVICE}) public void provisionFullyManagedDevice(@NonNull android.app.admin.FullyManagedDeviceProvisioningParams) throws android.app.admin.ProvisioningException;
    method @RequiresPermission(android.Manifest.permission.SEND_LOST_MODE_LOCATION_UPDATES) public void sendLostModeLocationUpdate(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Boolean>);
    method @RequiresPermission(android.Manifest.permission.TRIGGER_LOST_MODE) public void sendLostModeLocationUpdate(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Boolean>);
    method @Deprecated @RequiresPermission(android.Manifest.permission.MANAGE_DEVICE_ADMINS) public boolean setActiveProfileOwner(@NonNull android.content.ComponentName, String) throws java.lang.IllegalArgumentException;
    method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public void setDeviceProvisioningConfigApplied();
    method @RequiresPermission(android.Manifest.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS) public void setDpcDownloaded(boolean);
+2 −2
Original line number Diff line number Diff line
@@ -6197,7 +6197,7 @@ public class DevicePolicyManager {
     * organization-owned managed profile.
     *
     * <p>The caller must hold the
     * {@link android.Manifest.permission#SEND_LOST_MODE_LOCATION_UPDATES} permission.
     * {@link android.Manifest.permission#TRIGGER_LOST_MODE} permission.
     *
     * <p> Not for use by third-party applications.
     *
@@ -6207,7 +6207,7 @@ public class DevicePolicyManager {
     * @hide
     */
    @SystemApi
    @RequiresPermission(android.Manifest.permission.SEND_LOST_MODE_LOCATION_UPDATES)
    @RequiresPermission(android.Manifest.permission.TRIGGER_LOST_MODE)
    public void sendLostModeLocationUpdate(@NonNull @CallbackExecutor Executor executor,
            @NonNull Consumer<Boolean> callback) {
        throwIfParentInstance("sendLostModeLocationUpdate");
+1 −1
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@
    <uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" />
    <uses-permission android:name="android.permission.READ_INSTALL_SESSIONS" />
    <uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
    <uses-permission android:name="android.permission.SEND_LOST_MODE_LOCATION_UPDATES" />
    <uses-permission android:name="android.permission.TRIGGER_LOST_MODE" />
    <!-- ACCESS_BACKGROUND_LOCATION is needed for testing purposes only. -->
    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
    <!-- ACCESS_MTP is needed for testing purposes only. -->
+1 −1
Original line number Diff line number Diff line
@@ -7233,7 +7233,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
            return;
        }
        Preconditions.checkCallAuthorization(
                hasCallingOrSelfPermission(permission.SEND_LOST_MODE_LOCATION_UPDATES));
                hasCallingOrSelfPermission(permission.TRIGGER_LOST_MODE));
        synchronized (getLockObject()) {
            final ActiveAdmin admin = getDeviceOwnerOrProfileOwnerOfOrganizationOwnedDeviceLocked(
+3 −3
Original line number Diff line number Diff line
@@ -8455,7 +8455,7 @@ public class DevicePolicyManagerTest extends DpmTestBase {

    @Test
    public void testSendLostModeLocationUpdate_notOrganizationOwnedDevice() {
        mContext.callerPermissions.add(permission.SEND_LOST_MODE_LOCATION_UPDATES);
        mContext.callerPermissions.add(permission.TRIGGER_LOST_MODE);
        assertThrows(IllegalStateException.class, () -> dpm.sendLostModeLocationUpdate(
                getServices().executor, /* empty callback */ result -> {}));
    }
@@ -8463,7 +8463,7 @@ public class DevicePolicyManagerTest extends DpmTestBase {
    @Test
    public void testSendLostModeLocationUpdate_asDeviceOwner() throws Exception {
        final String TEST_PROVIDER = "network";
        mContext.callerPermissions.add(permission.SEND_LOST_MODE_LOCATION_UPDATES);
        mContext.callerPermissions.add(permission.TRIGGER_LOST_MODE);
        setDeviceOwner();
        when(getServices().locationManager.getAllProviders()).thenReturn(List.of(TEST_PROVIDER));
        when(getServices().locationManager.isProviderEnabled(TEST_PROVIDER)).thenReturn(true);
@@ -8480,7 +8480,7 @@ public class DevicePolicyManagerTest extends DpmTestBase {
        final int MANAGED_PROFILE_ADMIN_UID =
                UserHandle.getUid(CALLER_USER_HANDLE, DpmMockContext.SYSTEM_UID);
        mContext.binder.callingUid = MANAGED_PROFILE_ADMIN_UID;
        mContext.callerPermissions.add(permission.SEND_LOST_MODE_LOCATION_UPDATES);
        mContext.callerPermissions.add(permission.TRIGGER_LOST_MODE);
        addManagedProfile(admin1, MANAGED_PROFILE_ADMIN_UID, admin1);
        configureProfileOwnerOfOrgOwnedDevice(admin1, CALLER_USER_HANDLE);
        when(getServices().locationManager.getAllProviders()).thenReturn(List.of(TEST_PROVIDER));