I am occasionally getting an assert failure on line 699 of DialogTest.java. It is testing that it received an onFocusChanged() callback after displaying a new window.
Seems to me there is a problem with this test: mActivity.showDialog(DialogStubActivity.TEST_DIALOG_WITHOUT_THEME); ...starts displaying a new dialog box. A little further down in the test, it calls: mInstrumentation.waitForIdleSync(); ...apparently to wait for all messages to drain from the message queue. Then it checks a boolean flag to make sure the expected callback happened: assertTrue(d.isOnWindowFocusChangedCalled); ...and that is where I sometimes get a failure. After putting in some debug prints, here is what I have discovered: mActivity.showDialog() eventually calls WindowManagerService.updateFocusedWindowLocked() which sends a REPORT_FOCUS_CHANGE message. Unfortunately the message is not inserted in the same queue that mInstrumentation.waitForIdleSync() is waiting for, afaict. It's not even in the same process. So sometimes mInstrumentation.waitForIdleSync() returns before the REPORT_FOCUS_CHANGE message has been processed which causes the assert to fail. Does this sound correct? What is a good way to fix this? Thanks -- unsubscribe: android-porting+unsubscr...@googlegroups.com website: http://groups.google.com/group/android-porting