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

Commit 85ee6548 authored by Chong Zhang's avatar Chong Zhang
Browse files

Put ResovlerActivity and noDisplay activities in the source task

Launch the ResolverActivity in the source task, so that the chooser
stays in the bounds of the task, instead of always at the bottom of
the screen.

Also put the nodisplay activities in the source task, it could launch
other activities (eg. ResolverActivity), we need the original task.

Bug: 24136124
Change-Id: I8b22d7f6cba4dc9e57cb19d357091013a74826bb
parent 4d4b9fd7
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -477,8 +477,8 @@ final class ActivityRecord {
        }
    }

    boolean isNotResolverActivity() {
        return !ResolverActivity.class.getName().equals(realActivity.getClassName());
    boolean isResolverActivity() {
        return ResolverActivity.class.getName().equals(realActivity.getClassName());
    }

    ActivityRecord(ActivityManagerService _service, ProcessRecord _caller,
@@ -605,7 +605,7 @@ final class ActivityRecord {
                    _intent.getData() == null &&
                    _intent.getType() == null &&
                    (intent.getFlags()&Intent.FLAG_ACTIVITY_NEW_TASK) != 0 &&
                    isNotResolverActivity()) {
                    !isResolverActivity()) {
                // This sure looks like a home activity!
                mActivityType = HOME_ACTIVITY_TYPE;
            } else if (realActivity.getClassName().contains(RECENTS_PACKAGE_NAME)) {
+1 −1
Original line number Diff line number Diff line
@@ -1153,7 +1153,7 @@ final class ActivityStack {
        next.results = null;
        next.newIntents = null;

        if (next.isHomeActivity() && next.isNotResolverActivity()) {
        if (next.isHomeActivity()) {
            ProcessRecord app = next.task.mActivities.get(0).app;
            if (app != null && app != mService.mHomeProcess) {
                mService.mHomeProcess = app;
+9 −1
Original line number Diff line number Diff line
@@ -1262,7 +1262,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
                        r.userId, System.identityHashCode(r),
                        task.taskId, r.shortComponentName);
            }
            if (r.isHomeActivity() && r.isNotResolverActivity()) {
            if (r.isHomeActivity()) {
                // Home process is the root process of the task.
                mService.mHomeProcess = task.mActivities.get(0).app;
            }
@@ -2024,6 +2024,14 @@ public final class ActivityStackSupervisor implements DisplayListener {
            reuseTask = inTask;
        } else {
            inTask = null;
            // Launch ResolverActivity in the source task, so that it stays in the task
            // bounds when in freeform workspace.
            // Also put noDisplay activities in the source task. These by itself can
            // be placed in any task/stack, however it could launch other activities
            // like ResolverActivity, and we want those to stay in the original task.
            if (r.isResolverActivity() || r.noDisplay) {
                addingToTask = true;
            }
        }

        if (inTask == null) {