Loading core/java/android/app/Instrumentation.java +0 −4 Original line number Diff line number Diff line Loading @@ -381,10 +381,6 @@ public class Instrumentation { * Force the global system in or out of touch mode. This can be used if your * instrumentation relies on the UI being in one more or the other when it starts. * * <p><b>Note:</b> Starting from Android {@link Build.VERSION_CODES#TIRAMISU}, this method * will only have an effect if the calling process is also the focused window owner or has * {@link android.permission#MODIFY_TOUCH_MODE_STATE} permission granted. * * @param inTouch Set to true to be in touch mode, false to be in focus mode. */ public void setInTouchMode(boolean inTouch) { Loading services/core/java/com/android/server/wm/ActivityTaskManagerService.java +12 −0 Original line number Diff line number Diff line Loading @@ -5267,6 +5267,18 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } } /** * Returns {@code true} if the process represented by the pid passed as argument is * instrumented. */ boolean isInstrumenting(int pid) { final WindowProcessController process; synchronized (mGlobalLock) { process = mProcessMap.getProcess(pid); } return process != null ? process.isInstrumenting() : false; } final class H extends Handler { static final int REPORT_TIME_TRACKER_MSG = 1; static final int UPDATE_PROCESS_ANIMATING_STATE = 2; Loading services/core/java/com/android/server/wm/WindowManagerService.java +5 −3 Original line number Diff line number Diff line Loading @@ -3683,7 +3683,8 @@ public class WindowManagerService extends IWindowManager.Stub * Sets the touch mode state. * * To be able to change touch mode state, the caller must either own the focused window, or must * have the MODIFY_TOUCH_MODE_STATE permission. * have the MODIFY_TOUCH_MODE_STATE permission. Instrumented processes are allowed to switch * touch mode at any time. * * @param mode the touch mode to set */ Loading @@ -3695,8 +3696,9 @@ public class WindowManagerService extends IWindowManager.Stub } final int pid = Binder.getCallingPid(); final int uid = Binder.getCallingUid(); final boolean hasPermission = checkCallingPermission(MODIFY_TOUCH_MODE_STATE, "setInTouchMode()"); final boolean hasPermission = mAtmService.isInstrumenting(pid) || checkCallingPermission(MODIFY_TOUCH_MODE_STATE, "setInTouchMode()"); final long token = Binder.clearCallingIdentity(); try { if (mInputManager.setInTouchMode(mode, pid, uid, hasPermission)) { Loading Loading
core/java/android/app/Instrumentation.java +0 −4 Original line number Diff line number Diff line Loading @@ -381,10 +381,6 @@ public class Instrumentation { * Force the global system in or out of touch mode. This can be used if your * instrumentation relies on the UI being in one more or the other when it starts. * * <p><b>Note:</b> Starting from Android {@link Build.VERSION_CODES#TIRAMISU}, this method * will only have an effect if the calling process is also the focused window owner or has * {@link android.permission#MODIFY_TOUCH_MODE_STATE} permission granted. * * @param inTouch Set to true to be in touch mode, false to be in focus mode. */ public void setInTouchMode(boolean inTouch) { Loading
services/core/java/com/android/server/wm/ActivityTaskManagerService.java +12 −0 Original line number Diff line number Diff line Loading @@ -5267,6 +5267,18 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } } /** * Returns {@code true} if the process represented by the pid passed as argument is * instrumented. */ boolean isInstrumenting(int pid) { final WindowProcessController process; synchronized (mGlobalLock) { process = mProcessMap.getProcess(pid); } return process != null ? process.isInstrumenting() : false; } final class H extends Handler { static final int REPORT_TIME_TRACKER_MSG = 1; static final int UPDATE_PROCESS_ANIMATING_STATE = 2; Loading
services/core/java/com/android/server/wm/WindowManagerService.java +5 −3 Original line number Diff line number Diff line Loading @@ -3683,7 +3683,8 @@ public class WindowManagerService extends IWindowManager.Stub * Sets the touch mode state. * * To be able to change touch mode state, the caller must either own the focused window, or must * have the MODIFY_TOUCH_MODE_STATE permission. * have the MODIFY_TOUCH_MODE_STATE permission. Instrumented processes are allowed to switch * touch mode at any time. * * @param mode the touch mode to set */ Loading @@ -3695,8 +3696,9 @@ public class WindowManagerService extends IWindowManager.Stub } final int pid = Binder.getCallingPid(); final int uid = Binder.getCallingUid(); final boolean hasPermission = checkCallingPermission(MODIFY_TOUCH_MODE_STATE, "setInTouchMode()"); final boolean hasPermission = mAtmService.isInstrumenting(pid) || checkCallingPermission(MODIFY_TOUCH_MODE_STATE, "setInTouchMode()"); final long token = Binder.clearCallingIdentity(); try { if (mInputManager.setInTouchMode(mode, pid, uid, hasPermission)) { Loading