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

Commit 6fdd1f37 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add logs to track focus changes"

parents 01d20137 134d218f
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_FOCUS_LIGHT;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_INPUT;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import static com.android.server.wm.WindowManagerService.LOGTAG_INPUT_FOCUS;

import android.graphics.Rect;
import android.os.Handler;
@@ -54,6 +55,7 @@ import android.os.Process;
import android.os.Trace;
import android.os.UserHandle;
import android.util.ArrayMap;
import android.util.EventLog;
import android.util.Slog;
import android.view.InputApplicationHandle;
import android.view.InputChannel;
@@ -503,13 +505,14 @@ final class InputMonitor {
            }

            if (!focus.mWinAnimator.hasSurface()) {
                ProtoLog.d(WM_DEBUG_FOCUS_LIGHT,
                        "Focus not requested for window=%s because it has no surface",
                        focus);
                Slog.v(TAG_WM, "Focus not requested for window=%" + focus
                        + " because it has no surface.");
                return;
            }

            mInputTransaction.setFocusedWindow(focus.mInputWindowHandle.token, mDisplayId);
            EventLog.writeEvent(LOGTAG_INPUT_FOCUS,
                    "Focus request " + focus, "reason=UpdateInputWindows");
            mDisplayContent.mLastRequestedFocus = focus;
            ProtoLog.v(WM_DEBUG_FOCUS_LIGHT, "Focus requested for window=%s", focus);
        }
+14 −0
Original line number Diff line number Diff line
@@ -206,6 +206,7 @@ import android.text.format.DateUtils;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.DisplayMetrics;
import android.util.EventLog;
import android.util.MergedConfiguration;
import android.util.Slog;
import android.util.SparseArray;
@@ -407,6 +408,7 @@ public class WindowManagerService extends IWindowManager.Stub
     */
    private static final String DISABLE_CUSTOM_TASK_ANIMATION_PROPERTY =
            "persist.wm.disable_custom_task_animation";
    static final int LOGTAG_INPUT_FOCUS = 62001;

    /**
     * @see #DISABLE_CUSTOM_TASK_ANIMATION_PROPERTY
@@ -8347,6 +8349,9 @@ public class WindowManagerService extends IWindowManager.Stub
            final int displayId = embeddedWindow.mDisplayId;
            if (grantFocus) {
                t.setFocusedWindow(targetInputToken, displayId).apply();
                EventLog.writeEvent(LOGTAG_INPUT_FOCUS,
                        "Focus request " + embeddedWindow.getName(),
                        "reason=grantEmbeddedWindowFocus(true)");
            } else {
                // Search for a new focus target
                DisplayContent displayContent = mRoot.getDisplayContent(displayId);
@@ -8360,6 +8365,9 @@ public class WindowManagerService extends IWindowManager.Stub
                }
                t.requestFocusTransfer(newFocusTarget.mInputWindowHandle.token, targetInputToken,
                        displayId).apply();
                EventLog.writeEvent(LOGTAG_INPUT_FOCUS,
                        "Transfer focus request " + newFocusTarget,
                        "reason=grantEmbeddedWindowFocus(false)");
            }
            ProtoLog.v(WM_DEBUG_FOCUS, "grantEmbeddedWindowFocus win=%s grantFocus=%s",
                    embeddedWindow.getName(), grantFocus);
@@ -8393,9 +8401,15 @@ public class WindowManagerService extends IWindowManager.Stub
            if (grantFocus) {
                t.requestFocusTransfer(targetInputToken, hostWindow.mInputChannel.getToken(),
                        hostWindow.getDisplayId()).apply();
                EventLog.writeEvent(LOGTAG_INPUT_FOCUS,
                        "Transfer focus request " + embeddedWindow.getName(),
                        "reason=grantEmbeddedWindowFocus(true)");
            } else {
                t.requestFocusTransfer(hostWindow.mInputChannel.getToken(), targetInputToken,
                        hostWindow.getDisplayId()).apply();
                EventLog.writeEvent(LOGTAG_INPUT_FOCUS,
                        "Transfer focus request " + hostWindow,
                        "reason=grantEmbeddedWindowFocus(false)");
            }
            ProtoLog.v(WM_DEBUG_FOCUS, "grantEmbeddedWindowFocus win=%s grantFocus=%s",
                    embeddedWindow.getName(), grantFocus);