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

Commit 58b276a6 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Add reason log for OPS killing launcher connection" into tm-qpr-dev am:...

Merge "Add reason log for OPS killing launcher connection" into tm-qpr-dev am: 1e9105e9 am: d6718c80 am: 1b6d0987 am: fff9bcd0

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



Change-Id: I5a0bb7f568752ca4778c192f1aa3b04a5de5626c
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 6e5508ae fff9bcd0
Loading
Loading
Loading
Loading
+11 −8
Original line number Original line Diff line number Diff line
@@ -140,7 +140,8 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
    private final Handler mHandler;
    private final Handler mHandler;
    private final Lazy<NavigationBarController> mNavBarControllerLazy;
    private final Lazy<NavigationBarController> mNavBarControllerLazy;
    private final NotificationShadeWindowController mStatusBarWinController;
    private final NotificationShadeWindowController mStatusBarWinController;
    private final Runnable mConnectionRunnable = this::internalConnectToCurrentUser;
    private final Runnable mConnectionRunnable = () ->
            internalConnectToCurrentUser("runnable: startConnectionToCurrentUser");
    private final ComponentName mRecentsComponentName;
    private final ComponentName mRecentsComponentName;
    private final List<OverviewProxyListener> mConnectionCallbacks = new ArrayList<>();
    private final List<OverviewProxyListener> mConnectionCallbacks = new ArrayList<>();
    private final Intent mQuickStepIntent;
    private final Intent mQuickStepIntent;
@@ -406,7 +407,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
                // Failed to link to death (process may have died between binding and connecting),
                // Failed to link to death (process may have died between binding and connecting),
                // just unbind the service for now and retry again
                // just unbind the service for now and retry again
                Log.e(TAG_OPS, "Lost connection to launcher service", e);
                Log.e(TAG_OPS, "Lost connection to launcher service", e);
                disconnectFromLauncherService();
                disconnectFromLauncherService("Lost connection to launcher service");
                retryConnectionWithBackoff();
                retryConnectionWithBackoff();
                return;
                return;
            }
            }
@@ -501,7 +502,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
                @Override
                @Override
                public void onUserChanged(int newUser, @NonNull Context userContext) {
                public void onUserChanged(int newUser, @NonNull Context userContext) {
                    mConnectionBackoffAttempts = 0;
                    mConnectionBackoffAttempts = 0;
                    internalConnectToCurrentUser();
                    internalConnectToCurrentUser("User changed");
                }
                }
            };
            };


@@ -716,12 +717,12 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
        if (mHandler.getLooper() != Looper.myLooper()) {
        if (mHandler.getLooper() != Looper.myLooper()) {
            mHandler.post(mConnectionRunnable);
            mHandler.post(mConnectionRunnable);
        } else {
        } else {
            internalConnectToCurrentUser();
            internalConnectToCurrentUser("startConnectionToCurrentUser");
        }
        }
    }
    }


    private void internalConnectToCurrentUser() {
    private void internalConnectToCurrentUser(String reason) {
        disconnectFromLauncherService();
        disconnectFromLauncherService(reason);


        // If user has not setup yet or already connected, do not try to connect
        // If user has not setup yet or already connected, do not try to connect
        if (!isEnabled()) {
        if (!isEnabled()) {
@@ -783,7 +784,9 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
        return mOverviewProxy;
        return mOverviewProxy;
    }
    }


    private void disconnectFromLauncherService() {
    private void disconnectFromLauncherService(String disconnectReason) {
        Log.d(TAG_OPS, "disconnectFromLauncherService bound?: " + mBound +
                " currentProxy: " + mOverviewProxy + " disconnectReason: " + disconnectReason);
        if (mBound) {
        if (mBound) {
            // Always unbind the service (ie. if called through onNullBinding or onBindingDied)
            // Always unbind the service (ie. if called through onNullBinding or onBindingDied)
            mContext.unbindService(mOverviewServiceConnection);
            mContext.unbindService(mOverviewServiceConnection);
@@ -1047,6 +1050,6 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
        mContext.unregisterReceiver(mLauncherStateChangedReceiver);
        mContext.unregisterReceiver(mLauncherStateChangedReceiver);
        mIsEnabled = false;
        mIsEnabled = false;
        mHandler.removeCallbacks(mConnectionRunnable);
        mHandler.removeCallbacks(mConnectionRunnable);
        disconnectFromLauncherService();
        disconnectFromLauncherService("Shutdown for test");
    }
    }
}
}