diff options
author | cyBerta <cyberta@riseup.net> | 2023-04-10 03:12:47 +0200 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2023-04-10 03:12:47 +0200 |
commit | 8c9d5ba9e1cb6009824d715e5ba23182bbda4366 (patch) | |
tree | abe8da5a80c026c7e8e749fc7a893ab1ecfffba0 /app/src/debug/java/se/leap | |
parent | f399a22358da416bec16327e093a6ce408fbe013 (diff) |
fix fastlane location switching on newer Android versions
Diffstat (limited to 'app/src/debug/java/se/leap')
-rw-r--r-- | app/src/debug/java/se/leap/bitmaskclient/LeakCanaryInstaller.java | 60 |
1 files changed, 60 insertions, 0 deletions
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; + } + } +} |