mirror of
https://github.com/nextcloud/android.git
synced 2024-11-25 14:45:47 +03:00
Merge pull request #9186 from nextcloud/strictMode
Enable StrictMode during development
This commit is contained in:
commit
f0ee7d719e
1 changed files with 19 additions and 1 deletions
|
@ -244,6 +244,8 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
|
|||
@SuppressFBWarnings("ST")
|
||||
@Override
|
||||
public void onCreate() {
|
||||
enableStrictMode();
|
||||
|
||||
setAppTheme(preferences.getDarkThemeMode());
|
||||
super.onCreate();
|
||||
|
||||
|
@ -425,6 +427,22 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
|
|||
}
|
||||
}
|
||||
|
||||
private void enableStrictMode() {
|
||||
if (BuildConfig.DEBUG) {
|
||||
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
|
||||
.detectDiskReads()
|
||||
.detectDiskWrites()
|
||||
.detectAll()
|
||||
.penaltyLog()
|
||||
.build());
|
||||
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
|
||||
.detectLeakedSqlLiteObjects()
|
||||
.detectLeakedClosableObjects()
|
||||
.penaltyLog()
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
public static void initSyncOperations(
|
||||
final AppPreferences preferences,
|
||||
final UploadsStorageManager uploadsStorageManager,
|
||||
|
|
Loading…
Reference in a new issue