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

Commit 70a62376 authored by Yvonne Jiang's avatar Yvonne Jiang
Browse files

Mark secondary lockscreen API as SystemApi.

It is currently not meant for use by general enterprise device admins.

Bug: 152478326

Test: atest FrameworksServicesTests:DevicePolicyManagerTest
Test: atest KeyguardUpdateMonitorTest
Test: atest AdminSecondaryLockScreenControllerTest
Change-Id: I6d60bc35a4e8f74b1da55b042582a2f2fa89d57f
parent 29226940
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -6833,13 +6833,6 @@ package android.app.admin {
    method public final android.os.IBinder onBind(android.content.Intent);
  }
  public class DevicePolicyKeyguardService extends android.app.Service {
    ctor public DevicePolicyKeyguardService();
    method @Nullable public void dismiss();
    method @Nullable public final android.os.IBinder onBind(@Nullable android.content.Intent);
    method @Nullable public android.view.SurfaceControlViewHost.SurfacePackage onCreateKeyguardSurface(@NonNull android.os.IBinder);
  }
  public class DevicePolicyManager {
    method public void addCrossProfileIntentFilter(@NonNull android.content.ComponentName, android.content.IntentFilter, int);
    method public boolean addCrossProfileWidgetProvider(@NonNull android.content.ComponentName, String);
@@ -7055,7 +7048,6 @@ package android.app.admin {
    method public boolean setResetPasswordToken(android.content.ComponentName, byte[]);
    method public void setRestrictionsProvider(@NonNull android.content.ComponentName, @Nullable android.content.ComponentName);
    method public void setScreenCaptureDisabled(@NonNull android.content.ComponentName, boolean);
    method public void setSecondaryLockscreenEnabled(@NonNull android.content.ComponentName, boolean);
    method public void setSecureSetting(@NonNull android.content.ComponentName, String, String);
    method public void setSecurityLoggingEnabled(@NonNull android.content.ComponentName, boolean);
    method public void setShortSupportMessage(@NonNull android.content.ComponentName, @Nullable CharSequence);
@@ -7082,7 +7074,6 @@ package android.app.admin {
    field public static final String ACTION_ADD_DEVICE_ADMIN = "android.app.action.ADD_DEVICE_ADMIN";
    field public static final String ACTION_ADMIN_POLICY_COMPLIANCE = "android.app.action.ADMIN_POLICY_COMPLIANCE";
    field public static final String ACTION_APPLICATION_DELEGATION_SCOPES_CHANGED = "android.app.action.APPLICATION_DELEGATION_SCOPES_CHANGED";
    field public static final String ACTION_BIND_SECONDARY_LOCKSCREEN_SERVICE = "android.app.action.BIND_SECONDARY_LOCKSCREEN_SERVICE";
    field public static final String ACTION_CHECK_POLICY_COMPLIANCE = "android.app.action.CHECK_POLICY_COMPLIANCE";
    field public static final String ACTION_DEVICE_ADMIN_SERVICE = "android.app.action.DEVICE_ADMIN_SERVICE";
    field public static final String ACTION_DEVICE_OWNER_CHANGED = "android.app.action.DEVICE_OWNER_CHANGED";
+9 −0
Original line number Diff line number Diff line
@@ -848,6 +848,13 @@ package android.app {
package android.app.admin {
  public class DevicePolicyKeyguardService extends android.app.Service {
    ctor public DevicePolicyKeyguardService();
    method @Nullable public void dismiss();
    method @Nullable public final android.os.IBinder onBind(@Nullable android.content.Intent);
    method @Nullable public android.view.SurfaceControlViewHost.SurfacePackage onCreateKeyguardSurface(@NonNull android.os.IBinder);
  }
  public class DevicePolicyManager {
    method @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public boolean getBluetoothContactSharingDisabled(@NonNull android.os.UserHandle);
    method @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public String getDeviceOwner();
@@ -872,8 +879,10 @@ package android.app.admin {
    method @Deprecated @RequiresPermission("android.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 @Deprecated @RequiresPermission(value=android.Manifest.permission.GRANT_PROFILE_OWNER_DEVICE_IDS_ACCESS, conditional=true) public void setProfileOwnerCanAccessDeviceIds(@NonNull android.content.ComponentName);
    method public void setSecondaryLockscreenEnabled(@NonNull android.content.ComponentName, boolean);
    field public static final String ACCOUNT_FEATURE_DEVICE_OR_PROFILE_OWNER_ALLOWED = "android.account.DEVICE_OR_PROFILE_OWNER_ALLOWED";
    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 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";
+6 −3
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.app.admin;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
@@ -28,14 +29,16 @@ import android.view.SurfaceControlViewHost;
/**
 * Client interface for providing the SystemUI with secondary lockscreen information.
 *
 * <p>An implementation must be provided by the Profile Owner when
 * {@link DevicePolicyManager#setSecondaryLockscreenEnabled} is set to true and the service must be
 * declared in the manifest as handling the action
 * <p>An implementation must be provided by the default configured supervision app that is set as
 * Profile Owner or Device Owner when {@link DevicePolicyManager#setSecondaryLockscreenEnabled} is
 * set to true and the service must be declared in the manifest as handling the action
 * {@link DevicePolicyManager#ACTION_BIND_SECONDARY_LOCKSCREEN_SERVICE}, otherwise the keyguard
 * will fail to bind to the service and continue to unlock.
 *
 * @see DevicePolicyManager#setSecondaryLockscreenEnabled
 * @hide
 */
@SystemApi
public class DevicePolicyKeyguardService extends Service {
    private static final String TAG = "DevicePolicyKeyguardService";
    private IKeyguardCallback mCallback;
+25 −2
Original line number Diff line number Diff line
@@ -2395,9 +2395,11 @@ public class DevicePolicyManager {
    public static final int MAX_PASSWORD_LENGTH = 16;
    /**
     * Service Action: Service implemented by a device owner or profile owner to provide a
     * secondary lockscreen.
     * Service Action: Service implemented by a device owner or profile owner supervision app to
     * provide a secondary lockscreen.
     * @hide
     */
    @SystemApi
    public static final String ACTION_BIND_SECONDARY_LOCKSCREEN_SERVICE =
            "android.app.action.BIND_SECONDARY_LOCKSCREEN_SERVICE";
@@ -7000,6 +7002,22 @@ public class DevicePolicyManager {
        return null;
    }
    /**
     * Returns the configured supervision app if it exists and is the device owner or policy owner.
     * @hide
     */
    public @Nullable ComponentName getProfileOwnerOrDeviceOwnerSupervisionComponent(
            @NonNull UserHandle user) {
        if (mService != null) {
            try {
                return mService.getProfileOwnerOrDeviceOwnerSupervisionComponent(user);
            } catch (RemoteException re) {
                throw re.rethrowFromSystemServer();
            }
        }
        return null;
    }
    /**
     * @hide
     * @return the human readable name of the organisation associated with this DPM or {@code null}
@@ -8637,11 +8655,16 @@ public class DevicePolicyManager {
     * <p>Relevant interactions on the secondary lockscreen should be communicated back to the
     * keyguard via {@link IKeyguardCallback}, such as when the screen is ready to be dismissed.
     *
     * <p>This API, and associated APIs, can only be called by the default supervision app when it
     * is set as the device owner or profile owner.
     *
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
     * @param enabled Whether or not the lockscreen needs to be shown.
     * @throws SecurityException if {@code admin} is not a device or profile owner.
     * @see #isSecondaryLockscreenEnabled
     * @hide
     **/
    @SystemApi
    public void setSecondaryLockscreenEnabled(@NonNull ComponentName admin, boolean enabled) {
        throwIfParentInstance("setSecondaryLockscreenEnabled");
        if (mService != null) {
+1 −0
Original line number Diff line number Diff line
@@ -155,6 +155,7 @@ interface IDevicePolicyManager {
    boolean setProfileOwner(in ComponentName who, String ownerName, int userHandle);
    ComponentName getProfileOwnerAsUser(int userHandle);
    ComponentName getProfileOwner(int userHandle);
    ComponentName getProfileOwnerOrDeviceOwnerSupervisionComponent(in UserHandle userHandle);
    String getProfileOwnerName(int userHandle);
    void setProfileEnabled(in ComponentName who);
    void setProfileName(in ComponentName who, String profileName);
Loading