Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions runner/rules/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

**API Changes**

* `GrantPermissionRule` now has a method `#grantImmediately` to grant permissions without going through the `TestRule` infrastructure.

**Breaking API Changes**

**Known Issues**
6 changes: 6 additions & 0 deletions runner/rules/java/androidx/test/rule/GrantPermissionRule.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ public static GrantPermissionRule grant(String... permissions) {
return grantPermissionRule;
}

public static void grantImmediately(String... permissions) {
GrantPermissionRule grantPermissionRule = new GrantPermissionRule();
grantPermissionRule.grantPermissions(permissions);
grantPermissionRule.permissionGranter.requestPermissions();
}

private void grantPermissions(String... permissions) {
Set<String> permissionSet = satisfyPermissionDependencies(permissions);
permissionGranter.addPermissions(permissionSet.toArray(new String[permissionSet.size()]));
Expand Down
Loading