Loading services/surfaceflinger/Layer.cpp +1 −10 Original line number Diff line number Diff line Loading @@ -2391,16 +2391,7 @@ WindowInfo Layer::fillInputInfo(const InputDisplayArgs& displayArgs) { info.inputConfig |= WindowInfo::InputConfig::NOT_TOUCHABLE; } // For compatibility reasons we let layers which can receive input // receive input before they have actually submitted a buffer. Because // of this we use canReceiveInput instead of isVisible to check the // policy-visibility, ignoring the buffer state. However for layers with // hasInputInfo()==false we can use the real visibility state. // We are just using these layers for occlusion detection in // InputDispatcher, and obviously if they aren't visible they can't occlude // anything. const bool visible = hasInputInfo() ? canReceiveInput() : isVisible(); info.setInputConfig(WindowInfo::InputConfig::NOT_VISIBLE, !visible); info.setInputConfig(WindowInfo::InputConfig::NOT_VISIBLE, !isVisibleForInput()); info.alpha = getAlpha(); fillTouchOcclusionMode(info); Loading services/surfaceflinger/Layer.h +15 −0 Original line number Diff line number Diff line Loading @@ -470,6 +470,21 @@ public: */ virtual bool canReceiveInput() const; /* * Whether or not the layer should be considered visible for input calculations. */ virtual bool isVisibleForInput() const { // For compatibility reasons we let layers which can receive input // receive input before they have actually submitted a buffer. Because // of this we use canReceiveInput instead of isVisible to check the // policy-visibility, ignoring the buffer state. However for layers with // hasInputInfo()==false we can use the real visibility state. // We are just using these layers for occlusion detection in // InputDispatcher, and obviously if they aren't visible they can't occlude // anything. return hasInputInfo() ? canReceiveInput() : isVisible(); } /* * isProtected - true if the layer may contain protected contents in the * GRALLOC_USAGE_PROTECTED sense. Loading services/surfaceflinger/SurfaceFlinger.cpp +17 −2 Original line number Diff line number Diff line Loading @@ -3249,18 +3249,33 @@ void SurfaceFlinger::updateInputFlinger() { if (!updateWindowInfo && mInputWindowCommands.empty()) { return; } std::unordered_set<Layer*> visibleLayers; mDrawingState.traverse([&visibleLayers](Layer* layer) { if (layer->isVisibleForInput()) { visibleLayers.insert(layer); } }); bool visibleLayersChanged = false; if (visibleLayers != mVisibleLayers) { visibleLayersChanged = true; mVisibleLayers = std::move(visibleLayers); } BackgroundExecutor::getInstance().sendCallbacks({[updateWindowInfo, windowInfos = std::move(windowInfos), displayInfos = std::move(displayInfos), inputWindowCommands = std::move(mInputWindowCommands), inputFlinger = mInputFlinger, this]() { inputFlinger = mInputFlinger, this, visibleLayersChanged]() { ATRACE_NAME("BackgroundExecutor::updateInputFlinger"); if (updateWindowInfo) { mWindowInfosListenerInvoker ->windowInfosChanged(std::move(windowInfos), std::move(displayInfos), /* shouldSync= */ inputWindowCommands.syncInputWindows, /* forceImmediateCall= */ visibleLayersChanged || !inputWindowCommands.focusRequests.empty()); } else if (inputWindowCommands.syncInputWindows) { // If the caller requested to sync input windows, but there are no Loading services/surfaceflinger/SurfaceFlinger.h +5 −0 Original line number Diff line number Diff line Loading @@ -1449,6 +1449,11 @@ private: nsecs_t mAnimationTransactionTimeout = s2ns(5); friend class SurfaceComposerAIDL; // Layers visible during the last commit. This set should only be used for testing set equality // and membership. The pointers should not be dereferenced as it's possible the set contains // pointers to freed layers. std::unordered_set<Layer*> mVisibleLayers; }; class SurfaceComposerAIDL : public gui::BnSurfaceComposer { Loading Loading
services/surfaceflinger/Layer.cpp +1 −10 Original line number Diff line number Diff line Loading @@ -2391,16 +2391,7 @@ WindowInfo Layer::fillInputInfo(const InputDisplayArgs& displayArgs) { info.inputConfig |= WindowInfo::InputConfig::NOT_TOUCHABLE; } // For compatibility reasons we let layers which can receive input // receive input before they have actually submitted a buffer. Because // of this we use canReceiveInput instead of isVisible to check the // policy-visibility, ignoring the buffer state. However for layers with // hasInputInfo()==false we can use the real visibility state. // We are just using these layers for occlusion detection in // InputDispatcher, and obviously if they aren't visible they can't occlude // anything. const bool visible = hasInputInfo() ? canReceiveInput() : isVisible(); info.setInputConfig(WindowInfo::InputConfig::NOT_VISIBLE, !visible); info.setInputConfig(WindowInfo::InputConfig::NOT_VISIBLE, !isVisibleForInput()); info.alpha = getAlpha(); fillTouchOcclusionMode(info); Loading
services/surfaceflinger/Layer.h +15 −0 Original line number Diff line number Diff line Loading @@ -470,6 +470,21 @@ public: */ virtual bool canReceiveInput() const; /* * Whether or not the layer should be considered visible for input calculations. */ virtual bool isVisibleForInput() const { // For compatibility reasons we let layers which can receive input // receive input before they have actually submitted a buffer. Because // of this we use canReceiveInput instead of isVisible to check the // policy-visibility, ignoring the buffer state. However for layers with // hasInputInfo()==false we can use the real visibility state. // We are just using these layers for occlusion detection in // InputDispatcher, and obviously if they aren't visible they can't occlude // anything. return hasInputInfo() ? canReceiveInput() : isVisible(); } /* * isProtected - true if the layer may contain protected contents in the * GRALLOC_USAGE_PROTECTED sense. Loading
services/surfaceflinger/SurfaceFlinger.cpp +17 −2 Original line number Diff line number Diff line Loading @@ -3249,18 +3249,33 @@ void SurfaceFlinger::updateInputFlinger() { if (!updateWindowInfo && mInputWindowCommands.empty()) { return; } std::unordered_set<Layer*> visibleLayers; mDrawingState.traverse([&visibleLayers](Layer* layer) { if (layer->isVisibleForInput()) { visibleLayers.insert(layer); } }); bool visibleLayersChanged = false; if (visibleLayers != mVisibleLayers) { visibleLayersChanged = true; mVisibleLayers = std::move(visibleLayers); } BackgroundExecutor::getInstance().sendCallbacks({[updateWindowInfo, windowInfos = std::move(windowInfos), displayInfos = std::move(displayInfos), inputWindowCommands = std::move(mInputWindowCommands), inputFlinger = mInputFlinger, this]() { inputFlinger = mInputFlinger, this, visibleLayersChanged]() { ATRACE_NAME("BackgroundExecutor::updateInputFlinger"); if (updateWindowInfo) { mWindowInfosListenerInvoker ->windowInfosChanged(std::move(windowInfos), std::move(displayInfos), /* shouldSync= */ inputWindowCommands.syncInputWindows, /* forceImmediateCall= */ visibleLayersChanged || !inputWindowCommands.focusRequests.empty()); } else if (inputWindowCommands.syncInputWindows) { // If the caller requested to sync input windows, but there are no Loading
services/surfaceflinger/SurfaceFlinger.h +5 −0 Original line number Diff line number Diff line Loading @@ -1449,6 +1449,11 @@ private: nsecs_t mAnimationTransactionTimeout = s2ns(5); friend class SurfaceComposerAIDL; // Layers visible during the last commit. This set should only be used for testing set equality // and membership. The pointers should not be dereferenced as it's possible the set contains // pointers to freed layers. std::unordered_set<Layer*> mVisibleLayers; }; class SurfaceComposerAIDL : public gui::BnSurfaceComposer { Loading