diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/build.gradle | 2 | ||||
-rw-r--r-- | app/src/debug/AndroidManifest.xml | 17 | ||||
-rw-r--r-- | app/src/debug/java/se/leap/bitmaskclient/LeakCanaryInstaller.java | 60 |
3 files changed, 78 insertions, 1 deletions
diff --git a/app/build.gradle b/app/build.gradle index 5e5de9d0..a79c97f1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -417,7 +417,7 @@ dependencies { testImplementation 'org.json:json:20180813' androidTestImplementation 'androidx.test.ext:junit:1.1.4' - debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.9.1' + debugImplementation 'com.squareup.leakcanary:leakcanary-android-core:2.9.1' annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.3' annotationProcessor 'com.squareup.dagger:dagger-compiler:1.2.2' implementation 'com.jakewharton:butterknife:10.2.1' diff --git a/app/src/debug/AndroidManifest.xml b/app/src/debug/AndroidManifest.xml index 51e17015..08062ff3 100644 --- a/app/src/debug/AndroidManifest.xml +++ b/app/src/debug/AndroidManifest.xml @@ -19,6 +19,23 @@ package="se.leap.bitmaskclient" android:requestLegacyExternalStorage="true" > + + <application + android:name=".base.BitmaskApp" + android:allowBackup="true" + android:icon="@mipmap/ic_launcher" + android:label="@string/app_name" + android:extractNativeLibs="true" + android:appCategory="productivity" + android:logo="@mipmap/ic_launcher" + android:theme="@style/BitmaskTheme"> + > + <provider + android:name=".LeakCanaryInstaller" + android:authorities="${applicationId}.leakcanary-installer" + android:exported="false" /> + </application> + <!-- package is overwritten in build.gradle --> <!-- The following permissions are required by fastlane / espresso --> diff --git a/app/src/debug/java/se/leap/bitmaskclient/LeakCanaryInstaller.java b/app/src/debug/java/se/leap/bitmaskclient/LeakCanaryInstaller.java new file mode 100644 index 00000000..25b94ef2 --- /dev/null +++ b/app/src/debug/java/se/leap/bitmaskclient/LeakCanaryInstaller.java @@ -0,0 +1,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; + } + } +} |