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

Commit cdec0808 authored by Louis Chang's avatar Louis Chang
Browse files

Merge Task and TaskRecord into one class (65/n)

Merge Task and TaskRecord into a single Task class. Also Consolidate
updateTaskMovement() call points to TaskStack.onChildPositionChanged().

Bug: 80414790
Test: Existing tests pass
Change-Id: Iec0101b211bf34fab42131aae6cddfe1262e2add
parent 6b992497
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -219,7 +219,7 @@ public abstract class ActivityManagerInternal {
     * @param userId
     * @param event
     * @param appToken ActivityRecord's appToken.
     * @param taskRoot TaskRecord's root
     * @param taskRoot Task's root
     */
    public abstract void updateActivityUsageStats(
            ComponentName activity, @UserIdInt int userId, int event, IBinder appToken,
+6 −6
Original line number Diff line number Diff line
@@ -1345,12 +1345,6 @@
      "group": "WM_SHOW_TRANSACTIONS",
      "at": "com\/android\/server\/wm\/Session.java"
    },
    "609651209": {
      "message": "addChild: %s at top.",
      "level": "VERBOSE",
      "group": "WM_DEBUG_ADD_REMOVE",
      "at": "com\/android\/server\/wm\/TaskRecord.java"
    },
    "620368427": {
      "message": "******* TELLING SURFACE FLINGER WE ARE BOOTED!",
      "level": "INFO",
@@ -1669,6 +1663,12 @@
      "group": "WM_DEBUG_ORIENTATION",
      "at": "com\/android\/server\/wm\/WindowState.java"
    },
    "1330804250": {
      "message": "addChild: %s at top.",
      "level": "VERBOSE",
      "group": "WM_DEBUG_ADD_REMOVE",
      "at": "com\/android\/server\/wm\/Task.java"
    },
    "1331177619": {
      "message": "Attempted to add a toast window with unknown token %s.  Aborting.",
      "level": "WARN",
+1 −1
Original line number Diff line number Diff line
@@ -3054,7 +3054,7 @@ public class ActivityManagerService extends IActivityManager.Stub
     * @param userId
     * @param event
     * @param appToken ActivityRecord's appToken.
     * @param taskRoot TaskRecord's root
     * @param taskRoot Task's root
     */
    public void updateActivityUsageStats(ComponentName activity, int userId, int event,
            IBinder appToken, ComponentName taskRoot) {
+8 −8
Original line number Diff line number Diff line
@@ -403,7 +403,7 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack> {
     * @see #getOrCreateStack(int, int, boolean)
     */
    <T extends ActivityStack> T getOrCreateStack(@Nullable ActivityRecord r,
            @Nullable ActivityOptions options, @Nullable TaskRecord candidateTask, int activityType,
            @Nullable ActivityOptions options, @Nullable Task candidateTask, int activityType,
            boolean onTop) {
        // First preference is the windowing mode in the activity options if set.
        int windowingMode = (options != null)
@@ -850,7 +850,7 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack> {
     * @return The resolved (not UNDEFINED) windowing-mode that the activity would be in.
     */
    int resolveWindowingMode(@Nullable ActivityRecord r, @Nullable ActivityOptions options,
            @Nullable TaskRecord task, int activityType) {
            @Nullable Task task, int activityType) {

        // First preference if the windowing mode in the activity options if set.
        int windowingMode = (options != null)
@@ -881,12 +881,12 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack> {
     *
     * @param windowingMode The windowing-mode to validate.
     * @param r The {@link ActivityRecord} to check against.
     * @param task The {@link TaskRecord} to check against.
     * @param task The {@link Task} to check against.
     * @param activityType An activity type.
     * @return The provided windowingMode or the closest valid mode which is appropriate.
     */
    int validateWindowingMode(int windowingMode, @Nullable ActivityRecord r,
        @Nullable TaskRecord task, int activityType) {
    int validateWindowingMode(int windowingMode, @Nullable ActivityRecord r, @Nullable Task task,
            int activityType) {
        // Make sure the windowing mode we are trying to use makes sense for what is supported.
        boolean supportsMultiWindow = mService.mSupportsMultiWindow;
        boolean supportsSplitScreen = mService.mSupportsSplitScreenMultiWindow;
@@ -1447,9 +1447,9 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack> {
            return null;
        }

        final ArrayList<TaskRecord> tasks = mHomeStack.getAllTasks();
        final ArrayList<Task> tasks = mHomeStack.getAllTasks();
        for (int taskNdx = tasks.size() - 1; taskNdx >= 0; --taskNdx) {
            final TaskRecord task = tasks.get(taskNdx);
            final Task task = tasks.get(taskNdx);
            if (!task.isActivityTypeHome()) {
                continue;
            }
@@ -1545,7 +1545,7 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack> {
    void removeAllTasks() {
        for (int i = getChildCount() - 1; i >= 0; --i) {
            final ActivityStack stack = getChildAt(i);
            final ArrayList<TaskRecord> tasks = stack.getAllTasks();
            final ArrayList<Task> tasks = stack.getAllTasks();
            for (int j = tasks.size() - 1; j >= 0; --j) {
                stack.removeChild(tasks.get(j), "removeAllTasks");
            }
+6 −5
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ import com.android.internal.logging.MetricsLogger;
import com.android.internal.os.BackgroundThread;
import com.android.internal.os.SomeArgs;
import com.android.server.LocalServices;

import java.util.concurrent.TimeUnit;

/**
@@ -171,7 +172,7 @@ class ActivityMetricsLogger {
            switch (msg.what) {
                case MSG_CHECK_VISIBILITY:
                    final SomeArgs args = (SomeArgs) msg.obj;
                    checkVisibility((TaskRecord) args.arg1, (ActivityRecord) args.arg2);
                    checkVisibility((Task) args.arg1, (ActivityRecord) args.arg2);
                    break;
            }
        }
@@ -536,7 +537,7 @@ class ActivityMetricsLogger {
        if (info.launchedActivity != activityRecord) {
            return;
        }
        final TaskRecord t = activityRecord.getTaskRecord();
        final Task t = activityRecord.getTask();
        final SomeArgs args = SomeArgs.obtain();
        args.arg1 = t;
        args.arg2 = activityRecord;
@@ -544,7 +545,7 @@ class ActivityMetricsLogger {
    }

    /** @return {@code true} if the given task has an activity will be drawn. */
    private static boolean hasActivityToBeDrawn(TaskRecord t) {
    private static boolean hasActivityToBeDrawn(Task t) {
        for (int i = t.getChildCount() - 1; i >= 0; --i) {
            final ActivityRecord r = t.getChildAt(i);
            if (r.visible && !r.mDrawn && !r.finishing) {
@@ -554,7 +555,7 @@ class ActivityMetricsLogger {
        return false;
    }

    private void checkVisibility(TaskRecord t, ActivityRecord r) {
    private void checkVisibility(Task t, ActivityRecord r) {
        synchronized (mSupervisor.mService.mGlobalLock) {

            final WindowingModeTransitionInfo info = mWindowingModeTransitionInfo.get(
@@ -984,7 +985,7 @@ class ActivityMetricsLogger {
            }
        } else if (info.startResult == START_SUCCESS
                || (info.startResult == START_TASK_TO_FRONT)) {
            // TaskRecord may still exist when cold launching an activity and the start
            // Task may still exist when cold launching an activity and the start
            // result will be set to START_TASK_TO_FRONT. Treat this as a COLD launch.
            return TYPE_TRANSITION_COLD_LAUNCH;
        }
Loading