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

Commit 8e25f731 authored by Filip Gruszczynski's avatar Filip Gruszczynski
Browse files

Short-circuit AMS.setFocusedTask if the task is already focused.

Bug: 25236192
Change-Id: I369d3815c171ccef99d7dbe68dfb2b1f61be65dc
parent d1d53361
Loading
Loading
Loading
Loading
+3 −5
Original line number Original line Diff line number Diff line
@@ -2764,8 +2764,7 @@ public final class ActivityManagerService extends ActivityManagerNative
        }
        }
        if (!r.isFocusable()) {
        if (!r.isFocusable()) {
            if (DEBUG_FOCUS) Slog.d(TAG_FOCUS,
            if (DEBUG_FOCUS) Slog.d(TAG_FOCUS, "setFocusedActivityLocked: unfocusable r=" + r);
                    "setFocusedActivityLocked: unfocusable r=" + r);
            return false;
            return false;
        }
        }
@@ -2874,9 +2873,8 @@ public final class ActivityManagerService extends ActivityManagerNative
            synchronized (ActivityManagerService.this) {
            synchronized (ActivityManagerService.this) {
                TaskRecord task = mStackSupervisor.anyTaskForIdLocked(taskId);
                TaskRecord task = mStackSupervisor.anyTaskForIdLocked(taskId);
                if (task != null) {
                if (task != null) {
                    ActivityRecord r = task.topRunningActivityLocked();
                    final ActivityRecord r = task.topRunningActivityLocked();
                    if (r != null) {
                    if (setFocusedActivityLocked(r, "setFocusedTask")) {
                        setFocusedActivityLocked(r, "setFocusedTask");
                        mStackSupervisor.resumeFocusedStackTopActivityLocked();
                        mStackSupervisor.resumeFocusedStackTopActivityLocked();
                    }
                    }
                }
                }