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

Commit 390b7391 authored by Winson Chung's avatar Winson Chung Committed by Automerger Merge Worker
Browse files

Merge "Ensure we update the navigation mode when switching users" into rvc-dev...

Merge "Ensure we update the navigation mode when switching users" into rvc-dev am: 2e0fd15e am: 4c57470a am: 833a61bb am: 4da4c620

Change-Id: I0dc5a1ab61b5c1fab84b31caaccc711817c1422f
parents d556fe17 4da4c620
Loading
Loading
Loading
Loading
+23 −4
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import android.util.Log;
import com.android.systemui.Dumpable;
import com.android.systemui.dagger.qualifiers.UiBackground;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;

import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -78,13 +79,31 @@ public class NavigationModeController implements Dumpable {
        }
    };

    private final DeviceProvisionedController.DeviceProvisionedListener mDeviceProvisionedCallback =
            new DeviceProvisionedController.DeviceProvisionedListener() {
                @Override
                public void onUserSwitched() {
                    if (DEBUG) {
                        Log.d(TAG, "onUserSwitched: "
                                + ActivityManagerWrapper.getInstance().getCurrentUserId());
                    }

                    // Update the nav mode for the current user
                    updateCurrentInteractionMode(true /* notify */);
                }
            };


    @Inject
    public NavigationModeController(Context context, @UiBackground Executor uiBgExecutor) {
    public NavigationModeController(Context context,
            DeviceProvisionedController deviceProvisionedController,
            @UiBackground Executor uiBgExecutor) {
        mContext = context;
        mCurrentUserContext = context;
        mOverlayManager = IOverlayManager.Stub.asInterface(
                ServiceManager.getService(Context.OVERLAY_SERVICE));
        mUiBgExecutor = uiBgExecutor;
        deviceProvisionedController.addCallback(mDeviceProvisionedCallback);

        IntentFilter overlayFilter = new IntentFilter(ACTION_OVERLAY_CHANGED);
        overlayFilter.addDataScheme("package");