(TouchMode Permission 2.1/n) Add permission check when switching touch mode

This CL adds the following permission checks when switching touch mode state:
1. Allow touch mode switch if caller is granted with MODIFY_TOUCH_MODE_STATE;
2. If caller is not granted with MODIFY_TOUCH_MODE_STATE, touch mode
state change will be allowed if the caller's uid matches the focused
window owner's uid.

Touch mode switch will be denied if none of the conditions above match.

Bug: 198487159
Test: atest inputflinger_tests
Test: atest libinput_tests

Change-Id: Ic704682ac41fe470207d9be132b4c0f1a8019f39
4 files changed