Programmatically grant android.permission.ACCESS_NOTIFICATION_POLICY permission during android integration tests

Viewed 238

Is there any way how to grant android.permission.ACCESS_NOTIFICATION_POLICY permission during Android tests?

Most of the permissions and even not runtime permission is easy to get in the test environment by calling

GrantPermissionRule.grant(
    android.Manifest.permission.WRITE_EXTERNAL_STORAGE,
    android.Manifest.permission.READ_EXTERNAL_STORAGE,
    android.Manifest.permission.PACKAGE_USAGE_STATS,
    android.Manifest.permission.READ_PHONE_STATE
)

But I need to test NotificationListenerService functionality, which needs to enable Notification access. And this doesn't work.

0 Answers
Related