Fix QS CTS failure caused by tile backup

The CTS tests weren't receiving the onTileAdded callbacks since the
shade was not in the listening state when tiles were added. This is
not possible for users (since tiles are added while the UI is
listening), but add a flushMessagesAndUnbind call to make sure the
tiles always receive onTileAdded.

Since now flushMessagesAndUnbind can be called before a real call
to setBindService(true), add a clause that will clear out its
immediate unbind state.

Change-Id: Idd13c432a4af5741813da9a9b1b292a47fd9443b
Fixes: 31147742
This commit is contained in:
Jason Monk
2016-08-30 16:33:48 -04:00
parent aa8263d85d
commit 34f6cbc288
2 changed files with 7 additions and 0 deletions

View File

@@ -129,6 +129,12 @@ public class TileLifecycleManager extends BroadcastReceiver implements
}
public void setBindService(boolean bind) {
if (mBound && mUnbindImmediate) {
// If we are already bound and expecting to unbind, this means we should stay bound
// because something else wants to hold the connection open.
mUnbindImmediate = false;
return;
}
mBound = bind;
if (bind) {
if (mBindTryCount == MAX_BIND_RETRIES) {

View File

@@ -95,6 +95,7 @@ public class TileServiceManager {
if (!TileLifecycleManager.isTileAdded(context, component)) {
TileLifecycleManager.setTileAdded(context, component, true);
mStateManager.onTileAdded();
mStateManager.flushMessagesAndUnbind();
}
}