private void grantPermission(Context context, String permission) {
    if (Build.VERSION.SDK_INT < 23) {
      return;
    }
    // NULLSAFE_FIXME[Not Vetted Third-Party]
    UiAutomation automation = Registry.getRegistry().instrumentation.getUiAutomation();
    String command =
        String.format(Locale.ENGLISH, "pm grant %s %s", context.getPackageName(), permission);
    // NULLSAFE_FIXME[Not Vetted Third-Party]
    ParcelFileDescriptor pfd = automation.executeShellCommand(command);
    InputStream stream = new FileInputStream(pfd.getFileDescriptor());
    try {
      byte[] buffer = new byte[1024];
      while (stream.read(buffer) != -1) {
        // Consume stdout to ensure the command completes
      }
    } catch (IOException ignored) {
    } finally {
      try {
        stream.close();
      } catch (IOException ignored) {
      }
      try {
        pfd.close();
      } catch (IOException ignored) {
      }
    }
  }
Provides a directory for an Album to store its screenshots in.
core/src/main/java/com/facebook/testing/screenshot/internal/ScreenshotDirectories.java