import android.os.ServiceManager;
import android.hardware.input.IInputManager;
import android.view.InputDevice;
import android.os.IBinder;
IBinder binder = ServiceManager.getService("input");
IInputManager inputManager = IInputManager.Stub.asInterface(binder);
int[] deviceIds = inputManager.getInputDeviceIds();
int touchDeviceId = -1;
for (int id : deviceIds) {
int sources = inputManager.getInputDevice(id).getSources();
if ((sources & InputDevice.SOURCE_TOUCHSCREEN) == InputDevice.SOURCE_TOUCHSCREEN) {
touchDeviceId = id;
}
}
if (touchDeviceId != -1) {
inputManager.disableInputDevice(touchDeviceId);
"禁用触摸设备 ID: " + touchDeviceId;
}