fix(custom-tabs): `SecurityException` in `bindCustomTabsService` on a Xiaomi device
Purpose / Description
CompatHelper$Companion.resolveActivityCompat was seen to throw an undocumented SecurityException on a Xiaomi Redmi K50 (SDK 34)
Disable custom tabs if this occurs
Fixes
- Fixes #19711
Approach
As I couldn't reproduce this: multi-pronged approach
- It's possible that the
httpprotocol was the case- change to
- add it to
<queries>anyway, as it may cause other failures and is a valid lookup
- Catch the
SecurityExceptionand continue to see if the code can succeed - If the code fails later on with another
SecurityException, also catch that one- I suspect
queryIntentActivitiesCompat
- I suspect
How Has This Been Tested?
⚠️ Not easily testable; app still runs
Checklist
- [x] You have a descriptive commit message with a short title (first line, max 50 chars).
- [x] You have commented your code, particularly in hard-to-understand areas
- [x] You have performed a self-review of your own code
- [ ] UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
- [ ] UI Changes: You have tested your change using the Google Accessibility Scanner
https://github.com/ankidroid/Anki-Android/labels/Blocked%20by%20dependency
Too close to the 2.23.0 release window, wait for 2.23.1
@david-allison would love to get this in - the code looks fantastic, just needs a quick commit preening to make sure the import changes I noted are either needed or removed as they appear unrelated now
@mikehardy good to go I feel
Doing cherry-picks this AM in the slice of time I've got, going to get this in