[android] Fix SecurityException when importing bookmarks #7287

Merged
root merged 1 commit from rt-android-fix-import-bookmarks into master 2024-02-01 06:57:22 +00:00

1 commit

Author SHA1 Message Date
ecf516fdc4 [android] Fix SecurityException when importing bookmarks
SecurityException is thrown by ContentResolver.query() when called on
a cold start from an Activity without FLAG_GRANT_READ_URI_PERMISSION.
This flag is set automatically by the system when the app is launched
with an external uri (i.e. content://). The previous implementation
just lost all passed intent flags during Splash -> DownloadLegacy ->
MwmActivity flow.

Re-route the original intent from the system by calling setComponent()
instead of wrapping it into EXTRA_INITIAL_INTENT. The original intent
retains all the flags and a uri payload.

Check for system's FLAG_ACTIVITY_FORWARD_RESULT instead of our custom
EXTRA_PICK_POINT to detect when API caller expects a result from
the call. This approach is backward-compatible and doesn't break old
API clients. EXTRA_PICK_POINT can be safely removed from API callers.

Remove legacy EXTRA_ACTIVITY_TO_START which wasn't used in the code.

Fixes #6944 #7149

Signed-off-by: Roman Tsisyk <roman@tsisyk.com>
2024-01-31 20:42:33 +02:00