@@ -954,6 +954,7 @@ InputDispatcher::InputDispatcher(InputDispatcherPolicyInterface& policy,
954954 mDispatchEnabled(false ),
955955 mDispatchFrozen(false ),
956956 mInputFilterEnabled(false ),
957+ mMaximumObscuringOpacityForTouch(1 .0f ),
957958 mFocusedDisplayId(ui::LogicalDisplayId::DEFAULT),
958959 mWindowTokenWithPointerCapture(nullptr ),
959960 mAwaitedApplicationDisplayId(ui::LogicalDisplayId::INVALID),
@@ -3163,8 +3164,8 @@ InputDispatcher::DispatcherWindowInfo::computeTouchOcclusionInfo(
31633164 return info;
31643165}
31653166
3166- bool InputDispatcher::DispatcherWindowInfo::isTouchTrusted (
3167- const TouchOcclusionInfo& occlusionInfo) const {
3167+ bool InputDispatcher::isTouchTrustedLocked (
3168+ const DispatcherWindowInfo:: TouchOcclusionInfo& occlusionInfo) const {
31683169 if (occlusionInfo.hasBlockingOcclusion ) {
31693170 ALOGW (" Untrusted touch due to occlusion by %s/%s" , occlusionInfo.obscuringPackage .c_str (),
31703171 occlusionInfo.obscuringUid .toString ().c_str ());
@@ -5270,9 +5271,8 @@ std::string InputDispatcher::DispatcherWindowInfo::dumpDisplayAndWindowInfo() co
52705271 return dump;
52715272}
52725273
5273- bool InputDispatcher::canWindowReceiveMotionLocked (
5274- const sp<android::gui::WindowInfoHandle>& window,
5275- const android::inputdispatcher::MotionEntry& motionEntry) const {
5274+ bool InputDispatcher::canWindowReceiveMotionLocked (const sp<WindowInfoHandle>& window,
5275+ const MotionEntry& motionEntry) const {
52765276 const WindowInfo& info = *window->getInfo ();
52775277
52785278 // Skip spy window targets that are not valid for targeted injection.
@@ -5307,7 +5307,7 @@ bool InputDispatcher::canWindowReceiveMotionLocked(
53075307 const auto [x, y] = resolveTouchedPosition (motionEntry);
53085308 DispatcherWindowInfo::TouchOcclusionInfo occlusionInfo =
53095309 mWindowInfos .computeTouchOcclusionInfo (window, x, y);
5310- if (!mWindowInfos . isTouchTrusted (occlusionInfo)) {
5310+ if (!isTouchTrustedLocked (occlusionInfo)) {
53115311 if (DEBUG_TOUCH_OCCLUSION) {
53125312 ALOGD (" Stack of obscuring windows during untrusted touch (%.1f, %.1f):" , x, y);
53135313 for (const auto & log : occlusionInfo.debugInfo ) {
@@ -5751,8 +5751,13 @@ bool InputDispatcher::recentWindowsAreOwnedByLocked(gui::Pid pid, gui::Uid uid)
57515751}
57525752
57535753void InputDispatcher::setMaximumObscuringOpacityForTouch (float opacity) {
5754+ if (opacity < 0 || opacity > 1 ) {
5755+ LOG_ALWAYS_FATAL (" Maximum obscuring opacity for touch should be >= 0 and <= 1" );
5756+ return ;
5757+ }
5758+
57545759 std::scoped_lock lock (mLock );
5755- mWindowInfos . setMaximumObscuringOpacityForTouch ( opacity) ;
5760+ mMaximumObscuringOpacityForTouch = opacity;
57565761}
57575762
57585763std::tuple<const TouchState*, const TouchedWindow*, ui::LogicalDisplayId>
@@ -7357,11 +7362,4 @@ std::string InputDispatcher::ConnectionManager::dump(nsecs_t currentTime) const
73577362 return dump;
73587363}
73597364
7360- void InputDispatcher::DispatcherWindowInfo::setMaximumObscuringOpacityForTouch (float opacity) {
7361- if (opacity < 0 || opacity > 1 ) {
7362- LOG_ALWAYS_FATAL (" Maximum obscuring opacity for touch should be >= 0 and <= 1" );
7363- }
7364- mMaximumObscuringOpacityForTouch = opacity;
7365- }
7366-
73677365} // namespace android::inputdispatcher
0 commit comments