[Accessibility] Fix metadata spoofing in setAccessibilityWindowAttributes
A malicious app could use setAccessibilityWindowAttributes to overwrite
the accessibility title and locale of any other window by guessing its
integer windowId.
This CL adds an ownership check in AccessibilityWindowManager to ensure
that the calling UID matches the UID associated with the target window's
connection.
Verification:
1. Added unit test in AccessibilityWindowManagerTest to verify the
SecurityException is thrown on the server side when UID mismatch
is detected.
2. Added CTS test AccessibilityWindowMetadataTest (tagged for STS)
to verify that foreign window attributes cannot be spoofed and
own window attributes can still be set successfully.
Bug: 494816520
Test: atest AccessibilityWindowManagerTest
Test: atest CtsAccessibilityTestCases:android.view.accessibility.cts.AccessibilityWindowMetadataTest
Flag: EXEMPT CVE_FIX
Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:a03ff76d12d83c73b7df058ac7b2299a1df6dc4d
Merged-In: I2982185203cfaac6f73a12adfe41b9e810bc535d
Change-Id: I2982185203cfaac6f73a12adfe41b9e810bc535d
2 files changed