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

Commit b8b0dacc authored by Alex Johnston's avatar Alex Johnston Committed by Android (Google) Code Review
Browse files

Merge "Add lost mode platform changes"

parents ed1d4d26 cf04bc3d
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -287,6 +287,7 @@ package android {
    field public static final String SECURE_ELEMENT_PRIVILEGED_OPERATION = "android.permission.SECURE_ELEMENT_PRIVILEGED_OPERATION";
    field public static final String SEND_CATEGORY_CAR_NOTIFICATIONS = "android.permission.SEND_CATEGORY_CAR_NOTIFICATIONS";
    field public static final String SEND_DEVICE_CUSTOMIZATION_READY = "android.permission.SEND_DEVICE_CUSTOMIZATION_READY";
    field public static final String SEND_LOST_MODE_LOCATION_UPDATES = "android.permission.SEND_LOST_MODE_LOCATION_UPDATES";
    field public static final String SEND_SAFETY_CENTER_UPDATE = "android.permission.SEND_SAFETY_CENTER_UPDATE";
    field public static final String SEND_SHOW_SUSPENDED_APP_DETAILS = "android.permission.SEND_SHOW_SUSPENDED_APP_DETAILS";
    field public static final String SEND_SMS_NO_CONFIRMATION = "android.permission.SEND_SMS_NO_CONFIRMATION";
@@ -1069,6 +1070,7 @@ package android.app.admin {
    method @RequiresPermission(android.Manifest.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS) public void provisionFullyManagedDevice(@NonNull android.app.admin.FullyManagedDeviceProvisioningParams) throws android.app.admin.ProvisioningException;
    method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_MANAGEMENT_RESOURCES) public void resetDrawables(@NonNull String[]);
    method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_MANAGEMENT_RESOURCES) public void resetStrings(@NonNull String[]);
    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 @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.UPDATE_DEVICE_MANAGEMENT_RESOURCES) public void setDrawables(@NonNull java.util.Set<android.app.admin.DevicePolicyDrawableResource>);
