Loading packages/SystemUI/src/com/android/systemui/OverviewProxyService.java +46 −16 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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) { Loading @@ -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 Loading @@ -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 Loading Loading @@ -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); Loading @@ -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"); } } Loading Loading @@ -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 { Loading Loading
packages/SystemUI/src/com/android/systemui/OverviewProxyService.java +46 −16 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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) { Loading @@ -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 Loading @@ -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 Loading Loading @@ -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); Loading @@ -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"); } } Loading Loading @@ -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 { Loading