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

Commit 69a5697e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Notify window manager service that we are switching users" into rvc-dev am: 12b5186f

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11821052

Change-Id: Ibc8f185b563c3f800bfbcba5882859946c85dc88
parents f4734b20 12b5186f
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -23,9 +23,12 @@ import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.os.Handler;
import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
import android.util.Log;
import android.view.IWindowManager;
import android.widget.ImageView;
import android.widget.TextView;

@@ -44,13 +47,14 @@ import javax.inject.Singleton;
 */
@Singleton
public class UserSwitchTransitionViewController extends OverlayViewController {
    private static final String TAG = "UserSwitchTransitionViewController";
    private static final String TAG = "UserSwitchTransition";
    private static final String ENABLE_DEVELOPER_MESSAGE_TRUE = "true";

    private final Context mContext;
    private final Handler mHandler;
    private final Resources mResources;
    private final UserManager mUserManager;
    private final IWindowManager mWindowManagerService;

    @GuardedBy("this")
    private boolean mShowing;
@@ -62,6 +66,7 @@ public class UserSwitchTransitionViewController extends OverlayViewController {
            @Main Handler handler,
            @Main Resources resources,
            UserManager userManager,
            IWindowManager windowManagerService,
            OverlayViewGlobalStateController overlayViewGlobalStateController) {

        super(R.id.user_switching_dialog_stub, overlayViewGlobalStateController);
@@ -70,6 +75,7 @@ public class UserSwitchTransitionViewController extends OverlayViewController {
        mHandler = handler;
        mResources = resources;
        mUserManager = userManager;
        mWindowManagerService = windowManagerService;
    }

    /**
@@ -81,6 +87,13 @@ public class UserSwitchTransitionViewController extends OverlayViewController {
        if (mPreviousUserId == newUserId || mShowing) return;
        mShowing = true;
        mHandler.post(() -> {
            try {
                mWindowManagerService.setSwitchingUser(true);
                mWindowManagerService.lockNow(null);
            } catch (RemoteException e) {
                Log.e(TAG, "unable to notify window manager service regarding user switch");
            }

            start();
            populateDialog(mPreviousUserId, newUserId);
            // next time a new user is selected, this current new user will be the previous user.
+7 −1
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
import android.testing.TestableResources;
import android.view.IWindowManager;
import android.view.LayoutInflater;
import android.view.ViewGroup;

@@ -52,6 +53,8 @@ public class UserSwitchTransitionViewControllerTest extends SysuiTestCase {
    private TestableResources mTestableResources;
    @Mock
    private OverlayViewGlobalStateController mOverlayViewGlobalStateController;
    @Mock
    private IWindowManager mWindowManagerService;

    @Before
    public void setUp() {
@@ -62,6 +65,7 @@ public class UserSwitchTransitionViewControllerTest extends SysuiTestCase {
                Handler.getMain(),
                mTestableResources.getResources(),
                (UserManager) mContext.getSystemService(Context.USER_SERVICE),
                mWindowManagerService,
                mOverlayViewGlobalStateController
        );

@@ -125,8 +129,10 @@ public class UserSwitchTransitionViewControllerTest extends SysuiTestCase {

        TestableUserSwitchTransitionViewController(Context context, Handler handler,
                Resources resources, UserManager userManager,
                IWindowManager windowManagerService,
                OverlayViewGlobalStateController overlayViewGlobalStateController) {
            super(context, handler, resources, userManager, overlayViewGlobalStateController);
            super(context, handler, resources, userManager, windowManagerService,
                    overlayViewGlobalStateController);
            mHandler = handler;
        }