diff options
3 files changed, 42 insertions, 9 deletions
diff --git a/services/accessibility/accessibility.aconfig b/services/accessibility/accessibility.aconfig index 93531508b3eb..b4efae3a05e4 100644 --- a/services/accessibility/accessibility.aconfig +++ b/services/accessibility/accessibility.aconfig @@ -11,6 +11,16 @@ flag { } flag { + name: "always_allow_observing_touch_events" + namespace: "accessibility" + description: "Always allows InputFilter observing SOURCE_TOUCHSCREEN events, even if touch exploration is enabled." + bug: "344604959" + metadata { + purpose: PURPOSE_BUGFIX + } +} + +flag { name: "resettable_dynamic_properties" namespace: "accessibility" description: "Maintains initial copies of a11yServiceInfo dynamic properties so they can reset on disconnect." diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java index 5fb60e75cf85..f9196f3e0e0e 100644 --- a/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java +++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java @@ -1087,7 +1087,15 @@ class AccessibilityInputFilter extends InputFilter implements EventStreamTransfo } } - private boolean anyServiceWantsToObserveMotionEvent(MotionEvent event) { + private boolean anyServiceWantsGenericMotionEvent(MotionEvent event) { + if (Flags.alwaysAllowObservingTouchEvents()) { + final boolean isTouchEvent = event.isFromSource(InputDevice.SOURCE_TOUCHSCREEN); + if (isTouchEvent && !canShareGenericTouchEvent()) { + return false; + } + final int eventSourceWithoutClass = event.getSource() & ~InputDevice.SOURCE_CLASS_MASK; + return (mCombinedGenericMotionEventSources & eventSourceWithoutClass) != 0; + } // Disable SOURCE_TOUCHSCREEN generic event interception if any service is performing // touch exploration. if (event.isFromSource(InputDevice.SOURCE_TOUCHSCREEN) @@ -1095,13 +1103,14 @@ class AccessibilityInputFilter extends InputFilter implements EventStreamTransfo return false; } final int eventSourceWithoutClass = event.getSource() & ~InputDevice.SOURCE_CLASS_MASK; - return (mCombinedGenericMotionEventSources - & mCombinedMotionEventObservedSources - & eventSourceWithoutClass) - != 0; + return (mCombinedGenericMotionEventSources & eventSourceWithoutClass) != 0; } - private boolean anyServiceWantsGenericMotionEvent(MotionEvent event) { + private boolean anyServiceWantsToObserveMotionEvent(MotionEvent event) { + if (Flags.alwaysAllowObservingTouchEvents()) { + final int eventSourceWithoutClass = event.getSource() & ~InputDevice.SOURCE_CLASS_MASK; + return (mCombinedMotionEventObservedSources & eventSourceWithoutClass) != 0; + } // Disable SOURCE_TOUCHSCREEN generic event interception if any service is performing // touch exploration. if (event.isFromSource(InputDevice.SOURCE_TOUCHSCREEN) @@ -1109,7 +1118,22 @@ class AccessibilityInputFilter extends InputFilter implements EventStreamTransfo return false; } final int eventSourceWithoutClass = event.getSource() & ~InputDevice.SOURCE_CLASS_MASK; - return (mCombinedGenericMotionEventSources & eventSourceWithoutClass) != 0; + return (mCombinedGenericMotionEventSources + & mCombinedMotionEventObservedSources + & eventSourceWithoutClass) + != 0; + } + + private boolean canShareGenericTouchEvent() { + if ((mCombinedMotionEventObservedSources & InputDevice.SOURCE_TOUCHSCREEN) != 0) { + // Share touch events if a MotionEvent-observing service wants them. + return true; + } + if ((mEnabledFeatures & FLAG_FEATURE_TOUCH_EXPLORATION) == 0) { + // Share touch events if touch exploration is not enabled. + return true; + } + return false; } public void setCombinedGenericMotionEventSources(int sources) { diff --git a/services/core/java/com/android/server/power/ThermalManagerService.java b/services/core/java/com/android/server/power/ThermalManagerService.java index 7f2476979635..822ec2eb79b0 100644 --- a/services/core/java/com/android/server/power/ThermalManagerService.java +++ b/services/core/java/com/android/server/power/ThermalManagerService.java @@ -1644,8 +1644,7 @@ public class ThermalManagerService extends SystemService { if (Flags.allowThermalHeadroomThresholds()) { for (int severity = ThrottlingSeverity.LIGHT; severity <= ThrottlingSeverity.SHUTDOWN; severity++) { - if (severity != ThrottlingSeverity.SEVERE - && threshold.hotThrottlingThresholds.length > severity) { + if (threshold.hotThrottlingThresholds.length > severity) { updateHeadroomThreshold(severity, threshold.hotThrottlingThresholds[severity], severeThreshold); |