Add app op reserved specifically for testing
In preparation for using the permission state to compute the app op mode of runtime permissions it will be needed to have an app op specific for keeping tests working correctly. In DiscreteAppopsTest the test uses OPSTR_CAMERA to make noteOps to validate discrete history; the problem is that the test app doesn't actually request the camera permission so PermissionPolicyService never syncs the permission state to the appop's mode which leads to the default mode being used which is the fully permissive MODE_ALLOWED. When permission grant state is used synchronously for checking mode this is going to behave differently since a permission not requested will not be granted. We will need an app op that is written to discrete registry and can be granted the fully permissive mode to test background discrete events and when permission state is used camera will never be able to. The location app ops are the only qualifying app ops that exist today but we see the problem that other features on the device also noteOp quickly after install contaminating expected results and failing the test. Because of that this can also be seen as a quality and stability improvement by providing better isolation between the api behaviors we want to test and other uses on the device of these apis. Test: Create this constant, update the test, and watch Bug: 266164193 Change-Id: I90bd030f36a9de4ab63768aedc6ad0b5317d91d0
Loading
Please register or sign in to comment