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

Commit 303210bb authored by Filip Gruszczynski's avatar Filip Gruszczynski
Browse files

Start recents when bringing docked task to the front.

We don't want the docked activity to be on top by itself, so we need to
force the recents to come up to.

Bug: 25838525
Change-Id: Icb8184db5cc67e536561674b887bf481595257cc
parent 98763571
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -515,9 +515,9 @@ public final class ActivityManagerService extends ActivityManagerNative
    private Installer mInstaller;
    /** Run all ActivityStacks through this */
    ActivityStackSupervisor mStackSupervisor;
    final ActivityStackSupervisor mStackSupervisor;
    ActivityStarter mActivityStarter;
    final ActivityStarter mActivityStarter;
    /** Task stack change listeners. */
    private RemoteCallbackList<ITaskStackListener> mTaskStackListeners =
@@ -3643,11 +3643,9 @@ public final class ActivityManagerService extends ActivityManagerNative
            return false;
        }
        Intent intent = getHomeIntent();
        ActivityInfo aInfo =
            resolveActivityInfo(intent, STOCK_PM_FLAGS, userId);
        ActivityInfo aInfo = resolveActivityInfo(intent, STOCK_PM_FLAGS, userId);
        if (aInfo != null) {
            intent.setComponent(new ComponentName(
                    aInfo.applicationInfo.packageName, aInfo.name));
            intent.setComponent(new ComponentName(aInfo.applicationInfo.packageName, aInfo.name));
            // Don't do this if the home app is currently being
            // instrumented.
            aInfo = new ActivityInfo(aInfo);
+3 −3
Original line number Diff line number Diff line
@@ -3368,9 +3368,9 @@ final class ActivityStack {
                try {
                    ActivityInfo aInfo = AppGlobals.getPackageManager().getActivityInfo(
                            destIntent.getComponent(), 0, srec.userId);
                    int res = mService.mActivityStarter.startActivityLocked(srec.app.thread, destIntent,
                            null /*ephemeralIntent*/, null, aInfo, null /*rInfo*/, null, null,
                            parent.appToken, null, 0, -1, parent.launchedFromUid,
                    int res = mService.mActivityStarter.startActivityLocked(srec.app.thread,
                            destIntent, null /*ephemeralIntent*/, null, aInfo, null /*rInfo*/, null,
                            null, parent.appToken, null, 0, -1, parent.launchedFromUid,
                            parent.launchedFromPackage, -1, parent.launchedFromUid, 0, null,
                            false, true, null, null, null);
                    foundParentInTask = res == ActivityManager.START_SUCCESS;
+15 −2
Original line number Diff line number Diff line
@@ -32,12 +32,12 @@ import static android.content.Intent.FLAG_ACTIVITY_NEW_DOCUMENT;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
import static android.content.Intent.FLAG_ACTIVITY_NO_ANIMATION;
import static android.content.Intent.FLAG_ACTIVITY_NO_USER_ACTION;
import static android.content.Intent.FLAG_ACTIVITY_TASK_ON_HOME;
import static android.content.Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP;
import static android.content.Intent.FLAG_ACTIVITY_REORDER_TO_FRONT;
import static android.content.Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED;
import static android.content.Intent.FLAG_ACTIVITY_RETAIN_IN_RECENTS;
import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP;
import static android.content.Intent.FLAG_ACTIVITY_TASK_ON_HOME;
import static android.content.pm.ActivityInfo.DOCUMENT_LAUNCH_ALWAYS;
import static android.content.pm.ActivityInfo.LAUNCH_SINGLE_INSTANCE;
import static android.content.pm.ActivityInfo.LAUNCH_SINGLE_TASK;
@@ -45,6 +45,7 @@ import static android.content.pm.ActivityInfo.LAUNCH_SINGLE_TOP;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_CONFIGURATION;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_FOCUS;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_PERMISSIONS_REVIEW;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_RECENTS;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_RESULTS;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_STACK;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_TASKS;
@@ -64,7 +65,6 @@ import static com.android.server.am.ActivityStackSupervisor.FORCE_FOCUS;
import static com.android.server.am.ActivityStackSupervisor.ON_TOP;
import static com.android.server.am.ActivityStackSupervisor.TAG_TASKS;

import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityOptions;
import android.app.AppGlobals;
@@ -529,7 +529,10 @@ class ActivityStarter {
            // switch...  just dismiss the keyguard now, because we
            // probably want to see whatever is behind it.
            mSupervisor.notifyActivityDrawnForKeyguard();
        } else {
            launchRecentsAppIfNeeded(stack);
        }

        return err;
    }

@@ -1006,6 +1009,16 @@ class ActivityStarter {
        return START_SUCCESS;
    }

    private void launchRecentsAppIfNeeded(ActivityStack topStack) {
        if (topStack.mStackId == HOME_STACK_ID && mTargetStack.mStackId == DOCKED_STACK_ID) {
            // We launch an activity while being in home stack, which means either launcher or
            // recents into docked stack. We don't want the launched activity to be alone in a
            // docked stack, so we want to immediately launch recents too.
            if (DEBUG_RECENTS) Slog.d(TAG, "Scheduling recents launch.");
            mWindowManager.showRecentApps();
        }
    }

    private void setInitialState(ActivityRecord r, ActivityOptions options, TaskRecord inTask,
            boolean doResume, int startFlags, ActivityRecord sourceRecord,
            IVoiceInteractionSession voiceSession, IVoiceInteractor voiceInteractor) {