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

Commit d316d3d2 authored by Filip Gruszczynski's avatar Filip Gruszczynski Committed by Android (Google) Code Review
Browse files

Merge "Refactoring: Remove unused parameter from topRunningActivityLocked."

parents 012904e4 3e85ba29
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -2736,7 +2736,7 @@ public final class ActivityManagerService extends ActivityManagerNative
        synchronized (ActivityManagerService.this) {
            ActivityStack stack = mStackSupervisor.getStack(stackId);
            if (stack != null) {
                ActivityRecord r = stack.topRunningActivityLocked(null);
                ActivityRecord r = stack.topRunningActivityLocked();
                if (r != null) {
                    setFocusedActivityLocked(r, "setFocusedStack");
                    mStackSupervisor.resumeTopActivitiesLocked(stack, null, null);
@@ -2753,7 +2753,7 @@ public final class ActivityManagerService extends ActivityManagerNative
            synchronized (ActivityManagerService.this) {
                TaskRecord task = mStackSupervisor.anyTaskForIdLocked(taskId);
                if (task != null) {
                    ActivityRecord r = task.topRunningActivityLocked(null);
                    ActivityRecord r = task.topRunningActivityLocked();
                    if (r != null) {
                        setFocusedActivityLocked(r, "setFocusedTask");
                        mStackSupervisor.resumeTopActivitiesLocked(task.stack, null, null);
@@ -11353,7 +11353,7 @@ public final class ActivityManagerService extends ActivityManagerNative
    public boolean isTopActivityImmersive() {
        enforceNotIsolatedCaller("startActivity");
        synchronized (this) {
            ActivityRecord r = getFocusedStack().topRunningActivityLocked(null);
            ActivityRecord r = getFocusedStack().topRunningActivityLocked();
            return (r != null) ? r.immersive : false;
        }
    }
@@ -17744,7 +17744,7 @@ public final class ActivityManagerService extends ActivityManagerNative
                // If the configuration changed, and the caller is not already
                // in the process of starting an activity, then find the top
                // activity to check if its configuration needs to change.
                starting = mainStack.topRunningActivityLocked(null);
                starting = mainStack.topRunningActivityLocked();
            }
            if (starting != null) {
+1 −1
Original line number Diff line number Diff line
@@ -774,7 +774,7 @@ final class ActivityRecord {
        boolean unsent = true;
        if ((state == ActivityState.RESUMED
                || (service.isSleeping() && task.stack != null
                    && task.stack.topRunningActivityLocked(null) == this))
                    && task.stack.topRunningActivityLocked() == this))
                && app != null && app.thread != null) {
            try {
                ArrayList<ReferrerIntent> ar = new ArrayList<>(1);
+20 −20
Original line number Diff line number Diff line
@@ -403,9 +403,9 @@ final class ActivityStack {
        return mStackSupervisor.okToShowLocked(r);
    }

    final ActivityRecord topRunningActivityLocked(ActivityRecord notTop) {
    final ActivityRecord topRunningActivityLocked() {
        for (int taskNdx = mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
            ActivityRecord r = mTaskHistory.get(taskNdx).topRunningActivityLocked(notTop);
            ActivityRecord r = mTaskHistory.get(taskNdx).topRunningActivityLocked();
            if (r != null) {
                return r;
            }
@@ -689,7 +689,7 @@ final class ActivityStack {
            // NOTE: If {@link TaskRecord#topRunningActivityLocked} return is not null then it is
            // okay to show the activity when locked.
            if (mStackSupervisor.isCurrentProfileLocked(task.userId)
                    || task.topRunningActivityLocked(null) != null) {
                    || task.topRunningActivityLocked() != null) {
                if (DEBUG_TASKS) Slog.d(TAG_TASKS, "switchUserLocked: stack=" + getStackId() +
                        " moving " + task + " to top");
                mTaskHistory.remove(i);
@@ -1105,7 +1105,7 @@ final class ActivityStack {
                mStackSupervisor.resumeTopActivitiesLocked(topStack, prev, null);
            } else {
                mStackSupervisor.checkReadyForSleepLocked();
                ActivityRecord top = topStack.topRunningActivityLocked(null);
                ActivityRecord top = topStack.topRunningActivityLocked();
                if (top == null || (prev != null && top != prev)) {
                    // If there are no more activities available to run,
                    // do resume anyway to start something.  Also if the top
@@ -1326,7 +1326,7 @@ final class ActivityStack {
            if (focusedStackId != HOME_STACK_ID) {
                return true;
            }
            ActivityRecord topHomeActivity = focusedStack.topRunningActivityLocked(null);
            ActivityRecord topHomeActivity = focusedStack.topRunningActivityLocked();
            return topHomeActivity == null || !topHomeActivity.isHomeActivity();
        }

@@ -1387,7 +1387,7 @@ final class ActivityStack {
     */
    final void ensureActivitiesVisibleLocked(ActivityRecord starting, int configChanges,
            boolean preserveWindows) {
        ActivityRecord top = topRunningActivityLocked(null);
        ActivityRecord top = topRunningActivityLocked();
        if (top == null) {
            return;
        }
@@ -1643,7 +1643,7 @@ final class ActivityStack {
     * starting window displayed then remove that starting window. It is possible that the activity
     * in this state will never resumed in which case that starting window will be orphaned. */
    void cancelInitializingActivities() {
        final ActivityRecord topActivity = topRunningActivityLocked(null);
        final ActivityRecord topActivity = topRunningActivityLocked();
        boolean aboveTop = true;
        for (int taskNdx = mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
            final ArrayList<ActivityRecord> activities = mTaskHistory.get(taskNdx).mActivities;
@@ -1719,7 +1719,7 @@ final class ActivityStack {
        cancelInitializingActivities();

        // Find the first activity that is not finishing.
        final ActivityRecord next = topRunningActivityLocked(null);
        final ActivityRecord next = topRunningActivityLocked();

        // Remember how we'll process this pause/resume situation, and ensure
        // that the state is reset however we wind up proceeding.
@@ -2037,7 +2037,7 @@ final class ActivityStack {
                // We should be all done, but let's just make sure our activity
                // is still at the top and schedule another run if something
                // weird happened.
                ActivityRecord nextNext = topRunningActivityLocked(null);
                ActivityRecord nextNext = topRunningActivityLocked();
                if (DEBUG_SWITCH || DEBUG_STATES) Slog.i(TAG_STATES,
                        "Activity config changed during resume: " + next
                        + ", new next: " + nextNext);
@@ -2170,12 +2170,12 @@ final class ActivityStack {
        // Calculate maximum possible position for this task.
        int maxPosition = mTaskHistory.size();
        if (!mStackSupervisor.isCurrentProfileLocked(task.userId)
                && task.topRunningActivityLocked(null) == null) {
                && task.topRunningActivityLocked() == null) {
            // Put non-current user tasks below current user tasks.
            while (maxPosition > 0) {
                final TaskRecord tmpTask = mTaskHistory.get(maxPosition - 1);
                if (!mStackSupervisor.isCurrentProfileLocked(tmpTask.userId)
                        || tmpTask.topRunningActivityLocked(null) == null) {
                        || tmpTask.topRunningActivityLocked() == null) {
                    break;
                }
                maxPosition--;
@@ -2217,13 +2217,13 @@ final class ActivityStack {
        int taskNdx = mTaskHistory.size();
        final boolean notShownWhenLocked =
                (newActivity != null && (newActivity.info.flags & FLAG_SHOW_FOR_ALL_USERS) == 0)
                || (newActivity == null && task.topRunningActivityLocked(null) == null);
                || (newActivity == null && task.topRunningActivityLocked() == null);
        if (!mStackSupervisor.isCurrentProfileLocked(task.userId) && notShownWhenLocked) {
            // Put non-current user tasks below current user tasks.
            while (--taskNdx >= 0) {
                final TaskRecord tmpTask = mTaskHistory.get(taskNdx);
                if (!mStackSupervisor.isCurrentProfileLocked(tmpTask.userId)
                        || tmpTask.topRunningActivityLocked(null) == null) {
                        || tmpTask.topRunningActivityLocked() == null) {
                    break;
                }
            }
@@ -2769,7 +2769,7 @@ final class ActivityStack {

    private void adjustFocusedActivityLocked(ActivityRecord r, String reason) {
        if (mStackSupervisor.isFrontStack(this) && mService.mFocusedActivity == r) {
            ActivityRecord next = topRunningActivityLocked(null);
            ActivityRecord next = topRunningActivityLocked();
            final String myReason = reason + " adjustFocus";
            if (next != r) {
                if (next != null && (mStackId == FREEFORM_WORKSPACE_STACK_ID
@@ -2812,7 +2812,7 @@ final class ActivityStack {
        if (stack == null) {
            return false;
        }
        final ActivityRecord top = stack.topRunningActivityLocked(null);
        final ActivityRecord top = stack.topRunningActivityLocked();
        if (top == null) {
            return false;
        }
@@ -2913,7 +2913,7 @@ final class ActivityStack {
    }

    final void finishTopRunningActivityLocked(ProcessRecord app, String reason) {
        ActivityRecord r = topRunningActivityLocked(null);
        ActivityRecord r = topRunningActivityLocked();
        if (r != null && r.app == app) {
            // If the top running activity is from this crashing
            // process, then terminate it to avoid getting in a loop.
@@ -3618,7 +3618,7 @@ final class ActivityStack {
    void releaseBackgroundResources(ActivityRecord r) {
        if (hasVisibleBehindActivity() &&
                !mHandler.hasMessages(RELEASE_BACKGROUND_RESOURCES_TIMEOUT_MSG)) {
            if (r == topRunningActivityLocked(null)) {
            if (r == topRunningActivityLocked()) {
                // Don't release the top activity if it has requested to run behind the next
                // activity.
                return;
@@ -3767,7 +3767,7 @@ final class ActivityStack {

    final void updateTransitLocked(int transit, Bundle options) {
        if (options != null) {
            ActivityRecord r = topRunningActivityLocked(null);
            ActivityRecord r = topRunningActivityLocked();
            if (r != null && r.state != ActivityState.RESUMED) {
                r.updateOptionsLocked(options);
            } else {
@@ -3840,7 +3840,7 @@ final class ActivityStack {
        }

        // Set focus to the top running activity of this stack.
        ActivityRecord r = topRunningActivityLocked(null);
        ActivityRecord r = topRunningActivityLocked();
        mService.setFocusedActivityLocked(r, reason);

        if (DEBUG_TRANSITION) Slog.v(TAG_TRANSITION, "Prepare to front transition: task=" + tr);
@@ -4473,7 +4473,7 @@ final class ActivityStack {
    }

    ActivityRecord restartPackage(String packageName) {
        ActivityRecord starting = topRunningActivityLocked(null);
        ActivityRecord starting = topRunningActivityLocked();

        // All activities that came from the package must be
        // restarted as if there was a config change.
+8 −9
Original line number Diff line number Diff line
@@ -66,7 +66,6 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Configuration;
import android.graphics.Point;
import android.graphics.Rect;
import android.hardware.display.DisplayManager;
import android.hardware.display.DisplayManager.DisplayListener;
@@ -628,7 +627,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
        if (resumedActivity == null || resumedActivity.app == null) {
            resumedActivity = stack.mPausingActivity;
            if (resumedActivity == null || resumedActivity.app == null) {
                resumedActivity = stack.topRunningActivityLocked(null);
                resumedActivity = stack.topRunningActivityLocked();
            }
        }
        return resumedActivity;
@@ -644,7 +643,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
                if (!isFrontStack(stack)) {
                    continue;
                }
                ActivityRecord hr = stack.topRunningActivityLocked(null);
                ActivityRecord hr = stack.topRunningActivityLocked();
                if (hr != null) {
                    if (hr.app == null && app.uid == hr.info.applicationInfo.uid
                            && processName.equals(hr.processName)) {
@@ -828,7 +827,7 @@ public final class ActivityStackSupervisor implements DisplayListener {

    ActivityRecord topRunningActivityLocked() {
        final ActivityStack focusedStack = mFocusedStack;
        ActivityRecord r = focusedStack.topRunningActivityLocked(null);
        ActivityRecord r = focusedStack.topRunningActivityLocked();
        if (r != null) {
            return r;
        }
@@ -838,7 +837,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
        for (int stackNdx = stacks.size() - 1; stackNdx >= 0; --stackNdx) {
            final ActivityStack stack = stacks.get(stackNdx);
            if (stack != focusedStack && isFrontStack(stack)) {
                r = stack.topRunningActivityLocked(null);
                r = stack.topRunningActivityLocked();
                if (r != null) {
                    return r;
                }
@@ -1101,7 +1100,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
                        }
                    } while (!outResult.timeout && outResult.who == null);
                } else if (res == ActivityManager.START_TASK_TO_FRONT) {
                    ActivityRecord r = stack.topRunningActivityLocked(null);
                    ActivityRecord r = stack.topRunningActivityLocked();
                    if (r.nowVisible && r.state == RESUMED) {
                        outResult.timeout = false;
                        outResult.who = new ComponentName(r.info.packageName, r.info.name);
@@ -2988,7 +2987,7 @@ public final class ActivityStackSupervisor implements DisplayListener {

        Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "am.resizeStack_" + stackId);

        ActivityRecord r = stack.topRunningActivityLocked(null);
        ActivityRecord r = stack.topRunningActivityLocked();

        mTmpBounds.clear();
        mTmpConfigs.clear();
@@ -3113,7 +3112,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
        // to be relaunched due to configuration change.
        boolean kept = true;
        if (overrideConfig != null) {
            ActivityRecord r = task.topRunningActivityLocked(null);
            ActivityRecord r = task.topRunningActivityLocked();
            if (r != null) {
                final ActivityStack stack = task.stack;
                kept = stack.ensureActivityConfigurationLocked(r, 0, preserveWindow);
@@ -3744,7 +3743,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
            final ArrayList<ActivityStack> stacks = mActivityDisplays.valueAt(displayNdx).mStacks;
            for (int stackNdx = stacks.size() - 1; stackNdx >= 0; --stackNdx) {
                final ActivityStack stack = stacks.get(stackNdx);
                final ActivityRecord r = stack.topRunningActivityLocked(null);
                final ActivityRecord r = stack.topRunningActivityLocked();
                final ActivityState state = r == null ? DESTROYED : r.state;
                if (isFrontStack(stack)) {
                    if (r == null) Slog.e(TAG,
+4 −4
Original line number Diff line number Diff line
@@ -196,7 +196,7 @@ public final class CompatModePackages {
    }

    public boolean getFrontActivityAskCompatModeLocked() {
        ActivityRecord r = mService.getFocusedStack().topRunningActivityLocked(null);
        ActivityRecord r = mService.getFocusedStack().topRunningActivityLocked();
        if (r == null) {
            return false;
        }
@@ -208,7 +208,7 @@ public final class CompatModePackages {
    }

    public void setFrontActivityAskCompatModeLocked(boolean ask) {
        ActivityRecord r = mService.getFocusedStack().topRunningActivityLocked(null);
        ActivityRecord r = mService.getFocusedStack().topRunningActivityLocked();
        if (r != null) {
            setPackageAskCompatModeLocked(r.packageName, ask);
        }
@@ -230,7 +230,7 @@ public final class CompatModePackages {
    }

    public int getFrontActivityScreenCompatModeLocked() {
        ActivityRecord r = mService.getFocusedStack().topRunningActivityLocked(null);
        ActivityRecord r = mService.getFocusedStack().topRunningActivityLocked();
        if (r == null) {
            return ActivityManager.COMPAT_MODE_UNKNOWN;
        }
@@ -238,7 +238,7 @@ public final class CompatModePackages {
    }

    public void setFrontActivityScreenCompatModeLocked(int mode) {
        ActivityRecord r = mService.getFocusedStack().topRunningActivityLocked(null);
        ActivityRecord r = mService.getFocusedStack().topRunningActivityLocked();
        if (r == null) {
            Slog.w(TAG, "setFrontActivityScreenCompatMode failed: no top activity");
            return;
Loading