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

Commit 6afd1564 authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Fix unminimizing dock stack for AppTask.moveToFront

Some apps call AppTask.moveToFront instead of startActivity from
their trampoline activity. We need to handle this case also and
need to do all the post processing after starting an activity
so the docked stack gets unminimized.

Change-Id: I8400995bf1d1a4a4467d01fd55fca7e5800b4645
Fixes: 28722017
parent 5a6cf3ac
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -4404,6 +4404,12 @@ public final class ActivityStackSupervisor implements DisplayListener {
                    "startActivityFromRecentsInner: Task " + taskId + " not found.");
        }

        // Since we don't have an actual source record here, we assume that the currently focused
        // activity was the source.
        final ActivityStack focusedStack = getFocusedStack();
        final ActivityRecord sourceRecord =
                focusedStack != null ? focusedStack.topActivity() : null;

        if (launchStackId != INVALID_STACK_ID) {
            if (task.stack.mStackId != launchStackId) {
                moveTaskToStackLocked(
@@ -4427,6 +4433,11 @@ public final class ActivityStackSupervisor implements DisplayListener {
            if (launchStackId == DOCKED_STACK_ID) {
                setResizingDuringAnimation(taskId);
            }

            mService.mActivityStarter.postStartActivityUncheckedProcessing(task.getTopActivity(),
                    ActivityManager.START_TASK_TO_FRONT,
                    sourceRecord != null ? sourceRecord.task.stack.mStackId : INVALID_STACK_ID,
                    sourceRecord, task.stack);
            return ActivityManager.START_TASK_TO_FRONT;
        }
        callingUid = task.mCallingUid;
+9 −7
Original line number Diff line number Diff line
@@ -536,12 +536,13 @@ class ActivityStarter {
        } finally {
            mService.mWindowManager.continueSurfaceLayout();
        }
        postStartActivityUncheckedProcessing(r, err, stack.mStackId);
        postStartActivityUncheckedProcessing(r, err, stack.mStackId, mSourceRecord, mTargetStack);
        return err;
    }

    void postStartActivityUncheckedProcessing(
            ActivityRecord r, int result, int prevFocusedStackId) {
            ActivityRecord r, int result, int prevFocusedStackId, ActivityRecord sourceRecord,
            ActivityStack targetStack) {

        if (result < START_SUCCESS) {
            // If someone asked to have the keyguard dismissed on the next activity start,
@@ -555,7 +556,7 @@ class ActivityStarter {
        if (r.task != null && r.task.stack != null) {
            startedActivityStackId = r.task.stack.mStackId;
        } else if (mTargetStack != null) {
            startedActivityStackId = mTargetStack.mStackId;
            startedActivityStackId = targetStack.mStackId;
        }

        // If we launched the activity from a no display activity that was launched from the home
@@ -563,9 +564,9 @@ class ActivityStarter {
        // noDisplay activity will be finished shortly after.
        // TODO: We should prevent noDisplay activities from affecting task/stack ordering and
        // visibility instead of using this flag.
        final boolean noDisplayActivityOverHome = mSourceRecord != null
                && mSourceRecord.noDisplay
                && mSourceRecord.task.getTaskToReturnTo() == HOME_ACTIVITY_TYPE;
        final boolean noDisplayActivityOverHome = sourceRecord != null
                && sourceRecord.noDisplay
                && sourceRecord.task.getTaskToReturnTo() == HOME_ACTIVITY_TYPE;
        if (startedActivityStackId == DOCKED_STACK_ID
                && (prevFocusedStackId == HOME_STACK_ID || noDisplayActivityOverHome)) {
            final ActivityStack homeStack = mSupervisor.getStack(HOME_STACK_ID);
@@ -1788,7 +1789,8 @@ class ActivityStarter {
                final int result = startActivityUnchecked(
                        pal.r, pal.sourceRecord, null, null, pal.startFlags, resume, null, null);
                postStartActivityUncheckedProcessing(
                        pal.r, result, mSupervisor.mFocusedStack.mStackId);
                        pal.r, result, mSupervisor.mFocusedStack.mStackId, mSourceRecord,
                        mTargetStack);
            } catch (Exception e) {
                Slog.e(TAG, "Exception during pending activity launch pal=" + pal, e);
                pal.sendErrorResult(e.getMessage());