Skip to content

Commit

Permalink
Disable ParcelFileDescriptor rewinding for Robolectric tests as Os#ls…
Browse files Browse the repository at this point in the history
…eek does not work in Robolectric.

PiperOrigin-RevId: 437780484
  • Loading branch information
sjudd authored and glide-copybara-robot committed Mar 28, 2022
1 parent 50702ef commit 9840c91
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ public final class ParcelFileDescriptorRewinder implements DataRewinder<ParcelFi
private final InternalRewinder rewinder;

public static boolean isSupported() {
// Os.lseek() is only supported on API 21+.
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
// Os.lseek() is only supported on API 21+ and does not work in Robolectric.
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
&& !"robolectric".equals(Build.FINGERPRINT);
}

@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
Expand Down

0 comments on commit 9840c91

Please sign in to comment.