Skip to content

Commit

Permalink
Use StrictMode VmPolicy only in debug build type (syncthing#2002)
Browse files Browse the repository at this point in the history
 `StrictMode` makes sense mainly in for debug build types, enabling
it for release does not provide any value as it can add additional overhead and its logs going to be removed (because R8 strips them).
  • Loading branch information
adamszewe committed Dec 5, 2023
1 parent ae27e7b commit f4ccad8
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ public void onCreate() {

new Languages(this).setLanguage(this);

if (BuildConfig.DEBUG) {
setStrictMode();
}
}

private void setStrictMode() {
// Set VM policy to avoid crash when sending folder URI to file manager.
StrictMode.VmPolicy policy = new StrictMode.VmPolicy.Builder()
.detectAll()
Expand Down

0 comments on commit f4ccad8

Please sign in to comment.