Skip to content

Commit

Permalink
CB-11115 android: Removing dependency on FileDescriptor toString in c…
Browse files Browse the repository at this point in the history
…ontent provider tests
  • Loading branch information
riknoll committed Apr 20, 2016
1 parent d9b9046 commit fe7b781
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions tests/src/android/TestContentProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundEx
try {
File f = File.createTempFile("test-content-provider", ".tmp");
resourceApi.copyResource(Uri.parse("file:///android_asset" + fileName), Uri.fromFile(f));
FileInputStream fis = new FileInputStream(f);
String thisIsDumb = fis.getFD().toString();
int fd = Integer.parseInt(thisIsDumb.substring("FileDescriptor[".length(), thisIsDumb.length() - 1));
return ParcelFileDescriptor.adoptFd(fd);
return ParcelFileDescriptor.open(f, ParcelFileDescriptor.MODE_READ_ONLY);
} catch (FileNotFoundException e) {
throw e;
} catch (IOException e) {
Expand Down

0 comments on commit fe7b781

Please sign in to comment.