Skip to content

Handling java.lang.SecurityExceptions from sensors  #4

@aaaaalbert

Description

@aaaaalbert

It can happen that Sensibility doesn't have the permission to access a sensor. This then leads to an exception like this:

Exception (with type 'exceptions.Exception'): java.lang.SecurityException: getAllCellInfo:
Neither user 10106 nor current process has android.permission.ACCESS_COARSE_LOCATION.

How are we going to deal with this?

  • Make proper Python/Repy/Sensor exceptions. This makes sense in terms of handling these issues in a Repy program, but also means that handling is required! For every sensor in your program, you must always expect that the permission to use it is revoked. Thus, try/except everywhere.
  • Alternatively, hide these exceptions from the experiment. You try to access the sensor, but it ... returns None? The previous reading? Or it blocks indefinitely? Something else that makes sense?
  • The middle ground: Provide a wrapper layer, base the lower-layer implementation on (1), and provide (2) as the experimenter's interface. Downside: Messing with securitylayers to set the wrappers up.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions