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

Commit e138d6b7 authored by Jason Parks's avatar Jason Parks Committed by Android (Google) Code Review
Browse files

Merge "Clarify and improve the documentation for the supervision APIs" into main

parents 641ff9d5 92381d23
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -27,8 +27,19 @@ import android.content.Intent;
import android.os.IBinder;

/**
 * Base class for a service that the {@code android.app.role.RoleManager.ROLE_SYSTEM_SUPERVISION}
 * role holder must implement.
 * Base class for a service that the holders of the
 * {@link android.app.role.RoleManager#ROLE_SYSTEM_SUPERVISION} or
 * {@link android.app.role.RoleManager#ROLE_SUPERVISION} roles must extend.
 *
 * <p>When supervision is enabled, the system searches for this service from each supervision role
 * holder using an intent filter for the {@link #ACTION_SUPERVISION_APP_SERVICE} action. The system
 * attempts to maintain a bound connection to the service, keeping it in the foreground.
 *
 * <p>If a supervision role holder's process crashes, the system will restart it and automatically
 * rebind to the service after a backoff period.
 *
 * <p>The service must be protected with the permission
 * {@link android.Manifest.permission#BIND_SUPERVISION_APP_SERVICE}.
 *
 * @hide
 */
@@ -36,8 +47,7 @@ import android.os.IBinder;
@FlaggedApi(Flags.FLAG_ENABLE_SUPERVISION_APP_SERVICE)
public class SupervisionAppService extends Service {
    /**
     * Service action: Action for a service that the {@code
     * android.app.role.RoleManager.ROLE_SYSTEM_SUPERVISION} role holder must implement.
     * Service Action: Action for a service that a supervision role holder must extend.
     *
     * @hide
     */
+11 −9
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@ import android.annotation.FlaggedApi;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.annotation.TestApi;
@@ -37,7 +39,7 @@ import android.content.Intent;
import android.os.RemoteException;

/**
 * Service for handling parental supervision.
 * This class provides information about and manages supervision.
 *
 * @hide
 */
@@ -84,8 +86,7 @@ public class SupervisionManager {
    @Nullable private final ISupervisionManager mService;

    /**
     * Activity action: ask the human user to enable supervision for this user. Only the app that
     * holds the {@code SYSTEM_SUPERVISION} role can launch this intent.
     * Activity Action: Ask the user to confirm enabling supervision.
     *
     * <p>The intent must be invoked via {@link Activity#startActivityForResult} to receive the
     * result of whether or not the user approved the action. If approved, the result will be {@link
@@ -97,12 +98,12 @@ public class SupervisionManager {
     */
    @SystemApi
    @FlaggedApi(Flags.FLAG_SUPERVISION_MANAGER_APIS)
    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    public static final String ACTION_ENABLE_SUPERVISION =
            "android.app.supervision.action.ENABLE_SUPERVISION";

    /**
     * Activity action: ask the human user to disable supervision for this user. Only the app that
     * holds the {@code SYSTEM_SUPERVISION} role can launch this intent.
     * Activity Action: Ask the user to confirm disabling supervision.
     *
     * <p>The intent must be invoked via {@link Activity#startActivityForResult} to receive the
     * result of whether or not the user approved the action. If approved, the result will be {@link
@@ -114,6 +115,7 @@ public class SupervisionManager {
     */
    @SystemApi
    @FlaggedApi(Flags.FLAG_SUPERVISION_MANAGER_APIS)
    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    public static final String ACTION_DISABLE_SUPERVISION =
            "android.app.supervision.action.DISABLE_SUPERVISION";

@@ -160,7 +162,7 @@ public class SupervisionManager {
    }

    /**
     * Returns whether the device is supervised.
     * Returns whether supervision is enabled for the current user.
     *
     * @hide
     */
@@ -173,7 +175,7 @@ public class SupervisionManager {
    }

    /**
     * Returns whether the device is supervised.
     * Returns whether supervision is enabled for the given user.
     *
     * @hide
     */
@@ -191,7 +193,7 @@ public class SupervisionManager {
    }

    /**
     * Sets whether the device is supervised for the current user.
     * Sets whether the supervision is enabled for the current user.
     *
     * @hide
     */
@@ -202,7 +204,7 @@ public class SupervisionManager {
    }

    /**
     * Sets whether the device is supervised for a given user.
     * Sets whether the supervision is enabled for the given user.
     *
     * @hide
     */
+5 −5
Original line number Diff line number Diff line
@@ -33,12 +33,12 @@ import java.lang.annotation.RetentionPolicy;
import java.util.Objects;

/**
 * Contains the information needed for recovering the device supervision PIN.
 * Contains the information needed for recovering the device-wide supervision credentials.
 *
 * <p>Typically returned as an {@link android.content.Intent} extra by the supervision PIN recovery
 * activity hosted by the {@code android.app.role.RoleManager#ROLE_SYSTEM_SUPERVISION} role holder.
 * This activity is generally launched to set up a recovery method or for recovery within the device
 * supervision flow.
 * <p>This is typically returned as an {@link android.content.Intent} extra from the supervision
 * credentials recovery activity. This activity is hosted by the holder of the
 * {@code android.app.role.RoleManager#ROLE_SYSTEM_SUPERVISION} role and is generally launched to
 * set up a recovery method or to reset the supervision credentials.
 *
 * @hide
 */