@@ -1080,6 +1082,7 @@ package android.app.admin {
    field public static final String ACCOUNT_FEATURE_DEVICE_OR_PROFILE_OWNER_DISALLOWED = "android.account.DEVICE_OR_PROFILE_OWNER_DISALLOWED";
    field public static final String ACTION_BIND_SECONDARY_LOCKSCREEN_SERVICE = "android.app.action.BIND_SECONDARY_LOCKSCREEN_SERVICE";
    field @RequiresPermission(android.Manifest.permission.DISPATCH_PROVISIONING_MESSAGE) public static final String ACTION_ESTABLISH_NETWORK_CONNECTION = "android.app.action.ESTABLISH_NETWORK_CONNECTION";
    field public static final String ACTION_LOST_MODE_LOCATION_UPDATE = "android.app.action.LOST_MODE_LOCATION_UPDATE";
    field public static final String ACTION_PROVISION_FINALIZATION = "android.app.action.PROVISION_FINALIZATION";
    field public static final String ACTION_PROVISION_FINANCED_DEVICE = "android.app.action.PROVISION_FINANCED_DEVICE";
    field public static final String ACTION_PROVISION_MANAGED_DEVICE_FROM_TRUSTED_SOURCE = "android.app.action.PROVISION_MANAGED_DEVICE_FROM_TRUSTED_SOURCE";
@@ -1106,6 +1109,7 @@ package android.app.admin {
    field public static final int CODE_USER_NOT_RUNNING = 3; // 0x3
    field public static final int CODE_USER_SETUP_COMPLETED = 4; // 0x4
    field public static final String EXTRA_FORCE_UPDATE_ROLE_HOLDER = "android.app.extra.FORCE_UPDATE_ROLE_HOLDER";
    field public static final String EXTRA_LOST_MODE_LOCATION = "android.app.extra.LOST_MODE_LOCATION";
    field public static final String EXTRA_PROFILE_OWNER_NAME = "android.app.extra.PROFILE_OWNER_NAME";
    field @Deprecated public static final String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_ICON_URI = "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_ICON_URI";
    field @Deprecated public static final String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_LABEL = "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_LABEL";
+75 −0
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@ import android.net.PrivateDnsConnectivityChecker;
import android.net.ProxyInfo;
import android.net.Uri;
import android.nfc.NfcAdapter;
import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.ParcelFileDescriptor;
@@ -97,6 +98,7 @@ import android.util.Log;
import android.util.Pair;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.infra.AndroidFuture;
import com.android.internal.net.NetworkUtilsInternal;
import com.android.internal.os.BackgroundThread;
import com.android.internal.util.Preconditions;
@@ -131,6 +133,7 @@ import java.util.concurrent.Callable;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
import java.util.function.Consumer;
// TODO(b/172376923) - add CarDevicePolicyManager examples below (or remove reference to it).
/**
@@ -1792,6 +1795,28 @@ public class DevicePolicyManager {
    public static final String ACTION_RESET_PROTECTION_POLICY_CHANGED =
            "android.app.action.RESET_PROTECTION_POLICY_CHANGED";
    /**
     * Broadcast action: sent when there is a location update on a device in lost mode. This
     * broadcast is explicitly sent to the device policy controller app only.
     *
     * @see DevicePolicyManager#sendLostModeLocationUpdate
     * @hide
     */
    @SystemApi
    public static final String ACTION_LOST_MODE_LOCATION_UPDATE =
            "android.app.action.LOST_MODE_LOCATION_UPDATE";
    /**
     * Extra used with {@link #ACTION_LOST_MODE_LOCATION_UPDATE} to send the location of a device
     * in lost mode. Value is {@code Location}.
     *
     * @see DevicePolicyManager#sendLostModeLocationUpdate
     * @hide
     */
    @SystemApi
    public static final String EXTRA_LOST_MODE_LOCATION =
            "android.app.extra.LOST_MODE_LOCATION";
    /**
     * The ComponentName of the administrator component.
     *
@@ -5821,6 +5846,56 @@ public class DevicePolicyManager {
        return null;
    }
    /**
     * Send a lost mode location update to the admin. This API is limited to organization-owned
     * devices, which includes devices with a device owner or devices with a profile owner on an
     * organization-owned managed profile.
     *
     * <p>The caller must hold the
     * {@link android.Manifest.permission#SEND_LOST_MODE_LOCATION_UPDATES} permission.
     *
     * <p> Not for use by third-party applications.
     *
     * @param executor The executor through which the callback should be invoked.
     * @param callback A callback object that will inform the caller whether a lost mode location
     *                 update was successfully sent
     * @hide
     */
    @SystemApi
    @RequiresPermission(android.Manifest.permission.SEND_LOST_MODE_LOCATION_UPDATES)
    public void sendLostModeLocationUpdate(@NonNull @CallbackExecutor Executor executor,
            @NonNull Consumer<Boolean> callback) {
        throwIfParentInstance("sendLostModeLocationUpdate");
        if (mService == null) {
            executeCallback(AndroidFuture.completedFuture(false), executor, callback);
            return;
        }
        try {
            final AndroidFuture<Boolean> future = new AndroidFuture<>();
            mService.sendLostModeLocationUpdate(future);
            executeCallback(future, executor, callback);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }
    private void executeCallback(AndroidFuture<Boolean> future,
            @CallbackExecutor @NonNull Executor executor,
            Consumer<Boolean> callback) {
        future.whenComplete((result, error) -> executor.execute(() -> {
            final long token = Binder.clearCallingIdentity();
            try {
                if (error != null) {
                    callback.accept(false);
                } else {
                    callback.accept(result);
                }
            } finally {
                Binder.restoreCallingIdentity(token);
            }
        }));
    }
    /**
     * Called by an application that is administering the device to set the
     * global proxy and exclusion list.
+3 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ import android.os.UserHandle;
import android.security.keymaster.KeymasterCertificateChain;
import android.security.keystore.ParcelableKeyGenParameterSpec;
import android.telephony.data.ApnSetting;
import com.android.internal.infra.AndroidFuture;

import java.util.List;

@@ -119,6 +120,8 @@ interface IDevicePolicyManager {
    FactoryResetProtectionPolicy getFactoryResetProtectionPolicy(in ComponentName who);
    boolean isFactoryResetProtectionPolicySupported();

    void sendLostModeLocationUpdate(in AndroidFuture<boolean> future);

    ComponentName setGlobalProxy(in ComponentName admin, String proxySpec, String exclusionList);
    ComponentName getGlobalProxyAdmin(int userHandle);
    void setRecommendedGlobalProxy(in ComponentName admin, in ProxyInfo proxyInfo);
+11 −0
Original line number Diff line number Diff line
@@ -2318,6 +2318,14 @@
    <permission android:name="android.permission.TRIGGER_LOST_MODE"
        android:protectionLevel="signature|role"/>

    <!-- @SystemApi Allows an application to instruct the framework to send location to the device
         admin when an organization-owned device is in lost mode.
         <p>Not for use by third-party applications.
         @hide
    -->
    <permission android:name="android.permission.SEND_LOST_MODE_LOCATION_UPDATES"
        android:protectionLevel="signature|privileged"/>

    <!-- ================================== -->
    <!-- Permissions for accessing hardware -->
    <!-- ================================== -->
@@ -6212,6 +6220,9 @@
         <p>Not for use by third-party applications.</p> -->
    <attribution android:tag="MusicRecognitionManagerService"
        android:label="@string/music_recognition_manager_service"/>
    <!-- Attribution for Device Policy Manager service. -->
    <attribution android:tag="DevicePolicyManagerService"
        android:label="@string/device_policy_manager_service"/>

    <application android:process="system"
                 android:persistent="true"
+2 −0
Original line number Diff line number Diff line
@@ -521,6 +521,8 @@
    <string name="twilight_service">Twilight Service</string>
    <!-- Attribution for Gnss Time Update service. [CHAR LIMIT=NONE]-->
    <string name="gnss_time_update_service">GNSS Time Update Service</string>
    <!-- Attribution for Device Policy Manager service. [CHAR LIMIT=NONE]-->
    <string name="device_policy_manager_service">Device Policy Manager Service</string>

    <!-- Attribution for MusicRecognitionManagerService. [CHAR LIMIT=NONE]-->
    <string name="music_recognition_manager_service">Music Recognition Manager Service</string>
Loading