Loading services/accessibility/java/com/android/server/accessibility/AccessibilityServiceConnection.java +1 −2 Original line number Diff line number Diff line Loading @@ -372,12 +372,11 @@ class AccessibilityServiceConnection extends AbstractAccessibilityServiceConnect @Override public void dispatchGesture(int sequence, ParceledListSlice gestureSteps, int displayId) { final boolean isTouchableDisplay = mWindowManagerService.isTouchableDisplay(displayId); synchronized (mLock) { if (mSecurityPolicy.canPerformGestures(this)) { MotionEventInjector motionEventInjector = mSystemSupport.getMotionEventInjectorForDisplayLocked(displayId); if (motionEventInjector != null && isTouchableDisplay) { if (mWindowManagerService.isTouchOrFaketouchDevice()) { motionEventInjector.injectEvents( gestureSteps.getList(), mServiceInterface, sequence, displayId); } else { Loading services/core/java/com/android/server/wm/WindowManagerInternal.java +2 −2 Original line number Diff line number Diff line Loading @@ -611,9 +611,9 @@ public abstract class WindowManagerInternal { public abstract void removeNonHighRefreshRatePackage(@NonNull String packageName); /** * Checks if this display is touchable. * Checks if the device supports touch or faketouch. */ public abstract boolean isTouchableDisplay(int displayId); public abstract boolean isTouchOrFaketouchDevice(); /** * Returns the info associated with the input token used to determine if a key should be Loading services/core/java/com/android/server/wm/WindowManagerService.java +6 −6 Original line number Diff line number Diff line Loading @@ -750,6 +750,7 @@ public class WindowManagerService extends IWindowManager.Stub final TaskSnapshotController mTaskSnapshotController; boolean mIsTouchDevice; boolean mIsFakeTouchDevice; final H mH = new H(); Loading Loading @@ -4960,6 +4961,8 @@ public class WindowManagerService extends IWindowManager.Stub mRoot.forAllDisplays(DisplayContent::reconfigureDisplayLocked); mIsTouchDevice = mContext.getPackageManager().hasSystemFeature( PackageManager.FEATURE_TOUCHSCREEN); mIsFakeTouchDevice = mContext.getPackageManager().hasSystemFeature( PackageManager.FEATURE_FAKETOUCH); } try { Loading Loading @@ -7956,13 +7959,10 @@ public class WindowManagerService extends IWindowManager.Stub } @Override public boolean isTouchableDisplay(int displayId) { public boolean isTouchOrFaketouchDevice() { synchronized (mGlobalLock) { final DisplayContent displayContent = mRoot.getDisplayContent(displayId); final Configuration configuration = displayContent != null ? displayContent.getConfiguration() : null; return configuration != null && configuration.touchscreen == Configuration.TOUCHSCREEN_FINGER; // All touchable devices are also faketouchable. return mIsFakeTouchDevice; } } Loading services/tests/servicestests/src/com/android/server/accessibility/AccessibilityServiceConnectionTest.java +4 −6 Original line number Diff line number Diff line Loading @@ -110,8 +110,6 @@ public class AccessibilityServiceConnectionTest { mMockResolveInfo.serviceInfo.applicationInfo = mock(ApplicationInfo.class); when(mMockIBinder.queryLocalInterface(any())).thenReturn(mMockServiceClient); when(mMockWindowManagerInternal.isTouchableDisplay(Display.DEFAULT_DISPLAY)).thenReturn( true); mConnection = new AccessibilityServiceConnection(mMockUserState, mMockContext, COMPONENT_NAME, mMockServiceInfo, SERVICE_ID, mHandler, new Object(), Loading Loading @@ -197,8 +195,9 @@ public class AccessibilityServiceConnectionTest { } @Test public void sendGesture_touchableDisplay_injectEvents() public void sendGesture_touchableDevice_injectEvents() throws RemoteException { when(mMockWindowManagerInternal.isTouchOrFaketouchDevice()).thenReturn(true); setServiceBinding(COMPONENT_NAME); mConnection.bindLocked(); mConnection.onServiceConnected(COMPONENT_NAME, mMockIBinder); Loading @@ -213,10 +212,9 @@ public class AccessibilityServiceConnectionTest { } @Test public void sendGesture_untouchableDisplay_performGestureResultFailed() public void sendGesture_untouchableDevice_performGestureResultFailed() throws RemoteException { when(mMockWindowManagerInternal.isTouchableDisplay(Display.DEFAULT_DISPLAY)).thenReturn( false); when(mMockWindowManagerInternal.isTouchOrFaketouchDevice()).thenReturn(false); setServiceBinding(COMPONENT_NAME); mConnection.bindLocked(); mConnection.onServiceConnected(COMPONENT_NAME, mMockIBinder); Loading Loading
services/accessibility/java/com/android/server/accessibility/AccessibilityServiceConnection.java +1 −2 Original line number Diff line number Diff line Loading @@ -372,12 +372,11 @@ class AccessibilityServiceConnection extends AbstractAccessibilityServiceConnect @Override public void dispatchGesture(int sequence, ParceledListSlice gestureSteps, int displayId) { final boolean isTouchableDisplay = mWindowManagerService.isTouchableDisplay(displayId); synchronized (mLock) { if (mSecurityPolicy.canPerformGestures(this)) { MotionEventInjector motionEventInjector = mSystemSupport.getMotionEventInjectorForDisplayLocked(displayId); if (motionEventInjector != null && isTouchableDisplay) { if (mWindowManagerService.isTouchOrFaketouchDevice()) { motionEventInjector.injectEvents( gestureSteps.getList(), mServiceInterface, sequence, displayId); } else { Loading
services/core/java/com/android/server/wm/WindowManagerInternal.java +2 −2 Original line number Diff line number Diff line Loading @@ -611,9 +611,9 @@ public abstract class WindowManagerInternal { public abstract void removeNonHighRefreshRatePackage(@NonNull String packageName); /** * Checks if this display is touchable. * Checks if the device supports touch or faketouch. */ public abstract boolean isTouchableDisplay(int displayId); public abstract boolean isTouchOrFaketouchDevice(); /** * Returns the info associated with the input token used to determine if a key should be Loading
services/core/java/com/android/server/wm/WindowManagerService.java +6 −6 Original line number Diff line number Diff line Loading @@ -750,6 +750,7 @@ public class WindowManagerService extends IWindowManager.Stub final TaskSnapshotController mTaskSnapshotController; boolean mIsTouchDevice; boolean mIsFakeTouchDevice; final H mH = new H(); Loading Loading @@ -4960,6 +4961,8 @@ public class WindowManagerService extends IWindowManager.Stub mRoot.forAllDisplays(DisplayContent::reconfigureDisplayLocked); mIsTouchDevice = mContext.getPackageManager().hasSystemFeature( PackageManager.FEATURE_TOUCHSCREEN); mIsFakeTouchDevice = mContext.getPackageManager().hasSystemFeature( PackageManager.FEATURE_FAKETOUCH); } try { Loading Loading @@ -7956,13 +7959,10 @@ public class WindowManagerService extends IWindowManager.Stub } @Override public boolean isTouchableDisplay(int displayId) { public boolean isTouchOrFaketouchDevice() { synchronized (mGlobalLock) { final DisplayContent displayContent = mRoot.getDisplayContent(displayId); final Configuration configuration = displayContent != null ? displayContent.getConfiguration() : null; return configuration != null && configuration.touchscreen == Configuration.TOUCHSCREEN_FINGER; // All touchable devices are also faketouchable. return mIsFakeTouchDevice; } } Loading
services/tests/servicestests/src/com/android/server/accessibility/AccessibilityServiceConnectionTest.java +4 −6 Original line number Diff line number Diff line Loading @@ -110,8 +110,6 @@ public class AccessibilityServiceConnectionTest { mMockResolveInfo.serviceInfo.applicationInfo = mock(ApplicationInfo.class); when(mMockIBinder.queryLocalInterface(any())).thenReturn(mMockServiceClient); when(mMockWindowManagerInternal.isTouchableDisplay(Display.DEFAULT_DISPLAY)).thenReturn( true); mConnection = new AccessibilityServiceConnection(mMockUserState, mMockContext, COMPONENT_NAME, mMockServiceInfo, SERVICE_ID, mHandler, new Object(), Loading Loading @@ -197,8 +195,9 @@ public class AccessibilityServiceConnectionTest { } @Test public void sendGesture_touchableDisplay_injectEvents() public void sendGesture_touchableDevice_injectEvents() throws RemoteException { when(mMockWindowManagerInternal.isTouchOrFaketouchDevice()).thenReturn(true); setServiceBinding(COMPONENT_NAME); mConnection.bindLocked(); mConnection.onServiceConnected(COMPONENT_NAME, mMockIBinder); Loading @@ -213,10 +212,9 @@ public class AccessibilityServiceConnectionTest { } @Test public void sendGesture_untouchableDisplay_performGestureResultFailed() public void sendGesture_untouchableDevice_performGestureResultFailed() throws RemoteException { when(mMockWindowManagerInternal.isTouchableDisplay(Display.DEFAULT_DISPLAY)).thenReturn( false); when(mMockWindowManagerInternal.isTouchOrFaketouchDevice()).thenReturn(false); setServiceBinding(COMPONENT_NAME); mConnection.bindLocked(); mConnection.onServiceConnected(COMPONENT_NAME, mMockIBinder); Loading