WM: Clean up InputTarget interface
Cherry-pick of changes in I21a6f1a7353844d2b0f59f32e802ed1f0a3d66ff that didnt land in master. Bug: b/188792659 Test: presubmit Test: test talkback Change-Id: Ia799e6104ceba66f4b7fabb3e151536d9d168169
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -198,8 +198,8 @@ class EmbeddedWindowController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EmbeddedWindow asEmbeddedWindow() {
|
||||
return this;
|
||||
public WindowState getWindowState() {
|
||||
return mHostWindowState;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -5014,16 +5014,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1727,7 +1727,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
}
|
||||
|
||||
@Override
|
||||
public WindowState asWindowState() {
|
||||
public WindowState getWindowState() {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user