blob: 15fd85f812d507fba8814d7973c6d915b1bb402c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
package se.leap.bitmaskclient;
import android.content.Context;
import android.support.multidex.MultiDexApplication;
import com.squareup.leakcanary.LeakCanary;
import com.squareup.leakcanary.RefWatcher;
/**
* Created by cyberta on 24.10.17.
*/
public class BitmaskApp extends MultiDexApplication {
private RefWatcher refWatcher;
@Override
public void onCreate() {
super.onCreate();
if (LeakCanary.isInAnalyzerProcess(this)) {
// This process is dedicated to LeakCanary for heap analysis.
// You should not init your app in this process.
return;
}
refWatcher = LeakCanary.install(this);
// Normal app init code...*/
PRNGFixes.apply();
}
/**
* Use this method to get a RefWatcher object that checks for memory leaks in the given context.
* Call refWatcher.watch(this) to check if all references get garbage collected.
* @param context
* @return the RefWatcher object
*/
public static RefWatcher getRefWatcher(Context context) {
BitmaskApp application = (BitmaskApp) context.getApplicationContext();
return application.refWatcher;
}
}
|