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

Commit a655259e authored by Android Build Merger (Role)'s avatar Android Build Merger (Role) Committed by Android (Google) Code Review
Browse files

Merge "Merge "Added more logging around failures in overview connecting to...

Merge "Merge "Added more logging around failures in overview connecting to launcher" into pi-dev am: c0968edd am: 8d9672a8"
parents fbac01e3 ba83246b
Loading
Loading
Loading
Loading
+46 −16
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
    public static final String TAG_OPS = "OverviewProxyService";
    public static final boolean DEBUG_OVERVIEW_PROXY = false;
    private static final long BACKOFF_MILLIS = 5000;
    private static final long DEFERRED_CALLBACK_MILLIS = 5000;

    private final Context mContext;
    private final Handler mHandler;
@@ -162,6 +163,12 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
        }
    };

    private final Runnable mDeferredConnectionCallback = () -> {
        Log.w(TAG_OPS, "Binder supposed established connection but actual connection to service "
            + "timed out, trying again");
        internalConnectToCurrentUser();
    };

    private final BroadcastReceiver mLauncherStateChangedReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
@@ -181,7 +188,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
    private final ServiceConnection mOverviewServiceConnection = new ServiceConnection() {
        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {
            if (service != null) {
            mHandler.removeCallbacks(mDeferredConnectionCallback);
            mConnectionBackoffAttempts = 0;
            mOverviewProxy = IOverviewProxy.Stub.asInterface(service);
            // Listen for launcher's death
@@ -197,6 +204,17 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
            }
            notifyConnectionChanged();
        }

        @Override
        public void onNullBinding(ComponentName name) {
            Log.w(TAG_OPS, "Null binding of '" + name + "', try reconnecting");
            internalConnectToCurrentUser();
        }

        @Override
        public void onBindingDied(ComponentName name) {
            Log.w(TAG_OPS, "Binding died of '" + name + "', try reconnecting");
            internalConnectToCurrentUser();
        }

        @Override
@@ -262,6 +280,9 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis

        // If user has not setup yet or already connected, do not try to connect
        if (!mDeviceProvisionedController.isCurrentUserSetup() || !isEnabled()) {
            Log.v(TAG_OPS, "Cannot attempt connection, is setup "
                + mDeviceProvisionedController.isCurrentUserSetup() + ", is enabled "
                + isEnabled());
            return;
        }
        mHandler.removeCallbacks(mConnectionRunnable);
@@ -275,11 +296,16 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
        } catch (SecurityException e) {
            Log.e(TAG_OPS, "Unable to bind because of security error", e);
        }
        if (!bound) {
        if (bound) {
            // Ensure that connection has been established even if it thinks it is bound
            mHandler.postDelayed(mDeferredConnectionCallback, DEFERRED_CALLBACK_MILLIS);
        } else {
            // Retry after exponential backoff timeout
            final long timeoutMs = (long) Math.scalb(BACKOFF_MILLIS, mConnectionBackoffAttempts);
            mHandler.postDelayed(mConnectionRunnable, timeoutMs);
            mConnectionBackoffAttempts++;
            Log.w(TAG_OPS, "Failed to connect on attempt " + mConnectionBackoffAttempts
                    + " will try again in " + timeoutMs + "ms");
        }
    }

@@ -351,6 +377,10 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
        pw.print("  isCurrentUserSetup="); pw.println(mDeviceProvisionedController
                .isCurrentUserSetup());
        pw.print("  isConnected="); pw.println(mOverviewProxy != null);
        pw.print("  mRecentsComponentName="); pw.println(mRecentsComponentName);
        pw.print("  mIsEnabled="); pw.println(isEnabled());
        pw.print("  mInteractionFlags="); pw.println(mInteractionFlags);
        pw.print("  mQuickStepIntent="); pw.println(mQuickStepIntent);
    }

    public interface OverviewProxyListener {