Loading core/java/android/accessibilityservice/AccessibilityService.java +3 −2 Original line number Diff line number Diff line Loading @@ -624,8 +624,7 @@ public abstract class AccessibilityService extends Service { gesture, 100); try { synchronized (mLock) { connection.sendMotionEvents(++mGestureStatusCallbackSequence, new ParceledListSlice<>(events)); mGestureStatusCallbackSequence++; if (callback != null) { if (mGestureStatusCallbackInfos == null) { mGestureStatusCallbackInfos = new SparseArray<>(); Loading @@ -634,6 +633,8 @@ public abstract class AccessibilityService extends Service { callback, handler); mGestureStatusCallbackInfos.put(mGestureStatusCallbackSequence, callbackInfo); } connection.sendMotionEvents(mGestureStatusCallbackSequence, new ParceledListSlice<>(events)); } } catch (RemoteException re) { throw new RuntimeException(re); Loading services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java +0 −4 Original line number Diff line number Diff line Loading @@ -200,10 +200,6 @@ class AccessibilityInputFilter extends InputFilter implements EventStreamTransfo } } public MotionEventInjector getMotionEventInjector() { return mMotionEventInjector; } /** * Gets current event stream state associated with an input event. * @return The event stream state that should be used for the event. Null if the event should Loading services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java +24 −4 Original line number Diff line number Diff line Loading @@ -129,6 +129,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { private static final int WAIT_WINDOWS_TIMEOUT_MILLIS = 5000; // TODO: Restructure service initialization so services aren't connected before all of // their capabilities are ready. private static final int WAIT_MOTION_INJECTOR_TIMEOUT_MILLIS = 1000; private static final String FUNCTION_REGISTER_UI_TEST_AUTOMATION_SERVICE = "registerUiTestAutomationService"; Loading Loading @@ -794,6 +798,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { void setMotionEventInjector(MotionEventInjector motionEventInjector) { synchronized (mLock) { mMotionEventInjector = motionEventInjector; // We may be waiting on this object being set mLock.notifyAll(); } } Loading Loading @@ -2655,10 +2661,24 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { @Override public void sendMotionEvents(int sequence, ParceledListSlice events) { synchronized (mLock) { if (mSecurityPolicy.canPerformGestures(this) && (mMotionEventInjector != null)) { if (mSecurityPolicy.canPerformGestures(this)) { final long endMillis = SystemClock.uptimeMillis() + WAIT_MOTION_INJECTOR_TIMEOUT_MILLIS; while ((mMotionEventInjector == null) && (SystemClock.uptimeMillis() < endMillis)) { try { mLock.wait(endMillis - SystemClock.uptimeMillis()); } catch (InterruptedException ie) { /* ignore */ } } if (mMotionEventInjector != null) { mMotionEventInjector.injectEvents((List<MotionEvent>) events.getList(), mServiceInterface, sequence); return; } else { Slog.e(LOG_TAG, "MotionEventInjector installation timed out"); } } } try { Loading Loading
core/java/android/accessibilityservice/AccessibilityService.java +3 −2 Original line number Diff line number Diff line Loading @@ -624,8 +624,7 @@ public abstract class AccessibilityService extends Service { gesture, 100); try { synchronized (mLock) { connection.sendMotionEvents(++mGestureStatusCallbackSequence, new ParceledListSlice<>(events)); mGestureStatusCallbackSequence++; if (callback != null) { if (mGestureStatusCallbackInfos == null) { mGestureStatusCallbackInfos = new SparseArray<>(); Loading @@ -634,6 +633,8 @@ public abstract class AccessibilityService extends Service { callback, handler); mGestureStatusCallbackInfos.put(mGestureStatusCallbackSequence, callbackInfo); } connection.sendMotionEvents(mGestureStatusCallbackSequence, new ParceledListSlice<>(events)); } } catch (RemoteException re) { throw new RuntimeException(re); Loading
services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java +0 −4 Original line number Diff line number Diff line Loading @@ -200,10 +200,6 @@ class AccessibilityInputFilter extends InputFilter implements EventStreamTransfo } } public MotionEventInjector getMotionEventInjector() { return mMotionEventInjector; } /** * Gets current event stream state associated with an input event. * @return The event stream state that should be used for the event. Null if the event should Loading
services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java +24 −4 Original line number Diff line number Diff line Loading @@ -129,6 +129,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { private static final int WAIT_WINDOWS_TIMEOUT_MILLIS = 5000; // TODO: Restructure service initialization so services aren't connected before all of // their capabilities are ready. private static final int WAIT_MOTION_INJECTOR_TIMEOUT_MILLIS = 1000; private static final String FUNCTION_REGISTER_UI_TEST_AUTOMATION_SERVICE = "registerUiTestAutomationService"; Loading Loading @@ -794,6 +798,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { void setMotionEventInjector(MotionEventInjector motionEventInjector) { synchronized (mLock) { mMotionEventInjector = motionEventInjector; // We may be waiting on this object being set mLock.notifyAll(); } } Loading Loading @@ -2655,10 +2661,24 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { @Override public void sendMotionEvents(int sequence, ParceledListSlice events) { synchronized (mLock) { if (mSecurityPolicy.canPerformGestures(this) && (mMotionEventInjector != null)) { if (mSecurityPolicy.canPerformGestures(this)) { final long endMillis = SystemClock.uptimeMillis() + WAIT_MOTION_INJECTOR_TIMEOUT_MILLIS; while ((mMotionEventInjector == null) && (SystemClock.uptimeMillis() < endMillis)) { try { mLock.wait(endMillis - SystemClock.uptimeMillis()); } catch (InterruptedException ie) { /* ignore */ } } if (mMotionEventInjector != null) { mMotionEventInjector.injectEvents((List<MotionEvent>) events.getList(), mServiceInterface, sequence); return; } else { Slog.e(LOG_TAG, "MotionEventInjector installation timed out"); } } } try { Loading