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

Commit b1635458 authored by Vishnu Nair's avatar Vishnu Nair Committed by Android (Google) Code Review
Browse files

Merge "WM: Clean up InputTarget interface"

parents 76a2e80b 117bc2de
Loading
Loading
Loading
Loading
+5 −9
Original line number Diff line number Diff line
@@ -87,16 +87,12 @@ class AnrController {
                return;
            }

            WindowState windowState = target.asWindowState();
            WindowState windowState = target.getWindowState();
            pid = target.getPid();
            if (windowState != null) {
                activity = windowState.mActivityRecord;
            } else {
                // Don't blame the host process, instead blame the embedded pid.
                activity = null;
                // Use host WindowState for logging and z-order test.
                windowState = target.asEmbeddedWindow().mHostWindowState;
            }
            // Blame the activity if the input token belongs to the window. If the target is
            // embedded, then we will blame the pid instead.
            activity = (windowState.mInputChannelToken == inputToken)
                    ? windowState.mActivityRecord : null;
            Slog.i(TAG_WM, "ANR in " + target + ". Reason:" + reason);
            aboveSystem = isWindowAboveSystem(windowState);
            dumpAnrStateLocked(activity, windowState, reason);
+2 −2
Original line number Diff line number Diff line
@@ -198,8 +198,8 @@ class EmbeddedWindowController {
        }

        @Override
        public EmbeddedWindow asEmbeddedWindow() {
            return this;
        public WindowState getWindowState() {
            return mHostWindowState;
        }

        @Override
+2 −7
Original line number Diff line number Diff line
@@ -25,13 +25,8 @@ import android.view.IWindow;
 * of both targets.
 */
interface InputTarget {
    default WindowState asWindowState() {
        return null;
    }

    default EmbeddedWindowController.EmbeddedWindow asEmbeddedWindow() {
        return null;
    }
    /* Get the WindowState associated with the target. */
    WindowState getWindowState();

    /* Display id of the target. */
    int getDisplayId();
+8 −7
Original line number Diff line number Diff line
@@ -5018,16 +5018,17 @@ public class WindowManagerService extends IWindowManager.Stub
            ProtoLog.i(WM_DEBUG_FOCUS_LIGHT, "Focus changing: %s -> %s", lastTarget, newTarget);
        }

        if (newTarget != null && newTarget.asWindowState() != null) {
            WindowState newFocus = newTarget.asWindowState();
            mAnrController.onFocusChanged(newFocus);
            newFocus.reportFocusChangedSerialized(true);
        // Call WindowState focus change observers
        WindowState newFocusedWindow = newTarget != null ? newTarget.getWindowState() : null;
        if (newFocusedWindow != null && newFocusedWindow.mInputChannelToken == newToken) {
            mAnrController.onFocusChanged(newFocusedWindow);
            newFocusedWindow.reportFocusChangedSerialized(true);
            notifyFocusChanged();
        }

        if (lastTarget != null && lastTarget.asWindowState() != null) {
            WindowState lastFocus = lastTarget.asWindowState();
            lastFocus.reportFocusChangedSerialized(false);
        WindowState lastFocusedWindow = lastTarget != null ? lastTarget.getWindowState() : null;
        if (lastFocusedWindow != null && lastFocusedWindow.mInputChannelToken == oldToken) {
            lastFocusedWindow.reportFocusChangedSerialized(false);
        }
    }

+1 −1
Original line number Diff line number Diff line
@@ -1727,7 +1727,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
    }

    @Override
    public WindowState asWindowState() {
    public WindowState getWindowState() {
        return this;
    }