Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate intents passed to start/stop/bindService. #5053

Merged
merged 1 commit into from May 28, 2019

Conversation

copybara-robolectric
Copy link
Contributor

Validate intents passed to start/stop/bindService.

The Android OS normally throws an IllegalArgumentException if an
implicit Intent is passed to one of these methods by an app which
targets SDK 21 or higher. However, this logic was lost because
Robolectric shadows these methods, and only the actual implementation
has access to the private Intent validation method. Copy the
relatively simple validation check into Robolectric to achieve the
same behavior.

Existing usage of these methods in tests must be updated to use
explicit intents rather than implicit ones in order for those tests
not to crash. Prod code should also be audited to ensure that these
methods are never called with implicit intents (at least on SDK 21+).

The Android OS normally throws an IllegalArgumentException if an
implicit Intent is passed to one of these methods by an app which
targets SDK 21 or higher. However, this logic was lost because
Robolectric shadows these methods, and only the actual implementation
has access to the private Intent validation method. Copy the
relatively simple validation check into Robolectric to achieve the
same behavior.

Existing usage of these methods in tests must be updated to use
explicit intents rather than implicit ones in order for those tests
not to crash. Prod code should also be audited to ensure that these
methods are never called with implicit intents (at least on SDK 21+).

See #5016

PiperOrigin-RevId: 250337437
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant