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

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

Merge "Update secondary lock screen implementation to use the newly updated...

Merge "Update secondary lock screen implementation to use the newly updated SurfaceControlViewHost API."
parents 4a77192e 7f97f732
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -6810,7 +6810,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.SurfaceControl onSurfaceReady(@Nullable android.os.IBinder);
    method @Nullable public android.view.SurfaceControlViewHost.SurfacePackage onSurfaceReady(@Nullable android.os.IBinder);
  }
  public class DevicePolicyManager {
+7 −7
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
import android.view.SurfaceControl;
import android.view.SurfaceControlViewHost;

/**
 * Client interface for providing the SystemUI with secondary lockscreen information.
@@ -43,14 +43,14 @@ public class DevicePolicyKeyguardService extends Service {
        @Override
        public void onSurfaceReady(@Nullable IBinder hostInputToken, IKeyguardCallback callback) {
            mCallback = callback;
            SurfaceControl surfaceControl =
            SurfaceControlViewHost.SurfacePackage surfacePackage =
                    DevicePolicyKeyguardService.this.onSurfaceReady(hostInputToken);

            if (mCallback != null) {
                try {
                    mCallback.onSurfaceControlCreated(surfaceControl);
                    mCallback.onRemoteContentReady(surfacePackage);
                } catch (RemoteException e) {
                    Log.e(TAG, "Failed to return created SurfaceControl", e);
                    Log.e(TAG, "Failed to return created SurfacePackage", e);
                }
            }
        }
@@ -65,11 +65,11 @@ public class DevicePolicyKeyguardService extends Service {
    /**
     * Called by keyguard once the host surface for the secondary lockscreen is ready to display
     * remote content.
     * @return the {@link SurfaceControl} for the Surface the secondary lockscreen content is
     *      attached to.
     * @return the {@link SurfaceControlViewHost.SurfacePackage} for the Surface the
     *      secondary lockscreen content is attached to.
     */
    @Nullable
    public SurfaceControl onSurfaceReady(@Nullable IBinder hostInputToken) {
    public SurfaceControlViewHost.SurfacePackage onSurfaceReady(@Nullable IBinder hostInputToken) {
        return null;
    }

+2 −2
Original line number Diff line number Diff line
@@ -15,13 +15,13 @@
 */
package android.app.admin;

import android.view.SurfaceControl;
import android.view.SurfaceControlViewHost;

/**
 * Internal IPC interface for informing the keyguard of events on the secondary lockscreen.
 * @hide
 */
interface IKeyguardCallback {
    oneway void onSurfaceControlCreated(in SurfaceControl remoteSurfaceControl);
    oneway void onRemoteContentReady(in SurfaceControlViewHost.SurfacePackage surfacePackage);
    oneway void onDismiss();
}
+19 −0
Original line number Diff line number Diff line
/**
 * Copyright (c) 2020, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.view;

parcelable SurfaceControlViewHost.SurfacePackage;
 No newline at end of file
+6 −8
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ import android.os.IBinder;
import android.os.RemoteException;
import android.os.UserHandle;
import android.util.Log;
import android.view.SurfaceControl;
import android.view.SurfaceControlViewHost;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.ViewGroup;
@@ -47,7 +47,6 @@ public class AdminSecondaryLockScreenController {
    private Handler mHandler;
    private IKeyguardClient mClient;
    private KeyguardSecurityCallback mKeyguardCallback;
    private SurfaceControl.Transaction mTransaction;

    private final ServiceConnection mConnection = new ServiceConnection() {
        @Override
@@ -84,13 +83,13 @@ public class AdminSecondaryLockScreenController {
        }

        @Override
        public void onSurfaceControlCreated(@Nullable SurfaceControl remoteSurfaceControl) {
        public void onRemoteContentReady(
                @Nullable SurfaceControlViewHost.SurfacePackage surfacePackage) {
            if (mHandler != null) {
                mHandler.removeCallbacksAndMessages(null);
            }
            if (remoteSurfaceControl != null) {
                mTransaction.reparent(remoteSurfaceControl, mView.getSurfaceControl())
                    .apply();
            if (surfacePackage != null) {
                mView.setChildSurfacePackage(surfacePackage);
            } else {
                dismiss(KeyguardUpdateMonitor.getCurrentUser());
            }
@@ -138,11 +137,10 @@ public class AdminSecondaryLockScreenController {

    public AdminSecondaryLockScreenController(Context context, ViewGroup parent,
            KeyguardUpdateMonitor updateMonitor, KeyguardSecurityCallback callback,
            Handler handler, SurfaceControl.Transaction transaction) {
            Handler handler) {
        mContext = context;
        mHandler = handler;
        mParent = parent;
        mTransaction = transaction;
        mUpdateMonitor = updateMonitor;
        mKeyguardCallback = callback;
        mView = new AdminSecurityView(mContext, mSurfaceHolderCallback);
Loading