Fixed the failing tests in com.android.server.dreams

We were seeing the issue where
DreamManagerServiceMockingTest::testSettingsQueryUserChange was failing because of
lack of a permission, but when that permission was given, other tests in
the same module started to fail. The issue was we were not waiting for
the handler thread to be successfully executed before moving onto the
next test. This is now being fixed using a TestHandler. However, given
DreamManagerService is using DreamHandler, we had to change the handler
type in DreamManagerService to Handler. This means we might face an
issue with this test if we were to add a new utility in DreamHandler,
but given we have not seen any such usecases soo far, lets defer to
solving for that scenario for the future.

Test: atest com.android.server.dreams
Bug: 293443309
Change-Id: I19d235021077ca39cf14d0593ac5a8f5aa0f98a9
4 files changed