@@ -261,20 +261,25 @@ void updateVisibility(LayerSnapshot& snapshot, bool visible) {
261261 }
262262 snapshot.isVisible = visible;
263263
264- // TODO(b/238781169) we are ignoring this compat for now, since we will have
265- // to remove any optimization based on visibility.
266-
267- // For compatibility reasons we let layers which can receive input
268- // receive input before they have actually submitted a buffer. Because
269- // of this we use canReceiveInput instead of isVisible to check the
270- // policy-visibility, ignoring the buffer state. However for layers with
271- // hasInputInfo()==false we can use the real visibility state.
272- // We are just using these layers for occlusion detection in
273- // InputDispatcher, and obviously if they aren't visible they can't occlude
274- // anything.
275- const bool visibleForInput =
276- snapshot.hasInputInfo () ? snapshot.canReceiveInput () : snapshot.isVisible ;
277- snapshot.inputInfo .setInputConfig (gui::WindowInfo::InputConfig::NOT_VISIBLE, !visibleForInput);
264+ if (FlagManager::getInstance ().skip_invisible_windows_in_input ()) {
265+ snapshot.inputInfo .setInputConfig (gui::WindowInfo::InputConfig::NOT_VISIBLE, !visible);
266+ } else {
267+ // TODO(b/238781169) we are ignoring this compat for now, since we will have
268+ // to remove any optimization based on visibility.
269+
270+ // For compatibility reasons we let layers which can receive input
271+ // receive input before they have actually submitted a buffer. Because
272+ // of this we use canReceiveInput instead of isVisible to check the
273+ // policy-visibility, ignoring the buffer state. However for layers with
274+ // hasInputInfo()==false we can use the real visibility state.
275+ // We are just using these layers for occlusion detection in
276+ // InputDispatcher, and obviously if they aren't visible they can't occlude
277+ // anything.
278+ const bool visibleForInput =
279+ snapshot.hasInputInfo () ? snapshot.canReceiveInput () : snapshot.isVisible ;
280+ snapshot.inputInfo .setInputConfig (gui::WindowInfo::InputConfig::NOT_VISIBLE,
281+ !visibleForInput);
282+ }
278283 LLOGV (snapshot.sequence , " updating visibility %s %s" , visible ? " true" : " false" ,
279284 snapshot.getDebugString ().c_str ());
280285}
@@ -1260,6 +1265,10 @@ void LayerSnapshotBuilder::forEachInputSnapshot(const ConstVisitor& visitor) con
12601265 for (int i = mNumInterestingSnapshots - 1 ; i >= 0 ; i--) {
12611266 LayerSnapshot& snapshot = *mSnapshots [(size_t )i];
12621267 if (!snapshot.hasInputInfo ()) continue ;
1268+ if (FlagManager::getInstance ().skip_invisible_windows_in_input () &&
1269+ snapshot.inputInfo .inputConfig .test (gui::WindowInfo::InputConfig::NOT_VISIBLE)) {
1270+ continue ;
1271+ }
12631272 visitor (snapshot);
12641273 }
12651274}
0 commit comments