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

Commit 458dd875 authored by Craig Mautner's avatar Craig Mautner Committed by Android (Google) Code Review
Browse files

Merge "Fix launching non-full screen apps from home."

parents a7ef6c50 580ea81c
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -2341,6 +2341,8 @@ public final class ActivityManagerService extends ActivityManagerNative
    }
    void updateUsageStats(ActivityRecord resumedComponent, boolean resumed) {
        if (DEBUG_SWITCH) Slog.d(TAG, "updateUsageStats: comp=" + resumedComponent + "res="
                + resumed);
        if (resumed) {
            mUsageStatsService.noteResumeComponent(resumedComponent.realActivity);
        } else {
@@ -6781,7 +6783,7 @@ public final class ActivityManagerService extends ActivityManagerNative
                if (DEBUG_PROVIDER) {
                    RuntimeException e = new RuntimeException("here");
                    Slog.w(TAG, "LAUNCHING REMOTE PROVIDER (myuid " + r.uid
                    Slog.w(TAG, "LAUNCHING REMOTE PROVIDER (myuid " + (r != null ? r.uid : null)
                          + " pruid " + cpr.appInfo.uid + "): " + cpr.info.name, e);
                }
+27 −22
Original line number Diff line number Diff line
@@ -668,7 +668,6 @@ final class ActivityStack {
        checkReadyForSleepLocked();
    }

    // Checked.
    void checkReadyForSleepLocked() {
        if (!mService.isSleepingOrShuttingDown()) {
            // Do not care.
@@ -1003,7 +1002,6 @@ final class ActivityStack {
        prev.cpuTimeAtResume = 0; // reset it
    }

    // Checked.
    /**
     * Once we know that we have asked an application to put an activity in
     * the resumed state (either by launching it or explicitly telling it),
@@ -1034,13 +1032,28 @@ final class ActivityStack {
        }
    }

    // Checked.
    /**
     * Version of ensureActivitiesVisible that can easily be called anywhere.
     */
    final boolean ensureActivitiesVisibleLocked(ActivityRecord starting, int configChanges) {
        return ensureActivitiesVisibleLocked(starting, configChanges, false);
    }

    final boolean ensureActivitiesVisibleLocked(ActivityRecord starting, int configChanges,
            boolean forceHomeShown) {
        ActivityRecord r = topRunningActivityLocked(null);
        if (r != null) {
            return ensureActivitiesVisibleLocked(r, starting, null, configChanges, forceHomeShown);
        }
        return false;
    }

    /**
     * Make sure that all activities that need to be visible (that is, they
     * currently can be seen by the user) actually are.
     */
    final void ensureActivitiesVisibleLocked(ActivityRecord top,
            ActivityRecord starting, String onlyThisProcess, int configChanges) {
    final boolean ensureActivitiesVisibleLocked(ActivityRecord top, ActivityRecord starting,
            String onlyThisProcess, int configChanges, boolean forceHomeShown) {
        if (DEBUG_VISBILITY) Slog.v(
                TAG, "ensureActivitiesVisible behind " + top
                + " configChanges=0x" + Integer.toHexString(configChanges));
@@ -1048,7 +1061,9 @@ final class ActivityStack {
        // If the top activity is not fullscreen, then we need to
        // make sure any activities under it are now visible.
        boolean aboveTop = true;
        boolean behindFullscreen = !mStackSupervisor.isFrontStack(this);
        boolean showHomeBehindStack = false;
        boolean behindFullscreen = !mStackSupervisor.isFrontStack(this) &&
                !(forceHomeShown && isHomeStack());
        int taskNdx;
        for (taskNdx = mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
            final ArrayList<ActivityRecord> activities = mTaskHistory.get(taskNdx).mActivities;
@@ -1129,8 +1144,11 @@ final class ActivityStack {

                    if (r.fullscreen) {
                        // At this point, nothing else needs to be shown
                        if (DEBUG_VISBILITY) Slog.v(
                                TAG, "Stopping: fullscreen at " + r);
                        if (DEBUG_VISBILITY) Slog.v(TAG, "Fullscreen: at " + r);
                        behindFullscreen = true;
                    } else if (r.mLaunchHomeTaskNext) {
                        if (DEBUG_VISBILITY) Slog.v(TAG, "Showing home: at " + r);
                        showHomeBehindStack = true;
                        behindFullscreen = true;
                    }
                } else {
@@ -1163,18 +1181,7 @@ final class ActivityStack {
                }
            }
        }
    }

    // Checked.
    /**
     * Version of ensureActivitiesVisible that can easily be called anywhere.
     */
    final void ensureActivitiesVisibleLocked(ActivityRecord starting,
            int configChanges) {
        ActivityRecord r = topRunningActivityLocked(null);
        if (r != null) {
            ensureActivitiesVisibleLocked(r, starting, null, configChanges);
        }
        return showHomeBehindStack;
    }

    /**
@@ -1190,7 +1197,6 @@ final class ActivityStack {
        return resumeTopActivityLocked(prev, null);
    }

    // Checked.
    final boolean resumeTopActivityLocked(ActivityRecord prev, Bundle options) {
        // Find the first activity that is not finishing.
        ActivityRecord next = topRunningActivityLocked(null);
@@ -2173,7 +2179,6 @@ final class ActivityStack {
        }
    }

    // Checked.
    final ActivityRecord activityIdleInternalLocked(final IBinder token, boolean fromTimeout,
            Configuration config) {
        if (localLOGV) Slog.v(TAG, "Activity idle: " + token);
+15 −2
Original line number Diff line number Diff line
@@ -346,7 +346,7 @@ public class ActivityStackSupervisor {
                        throw e;
                    }
                } else {
                    stack.ensureActivitiesVisibleLocked(hr, null, processName, 0);
                    stack.ensureActivitiesVisibleLocked(hr, null, processName, 0, false);
                }
            }
        }
@@ -1941,8 +1941,21 @@ public class ActivityStackSupervisor {
    }

    void ensureActivitiesVisibleLocked(ActivityRecord starting, int configChanges) {
        // First the front stacks. In case any are not fullscreen and are in front of home.
        boolean showHomeBehindStack = false;
        for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
            mStacks.get(stackNdx).ensureActivitiesVisibleLocked(starting, configChanges);
            final ActivityStack stack = mStacks.get(stackNdx);
            if (isFrontStack(stack)) {
                showHomeBehindStack =
                        stack.ensureActivitiesVisibleLocked(starting, configChanges);
            }
        }
        // Now do back stacks.
        for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
            final ActivityStack stack = mStacks.get(stackNdx);
            if (!isFrontStack(stack)) {
                stack.ensureActivitiesVisibleLocked(starting, configChanges, showHomeBehindStack);
            }
        }
    }