This commit simplifies the `checkRequiredPermissions` method in the `RemoteKeyboardPlugin` by using Java
streams.
The previous implementation used a for loop to iterate over the list of enabled input methods and check if the package name matched the current context. This has been replaced with a more concise stream-based approach using `anyMatch`.
On Android 10 the share files feature fails when the default
directory is selected. When selecting a custom directory, the
permission is explicitly asked to the user, which makes the
feature work. When the location is switched back to the default
location, the feature is again broken.
The requestLegacyExternalStorage flag brings back the old
behavior and allows to write in the directory. It should be however
ignored for Android >= 11 according to the docs:
https://developer.android.com/training/data-storage/use-cases#opt-out-in-production-app
From Android 11, the Downlods directory should not need specific permissions.
## Summary
1) Fix the code responsible for loading the trusted network list.
2) The old `#_#` delimiter has been replaced with a less likely NUL character. This requires re-adding trusted networks, so I can revert it if necessary.
3) Ignore incoming identity packets on untrusted devices if they come from an untrusted device.
BUG: 492302
## Test Plan
### Before:
1) Trusted networks were completely broken, an would show variations of `#` and `_` on the list due to a bug in the splitting code.
2) Any network with `#_#` in the SSID - although unlikely - would not be possible to use as a trusted network.
3) The device was still discoverable on an untrusted network by manually refreshing the devices list.
### After:
1) Trusted networks now load the SSID list correctly.
2) Networks with `#_#` in the SSID can be added as trusted networks.
3) The device is no longer discoverable on an untrusted network.