Make DreamActivity translucent when waking up dream

The DreamService calls onWakeUp, which allows the dream application to
finish the dream itself and apply an exit animation for up to 5 seconds
(after that, the system force removes the dream window). During the time
when the dream application is performing an exit animation, the dream
activity window is opaque. This causes problems when the dream
application applies a long exit animation - turnScreenOn+noHistory
activities are put under the dream (because dream has highest z-order)
and get destroyed before they get a chance to be drawn (because they
never become visible).

This CL makes the dream activity translucent before onWakeUp is called.
This allows turnScreenOn+noHistory activities to be resumed underneath
the dream, while the dream is transitioning out.

Bug: 162880999
Bug: 198359939
Test: manual
Change-Id: I5045ba8765dd1918cf85ec0fa433617843e727bd
This commit is contained in:
Galia Peycheva
2021-09-13 11:19:33 +02:00
parent 8bd6b0d178
commit 7b024ebd9d

View File

@@ -920,6 +920,13 @@ public class DreamService extends Service implements Window.Callback {
if (!mWaking && !mFinished) {
mWaking = true;
// During wake up the activity should be translucent to allow the application underneath
// to start drawing. Normally, the WM animation system takes care of this, but here we
// give the dream application some time to perform a custom exit animation.
// If it uses a view animation, the WM doesn't know about it and can't make the activity
// translucent in the normal way. Therefore, here we ensure that the activity is
// translucent during wake up regardless of what animation is used in onWakeUp().
mActivity.convertToTranslucent(null, null);
// As a minor optimization, invoke the callback first in case it simply
// calls finish() immediately so there wouldn't be much point in telling