summaryrefslogtreecommitdiff
path: root/libs/gui/LayerState.cpp
diff options
context:
space:
mode:
author Vishnu Nair <vishnun@google.com> 2020-07-23 13:52:21 -0700
committer Vishnu Nair <vishnun@google.com> 2020-07-23 21:30:09 +0000
commite798b47821d07191a20bdb7a3a1fc3887b661635 (patch)
tree4ae9448cd2c57d9c2e3f2d68d007a705a028016d /libs/gui/LayerState.cpp
parent61847ccb9126459281218b285c106f8926a2f1d6 (diff)
Add setFocusedWindow function stub
This function, once implemented, will set focus on the specified window. This is the first step in changing focus selection from setInputWindows and using explicit call which will help us more easily decouple z-order from focus selection and support focus for SurfaceViewHost surfaces. Bug: 151179149 Test: presubmit Test: go/wm-smoke Test: atest inputflinger_tests Change-Id: Ib2254b4ab3ba8d579dfe49ddf3286f8ce2eecf9e
Diffstat (limited to 'libs/gui/LayerState.cpp')
-rw-r--r--libs/gui/LayerState.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
index 1030b82f14..117ce58719 100644
--- a/libs/gui/LayerState.cpp
+++ b/libs/gui/LayerState.cpp
@@ -448,19 +448,36 @@ void layer_state_t::merge(const layer_state_t& other) {
// ------------------------------- InputWindowCommands ----------------------------------------
-void InputWindowCommands::merge(const InputWindowCommands& other) {
+bool InputWindowCommands::merge(const InputWindowCommands& other) {
+ bool changes = false;
+#ifndef NO_INPUT
+ changes |= !other.focusRequests.empty();
+ focusRequests.insert(focusRequests.end(), std::make_move_iterator(other.focusRequests.begin()),
+ std::make_move_iterator(other.focusRequests.end()));
+#endif
+ changes |= other.syncInputWindows && !syncInputWindows;
syncInputWindows |= other.syncInputWindows;
+ return changes;
}
void InputWindowCommands::clear() {
+#ifndef NO_INPUT
+ focusRequests.clear();
+#endif
syncInputWindows = false;
}
void InputWindowCommands::write(Parcel& output) const {
+#ifndef NO_INPUT
+ output.writeParcelableVector(focusRequests);
+#endif
output.writeBool(syncInputWindows);
}
void InputWindowCommands::read(const Parcel& input) {
+#ifndef NO_INPUT
+ input.readParcelableVector(&focusRequests);
+#endif
syncInputWindows = input.readBool();
}