Merge "Move focus dispatch to input (2/2)"

This commit is contained in:
TreeHugger Robot
2020-01-15 04:52:14 +00:00
committed by Android (Google) Code Review
5 changed files with 52 additions and 13 deletions

View File

@@ -127,6 +127,19 @@ public abstract class InputEventReceiver {
finishInputEvent(event, false);
}
/**
* Called when a focus event is received.
*
* @param hasFocus if true, the window associated with this input channel has just received
* focus
* if false, the window associated with this input channel has just lost focus
* @param inTouchMode if true, the device is in touch mode
* if false, the device is not in touch mode
*/
// Called from native code.
public void onFocusEvent(boolean hasFocus, boolean inTouchMode) {
}
/**
* Called when a batched input event is pending.
*
@@ -213,8 +226,13 @@ public abstract class InputEventReceiver {
onBatchedInputEventPending();
}
public static interface Factory {
public InputEventReceiver createInputEventReceiver(
InputChannel inputChannel, Looper looper);
/**
* Factory for InputEventReceiver
*/
public interface Factory {
/**
* Create a new InputReceiver for a given inputChannel
*/
InputEventReceiver createInputEventReceiver(InputChannel inputChannel, Looper looper);
}
}

View File

@@ -8043,6 +8043,11 @@ public final class ViewRootImpl implements ViewParent,
}
}
@Override
public void onFocusEvent(boolean hasFocus, boolean inTouchMode) {
windowFocusChanged(hasFocus, inTouchMode);
}
@Override
public void dispose() {
unscheduleConsumeBatchedInput();