Skip to content

Commit

Permalink
Catch the SyncFailedException gracefully to avoid insta-crash in Appl…
Browse files Browse the repository at this point in the history
…ication

Summary:
There're a lot of reports from github saying soloader caused insta-crash on app startup in Android 12. Catching the SyncFailedException gracefully to avoid insta-crash in Application

#80

Fix #80

Reviewed By: charles011

Differential Revision: D32164174

fbshipit-source-id: ee5b85c1b555d318a0d720020d4e25f6135503cb
  • Loading branch information
simpleton authored and facebook-github-bot committed Nov 4, 2021
1 parent 0447587 commit 62c0bd6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions java/com/facebook/soloader/UnpackingSoSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.io.SyncFailedException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -223,6 +224,8 @@ private static void writeState(File stateFileName, byte state) throws IOExceptio
stateFile.write(state);
stateFile.setLength(stateFile.getFilePointer());
stateFile.getFD().sync();
} catch (SyncFailedException e) {
Log.w(TAG, "state file sync failed", e);
}
}

Expand Down

0 comments on commit 62c0bd6

Please sign in to comment.