Skip to content

Replace sticky broadcasts with and event-mechanism or else #6654

@AndyScherzinger

Description

@AndyScherzinger

Workaround
Installing app into the main profile also (just installing is enough)

Issue description
As reported in several tickets the app crashes with a security exception in case the app is used in a non-primary profile which might be a secondary profile or a Android 4 Work profile. This is due to the usage of (deprecated) sticky broadcasts, see for example #4205

Google
Sticky broadcasts should not be used. They provide no security (anyone can access them), no protection (anyone can modify them), and many other problems. The recommended pattern is to use a non-sticky broadcast to report that something has changed, with another mechanism for apps to retrieve the current value whenever desired.

It seems the solution is to move to events e.g. via an Eventbus, see https://stackoverflow.com/a/46836794 with GreenRobot EventBus being part of our application already OR see #6048 by @ezaquarii to move to complete rewrites for these areas of the code base.

What do you think @tobiasKaminsky @ezaquarii ? Since the sticky broadcasts have been deprecated with API21 we will liekly get into more trouble in the future while I can't say if @ezaquarii's solution can be applied in all situations where we use sticky*.

Closing #4205 in favor of this issue that rather discusses the solution and can be used as a central issue.

Reports
#4205 #4229 #4476 #4553 #4565 #4573 #4615 #4627 #4661 #4896 #4931
#5059 #5131 #5309 #5366 #5514 #5709 #5831 #5907
#6545 #6649

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions