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

Commit a6e7cb2a authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes I37d55b60,I350ec45b

* changes:
  Fixes connecting to service after setup finishes for other users
  Fixes service disconnect crash when changing users
parents e0c97dfe dfab86cd
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ public class OverviewProxyService {
    private final DeviceProvisionedListener mDeviceProvisionedCallback =
                new DeviceProvisionedListener() {
            @Override
            public void onDeviceProvisionedChanged() {
            public void onUserSetupChanged() {
                if (mDeviceProvisionedController.isCurrentUserSetup()) {
                    startConnectionToCurrentUser();
                }
@@ -78,7 +78,6 @@ public class OverviewProxyService {

            @Override
            public void onUserSwitched() {
                disconnectFromLauncherService();
                mConnectionBackoffAttempts = 0;
                startConnectionToCurrentUser();
            }
@@ -100,8 +99,10 @@ public class OverviewProxyService {
    }

    public void startConnectionToCurrentUser() {
        disconnectFromLauncherService();

        // If user has not setup yet or already connected, do not try to connect
        if (!mDeviceProvisionedController.isCurrentUserSetup() || mOverviewProxy != null) {
        if (!mDeviceProvisionedController.isCurrentUserSetup()) {
            return;
        }
        mHandler.removeCallbacks(mConnectionRunnable);
@@ -124,7 +125,9 @@ public class OverviewProxyService {
    }

    private void disconnectFromLauncherService() {
        if (mOverviewProxy != null) {
            mContext.unbindService(mOverviewServiceConnection);
            mOverviewProxy = null;
        }
    }
}