Prevent stopping dream immediately.

There are two places where we are currently stopping the dream process
immediately instead of waiting for the dream to complete:
1) DreamManagerService#requestStopDreamFromShell. In this use case,
   we're simulating normal interaction and shouldn't be stopping
   immediately.
2) DreamActivity#onDestroy. This stops the dream immediately by
   indirectly calling DreamService#onDestroy. This fix was meant to
   ensure that the DreamService destroy sequence always executed.
   However, always calling this on Activity#onDestroy leads to a
   race condition with the normal Activity teardown logic. This
   should exclude cases where DreamService#onDestroy wouldn't
   be called, such as when the Activity is finishing.

This changelist addresses these paths to ensure normal usage doesn't
result in immediately stopping the DreamService.

Bug: 242368903
Bug: 241569844
Bug: 243385408
Test: atest DreamServiceTest
Change-Id: Iba346f325383cbf949c65f896237e3d997efcab0
2 files changed