Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5b4be868 authored by Mady Mellor's avatar Mady Mellor
Browse files

Maybe fix transitions for bubbles

When an async event must occur to prepare a transition, defer and
continue the transition before /after that async event. Otherwise the
transition may start without the necessary info to properly handle
the transition resulting in missed / mishandled transitions.

This won't fix it in all cases but might minimize some situations
where this can happen until the long term fix (b/294925498) is
completed.

Bug: 299377680
Test: treehugger / manual - opened some pending intent based bubbles
Change-Id: I4323919b387e94e039ad51f8b09729599bd79f94
parent d65eea6b
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -1034,8 +1034,14 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
                launchOpts.remove(WindowContainerTransaction.HierarchyOp.LAUNCH_KEY_TASK_ID);
                final SafeActivityOptions safeOptions =
                        SafeActivityOptions.fromBundle(launchOpts, caller.mPid, caller.mUid);
                if (transition != null) {
                    transition.deferTransitionReady();
                }
                waitAsyncStart(() -> mService.mTaskSupervisor.startActivityFromRecents(
                        caller.mPid, caller.mUid, taskId, safeOptions));
                if (transition != null) {
                    transition.continueTransitionReady();
                }
                break;
            }
            case HIERARCHY_OP_TYPE_REORDER:
@@ -1113,11 +1119,17 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
                    activityOptions.setCallerDisplayId(DEFAULT_DISPLAY);
                }
                final Bundle options = activityOptions != null ? activityOptions.toBundle() : null;
                if (transition != null) {
                    transition.deferTransitionReady();
                }
                int res = waitAsyncStart(() -> mService.mAmInternal.sendIntentSender(
                        hop.getPendingIntent().getTarget(),
                        hop.getPendingIntent().getWhitelistToken(), 0 /* code */,
                        hop.getActivityIntent(), resolvedType, null /* finishReceiver */,
                        null /* requiredPermission */, options));
                if (transition != null) {
                    transition.continueTransitionReady();
                }
                if (ActivityManager.isStartResultSuccessful(res)) {
                    effects |= TRANSACT_EFFECTS_LIFECYCLE;
                }