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

Commit 20cf3de0 authored by Yvonne Jiang's avatar Yvonne Jiang Committed by Android (Google) Code Review
Browse files

Merge "Secondary Lockscreen API: improve documentation and rename...

Merge "Secondary Lockscreen API: improve documentation and rename onSurfaceReady method." into rvc-dev
parents 19dc0a5d 8345da3a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -6843,7 +6843,7 @@ package android.app.admin {
    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 onSurfaceReady(@Nullable android.os.IBinder);
    method @Nullable public android.view.SurfaceControlViewHost.SurfacePackage onCreateKeyguardSurface(@NonNull android.os.IBinder);
  }
  public class DevicePolicyManager {
+1 −1
Original line number Diff line number Diff line
@@ -873,7 +873,7 @@ package android.app.admin {
    method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isDeviceProvisioned();
    method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isDeviceProvisioningConfigApplied();
    method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isManagedKiosk();
    method public boolean isSecondaryLockscreenEnabled(int);
    method public boolean isSecondaryLockscreenEnabled(@NonNull android.os.UserHandle);
    method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isUnattendedManagedKiosk();
    method @RequiresPermission("android.permission.NOTIFY_PENDING_SYSTEM_UPDATE") public void notifyPendingSystemUpdate(long);
    method @RequiresPermission("android.permission.NOTIFY_PENDING_SYSTEM_UPDATE") public void notifyPendingSystemUpdate(long, boolean);
+22 −6
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.app.admin;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.Service;
import android.content.Intent;
@@ -27,7 +28,7 @@ import android.view.SurfaceControlViewHost;
/**
 * Client interface for providing the SystemUI with secondary lockscreen information.
 *
 * <p>An implementation must be provided by the device admin app when
 * <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
 * {@link DevicePolicyManager#ACTION_BIND_SECONDARY_LOCKSCREEN_SERVICE}, otherwise the keyguard
@@ -41,10 +42,11 @@ public class DevicePolicyKeyguardService extends Service {

    private final IKeyguardClient mClient = new IKeyguardClient.Stub() {
        @Override
        public void onSurfaceReady(@Nullable IBinder hostInputToken, IKeyguardCallback callback) {
        public void onCreateKeyguardSurface(@Nullable IBinder hostInputToken,
                IKeyguardCallback callback) {
            mCallback = callback;
            SurfaceControlViewHost.SurfacePackage surfacePackage =
                    DevicePolicyKeyguardService.this.onSurfaceReady(hostInputToken);
                    DevicePolicyKeyguardService.this.onCreateKeyguardSurface(hostInputToken);

            if (mCallback != null) {
                try {
@@ -63,13 +65,27 @@ public class DevicePolicyKeyguardService extends Service {
    }

    /**
     * Called by keyguard once the host surface for the secondary lockscreen is ready to display
     * remote content.
     * Called by keyguard once the host surface for the secondary lockscreen is created and ready to
     * display remote content.
     *
     * <p>Implementations are expected to create a Surface hierarchy with view elements for the
     * admin's desired secondary lockscreen UI, and optionally, interactive elements
     * that will allow the user to dismiss the secondary lockscreen, subject to the implementation's
     * requirements. The view hierarchy is expected to be embedded via the
     * {@link SurfaceControlViewHost} APIs, and returned as a SurfacePackage via
     * {@link SurfaceControlViewHost#getSurfacePackage}for the keyguard to reparent into its
     * prepared SurfaceView.
     *
     * @param hostInputToken Token of the SurfaceView which will hosting the embedded hierarchy,
     *                       primarily required by {@link SurfaceControlViewHost} for ANR reporting.
     *                       It will be provided by the keyguard via
     *                       {@link android.view.SurfaceView#getHostToken}.
     * @return the {@link SurfaceControlViewHost.SurfacePackage} for the Surface the
     *      secondary lockscreen content is attached to.
     */
    @Nullable
    public SurfaceControlViewHost.SurfacePackage onSurfaceReady(@Nullable IBinder hostInputToken) {
    public SurfaceControlViewHost.SurfacePackage onCreateKeyguardSurface(
            @NonNull IBinder hostInputToken) {
        return null;
    }

+2 −2
Original line number Diff line number Diff line
@@ -8658,11 +8658,11 @@ public class DevicePolicyManager {
     * @hide
     */
    @SystemApi
    public boolean isSecondaryLockscreenEnabled(int userId) {
    public boolean isSecondaryLockscreenEnabled(@NonNull UserHandle userHandle) {
        throwIfParentInstance("isSecondaryLockscreenEnabled");
        if (mService != null) {
            try {
                return mService.isSecondaryLockscreenEnabled(userId);
                return mService.isSecondaryLockscreenEnabled(userHandle);
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
            }
+1 −1
Original line number Diff line number Diff line
@@ -255,7 +255,7 @@ interface IDevicePolicyManager {
    String[] getAccountTypesWithManagementDisabledAsUser(int userId, in boolean parent);

    void setSecondaryLockscreenEnabled(in ComponentName who, boolean enabled);
    boolean isSecondaryLockscreenEnabled(int userId);
    boolean isSecondaryLockscreenEnabled(in UserHandle userHandle);

    void setLockTaskPackages(in ComponentName who, in String[] packages);
    String[] getLockTaskPackages(in ComponentName who);
Loading