Loading packages/SystemUI/src/com/android/systemui/OverviewProxyService.java +19 −8 Original line number Original line Diff line number Diff line Loading @@ -70,6 +70,9 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis private static final long BACKOFF_MILLIS = 1000; private static final long BACKOFF_MILLIS = 1000; private static final long DEFERRED_CALLBACK_MILLIS = 5000; private static final long DEFERRED_CALLBACK_MILLIS = 5000; // Max backoff caps at 5 mins private static final long MAX_BACKOFF_MILLIS = 10 * 60 * 1000; // Default interaction flags if swipe up is disabled before connecting to launcher // Default interaction flags if swipe up is disabled before connecting to launcher private static final int DEFAULT_DISABLE_SWIPE_UP_STATE = FLAG_DISABLE_SWIPE_UP private static final int DEFAULT_DISABLE_SWIPE_UP_STATE = FLAG_DISABLE_SWIPE_UP | FLAG_SHOW_OVERVIEW_BUTTON; | FLAG_SHOW_OVERVIEW_BUTTON; Loading Loading @@ -215,7 +218,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis private final Runnable mDeferredConnectionCallback = () -> { private final Runnable mDeferredConnectionCallback = () -> { Log.w(TAG_OPS, "Binder supposed established connection but actual connection to service " Log.w(TAG_OPS, "Binder supposed established connection but actual connection to service " + "timed out, trying again"); + "timed out, trying again"); internalConnectToCurrentUser(); retryConnectionWithBackoff(); }; }; private final BroadcastReceiver mLauncherStateChangedReceiver = new BroadcastReceiver() { private final BroadcastReceiver mLauncherStateChangedReceiver = new BroadcastReceiver() { Loading Loading @@ -260,14 +263,14 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis public void onNullBinding(ComponentName name) { public void onNullBinding(ComponentName name) { Log.w(TAG_OPS, "Null binding of '" + name + "', try reconnecting"); Log.w(TAG_OPS, "Null binding of '" + name + "', try reconnecting"); mCurrentBoundedUserId = -1; mCurrentBoundedUserId = -1; internalConnectToCurrentUser(); retryConnectionWithBackoff(); } } @Override @Override public void onBindingDied(ComponentName name) { public void onBindingDied(ComponentName name) { Log.w(TAG_OPS, "Binding died of '" + name + "', try reconnecting"); Log.w(TAG_OPS, "Binding died of '" + name + "', try reconnecting"); mCurrentBoundedUserId = -1; mCurrentBoundedUserId = -1; internalConnectToCurrentUser(); retryConnectionWithBackoff(); } } @Override @Override Loading Loading @@ -357,13 +360,21 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis mHandler.postDelayed(mDeferredConnectionCallback, DEFERRED_CALLBACK_MILLIS); mHandler.postDelayed(mDeferredConnectionCallback, DEFERRED_CALLBACK_MILLIS); } else { } else { // Retry after exponential backoff timeout // Retry after exponential backoff timeout final long timeoutMs = (long) Math.scalb(BACKOFF_MILLIS, mConnectionBackoffAttempts); retryConnectionWithBackoff(); } } private void retryConnectionWithBackoff() { if (mHandler.hasCallbacks(mConnectionRunnable)) { return; } final long timeoutMs = (long) Math.min( Math.scalb(BACKOFF_MILLIS, mConnectionBackoffAttempts), MAX_BACKOFF_MILLIS); mHandler.postDelayed(mConnectionRunnable, timeoutMs); mHandler.postDelayed(mConnectionRunnable, timeoutMs); mConnectionBackoffAttempts++; mConnectionBackoffAttempts++; Log.w(TAG_OPS, "Failed to connect on attempt " + mConnectionBackoffAttempts Log.w(TAG_OPS, "Failed to connect on attempt " + mConnectionBackoffAttempts + " will try again in " + timeoutMs + "ms"); + " will try again in " + timeoutMs + "ms"); } } } @Override @Override public void addCallback(OverviewProxyListener listener) { public void addCallback(OverviewProxyListener listener) { Loading Loading
packages/SystemUI/src/com/android/systemui/OverviewProxyService.java +19 −8 Original line number Original line Diff line number Diff line Loading @@ -70,6 +70,9 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis private static final long BACKOFF_MILLIS = 1000; private static final long BACKOFF_MILLIS = 1000; private static final long DEFERRED_CALLBACK_MILLIS = 5000; private static final long DEFERRED_CALLBACK_MILLIS = 5000; // Max backoff caps at 5 mins private static final long MAX_BACKOFF_MILLIS = 10 * 60 * 1000; // Default interaction flags if swipe up is disabled before connecting to launcher // Default interaction flags if swipe up is disabled before connecting to launcher private static final int DEFAULT_DISABLE_SWIPE_UP_STATE = FLAG_DISABLE_SWIPE_UP private static final int DEFAULT_DISABLE_SWIPE_UP_STATE = FLAG_DISABLE_SWIPE_UP | FLAG_SHOW_OVERVIEW_BUTTON; | FLAG_SHOW_OVERVIEW_BUTTON; Loading Loading @@ -215,7 +218,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis private final Runnable mDeferredConnectionCallback = () -> { private final Runnable mDeferredConnectionCallback = () -> { Log.w(TAG_OPS, "Binder supposed established connection but actual connection to service " Log.w(TAG_OPS, "Binder supposed established connection but actual connection to service " + "timed out, trying again"); + "timed out, trying again"); internalConnectToCurrentUser(); retryConnectionWithBackoff(); }; }; private final BroadcastReceiver mLauncherStateChangedReceiver = new BroadcastReceiver() { private final BroadcastReceiver mLauncherStateChangedReceiver = new BroadcastReceiver() { Loading Loading @@ -260,14 +263,14 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis public void onNullBinding(ComponentName name) { public void onNullBinding(ComponentName name) { Log.w(TAG_OPS, "Null binding of '" + name + "', try reconnecting"); Log.w(TAG_OPS, "Null binding of '" + name + "', try reconnecting"); mCurrentBoundedUserId = -1; mCurrentBoundedUserId = -1; internalConnectToCurrentUser(); retryConnectionWithBackoff(); } } @Override @Override public void onBindingDied(ComponentName name) { public void onBindingDied(ComponentName name) { Log.w(TAG_OPS, "Binding died of '" + name + "', try reconnecting"); Log.w(TAG_OPS, "Binding died of '" + name + "', try reconnecting"); mCurrentBoundedUserId = -1; mCurrentBoundedUserId = -1; internalConnectToCurrentUser(); retryConnectionWithBackoff(); } } @Override @Override Loading Loading @@ -357,13 +360,21 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis mHandler.postDelayed(mDeferredConnectionCallback, DEFERRED_CALLBACK_MILLIS); mHandler.postDelayed(mDeferredConnectionCallback, DEFERRED_CALLBACK_MILLIS); } else { } else { // Retry after exponential backoff timeout // Retry after exponential backoff timeout final long timeoutMs = (long) Math.scalb(BACKOFF_MILLIS, mConnectionBackoffAttempts); retryConnectionWithBackoff(); } } private void retryConnectionWithBackoff() { if (mHandler.hasCallbacks(mConnectionRunnable)) { return; } final long timeoutMs = (long) Math.min( Math.scalb(BACKOFF_MILLIS, mConnectionBackoffAttempts), MAX_BACKOFF_MILLIS); mHandler.postDelayed(mConnectionRunnable, timeoutMs); mHandler.postDelayed(mConnectionRunnable, timeoutMs); mConnectionBackoffAttempts++; mConnectionBackoffAttempts++; Log.w(TAG_OPS, "Failed to connect on attempt " + mConnectionBackoffAttempts Log.w(TAG_OPS, "Failed to connect on attempt " + mConnectionBackoffAttempts + " will try again in " + timeoutMs + "ms"); + " will try again in " + timeoutMs + "ms"); } } } @Override @Override public void addCallback(OverviewProxyListener listener) { public void addCallback(OverviewProxyListener listener) { Loading