summaryrefslogtreecommitdiff
path: root/app/src/debug/java/se/leap/bitmaskclient/LeakCanaryInstaller.java
blob: 25b94ef2d2122271338c66564a74323f51bad083 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package se.leap.bitmaskclient;

import android.app.Application;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import leakcanary.AppWatcher;

public class LeakCanaryInstaller extends ContentProvider {

    @Override
    public boolean onCreate() {
        if (!isTest()) {
            AppWatcher.INSTANCE.manualInstall((Application)getContext().getApplicationContext());
        }
        return false;
    }

    @Nullable
    @Override
    public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) {
        return null;
    }

    @Nullable
    @Override
    public String getType(@NonNull Uri uri) {
        return null;
    }

    @Nullable
    @Override
    public Uri insert(@NonNull Uri uri, @Nullable ContentValues values) {
        return null;
    }

    @Override
    public int delete(@NonNull Uri uri, @Nullable String selection, @Nullable String[] selectionArgs) {
        return 0;
    }

    @Override
    public int update(@NonNull Uri uri, @Nullable ContentValues values, @Nullable String selection, @Nullable String[] selectionArgs) {
        return 0;
    }


     private boolean isTest() {
        try {
            return  Class.forName("org.junit.Test") != null;
        } catch (ClassNotFoundException e) {
            return false;
        }
    }
}