From cdcc1e3d7b57fdddcbc0c9b9595c80719d38dc98 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Mon, 8 Aug 2022 00:02:48 +0200 Subject: update gradle plugin to version 7.2.2, compile and target sdk to API 31, androidx libraries and leakcanary to latest versions --- app/build.gradle | 36 ++++++----------- app/src/main/AndroidManifest.xml | 7 +++- .../se/leap/bitmaskclient/base/BitmaskApp.java | 46 ++++++---------------- .../base/fragments/NavigationDrawerFragment.java | 30 +++++++------- build.gradle | 6 +-- gradle/wrapper/gradle-wrapper.properties | 6 +-- tor-android | 2 +- 7 files changed, 48 insertions(+), 85 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 7eec00b0..668f0783 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -4,9 +4,9 @@ import java.util.regex.Pattern apply plugin: 'com.android.application' android { - compileSdkVersion 30 + compileSdkVersion 31 ndkVersion "21.4.7075529" - buildToolsVersion '30.0.3' + buildToolsVersion '31.0.0' compileOptions { targetCompatibility 1.8 @@ -25,7 +25,7 @@ android { versionCode 163000 versionName "1.1.5" minSdkVersion 16 - targetSdkVersion 30 + targetSdkVersion 31 vectorDrawables.useSupportLibrary = true buildConfigField 'boolean', 'openvpn3', 'false' @@ -404,9 +404,7 @@ dependencies { //TODO: remove that library androidTestImplementation 'com.jayway.android.robotium:robotium-solo:5.6.3' testImplementation 'org.json:json:20180813' - debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.2' - releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.2' - betaImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.2' + debugImplementation 'com.squareup.leakcanary:leakcanary-android: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' @@ -416,15 +414,15 @@ dependencies { implementation 'com.google.code.gson:gson:2.8.6' implementation 'com.squareup.okhttp3:okhttp:3.12.12' implementation 'androidx.legacy:legacy-support-core-utils:1.0.0' - implementation 'androidx.annotation:annotation:1.1.0' + implementation 'androidx.annotation:annotation:1.4.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0' - implementation 'androidx.appcompat:appcompat:1.2.0' - implementation 'com.google.android.material:material:1.2.1' - implementation 'androidx.fragment:fragment:1.2.5' - implementation 'androidx.constraintlayout:constraintlayout:2.0.4' + implementation 'androidx.appcompat:appcompat:1.4.2' + implementation 'com.google.android.material:material:1.6.1' + implementation 'androidx.fragment:fragment:1.5.1' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.multidex:multidex:2.0.1' implementation 'androidx.cardview:cardview:1.0.0' - implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0' + implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0' implementation 'de.hdodenhof:circleimageview:3.1.0' @@ -486,23 +484,11 @@ android.applicationVariants.all { variant -> } } - -// Ensure the no-op dependency is always used in JVM tests. -configurations.all { config -> - if (config.name.contains('UnitTest')) { - config.resolutionStrategy.eachDependency { details -> - if (details.requested.group == 'com.squareup.leakcanary' && details.requested.name == 'leakcanary-android') { - details.useTarget(group: details.requested.group, name: 'leakcanary-android-no-op', version: details.requested.version) - } - } - } -} - subprojects { afterEvaluate {project -> if (project.hasProperty("android")) { android { - compileSdkVersion 30 + compileSdkVersion 31 } } } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 75b166d9..6a9de68d 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -41,6 +41,7 @@ android:theme="@style/BitmaskTheme"> @@ -48,6 +49,7 @@ @@ -62,7 +64,8 @@ + android:permission="android.permission.RECEIVE_BOOT_COMPLETED" + android:exported="true"> @@ -79,6 +82,7 @@ android:label="@string/app_name" android:launchMode="singleTop" android:theme="@style/SplashTheme" + android:exported="true" > @@ -126,6 +130,7 @@ android:icon="@drawable/vpn_disconnected" android:label="@string/qs_title" android:permission="android.permission.BIND_QUICK_SETTINGS_TILE" + android:exported="true" android:value="true"> diff --git a/app/src/main/java/se/leap/bitmaskclient/base/BitmaskApp.java b/app/src/main/java/se/leap/bitmaskclient/base/BitmaskApp.java index 3f73e49d..828ef27d 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/BitmaskApp.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/BitmaskApp.java @@ -17,6 +17,15 @@ package se.leap.bitmaskclient.base; +import static android.content.Intent.CATEGORY_DEFAULT; +import static se.leap.bitmaskclient.appUpdate.DownloadBroadcastReceiver.ACTION_DOWNLOAD; +import static se.leap.bitmaskclient.appUpdate.DownloadServiceCommand.CHECK_VERSION_FILE; +import static se.leap.bitmaskclient.appUpdate.DownloadServiceCommand.DOWNLOAD_UPDATE; +import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_DOWNLOAD_SERVICE_EVENT; +import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES; +import static se.leap.bitmaskclient.base.utils.ConfigHelper.isCalyxOSWithTetheringSupport; +import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getSavedProviderFromSharedPreferences; + import android.content.Context; import android.content.IntentFilter; import android.content.SharedPreferences; @@ -25,27 +34,14 @@ import androidx.appcompat.app.AppCompatDelegate; import androidx.localbroadcastmanager.content.LocalBroadcastManager; import androidx.multidex.MultiDexApplication; -import com.squareup.leakcanary.LeakCanary; -import com.squareup.leakcanary.RefWatcher; - import se.leap.bitmaskclient.BuildConfig; import se.leap.bitmaskclient.appUpdate.DownloadBroadcastReceiver; -import se.leap.bitmaskclient.eip.EipSetupObserver; import se.leap.bitmaskclient.base.models.ProviderObservable; -import se.leap.bitmaskclient.tethering.TetheringStateManager; import se.leap.bitmaskclient.base.utils.PRNGFixes; -import se.leap.bitmaskclient.tor.TorNotificationManager; +import se.leap.bitmaskclient.eip.EipSetupObserver; +import se.leap.bitmaskclient.tethering.TetheringStateManager; import se.leap.bitmaskclient.tor.TorStatusObservable; -import static android.content.Intent.CATEGORY_DEFAULT; -import static se.leap.bitmaskclient.base.models.Constants.BROADCAST_DOWNLOAD_SERVICE_EVENT; -import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES; -import static se.leap.bitmaskclient.appUpdate.DownloadBroadcastReceiver.ACTION_DOWNLOAD; -import static se.leap.bitmaskclient.appUpdate.DownloadServiceCommand.CHECK_VERSION_FILE; -import static se.leap.bitmaskclient.appUpdate.DownloadServiceCommand.DOWNLOAD_UPDATE; -import static se.leap.bitmaskclient.base.utils.ConfigHelper.isCalyxOSWithTetheringSupport; -import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getSavedProviderFromSharedPreferences; - /** * Created by cyberta on 24.10.17. */ @@ -53,7 +49,6 @@ import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getSavedProvider public class BitmaskApp extends MultiDexApplication { private final static String TAG = BitmaskApp.class.getSimpleName(); - private RefWatcher refWatcher; private ProviderObservable providerObservable; private DownloadBroadcastReceiver downloadBroadcastReceiver; private TorStatusObservable torStatusObservable; @@ -62,12 +57,6 @@ public class BitmaskApp extends MultiDexApplication { @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(); SharedPreferences preferences = getSharedPreferences(SHARED_PREFERENCES, MODE_PRIVATE); @@ -89,17 +78,4 @@ public class BitmaskApp extends MultiDexApplication { LocalBroadcastManager.getInstance(this.getApplicationContext()).registerReceiver(downloadBroadcastReceiver, intentFilter); } } - - /** - * 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; - } - - } diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/NavigationDrawerFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/NavigationDrawerFragment.java index c5593bf7..cdfee7b2 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/NavigationDrawerFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/NavigationDrawerFragment.java @@ -17,6 +17,20 @@ package se.leap.bitmaskclient.base.fragments; +import static android.content.Context.MODE_PRIVATE; +import static android.view.View.GONE; +import static android.view.View.VISIBLE; +import static se.leap.bitmaskclient.base.models.Constants.DONATION_URL; +import static se.leap.bitmaskclient.base.models.Constants.ENABLE_DONATION; +import static se.leap.bitmaskclient.base.models.Constants.PREFERRED_CITY; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_KEY; +import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_SWITCH_PROVIDER; +import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES; +import static se.leap.bitmaskclient.base.utils.ConfigHelper.isDefaultBitmask; +import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getPreferredCity; +import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getSaveBattery; +import static se.leap.bitmaskclient.base.utils.PreferenceHelper.saveBattery; + import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; @@ -56,21 +70,6 @@ import se.leap.bitmaskclient.eip.EipStatus; import se.leap.bitmaskclient.providersetup.ProviderListActivity; import se.leap.bitmaskclient.tethering.TetheringObservable; -import static android.content.Context.MODE_PRIVATE; -import static android.view.View.GONE; -import static android.view.View.VISIBLE; -import static se.leap.bitmaskclient.base.BitmaskApp.getRefWatcher; -import static se.leap.bitmaskclient.base.models.Constants.DONATION_URL; -import static se.leap.bitmaskclient.base.models.Constants.ENABLE_DONATION; -import static se.leap.bitmaskclient.base.models.Constants.PREFERRED_CITY; -import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_KEY; -import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_SWITCH_PROVIDER; -import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES; -import static se.leap.bitmaskclient.base.utils.ConfigHelper.isDefaultBitmask; -import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getPreferredCity; -import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getSaveBattery; -import static se.leap.bitmaskclient.base.utils.PreferenceHelper.saveBattery; - /** * Fragment used for managing interactions for and presentation of a navigation drawer. * See the @@ -433,7 +432,6 @@ public class NavigationDrawerFragment extends Fragment implements SharedPreferen @Override public void onDestroy() { super.onDestroy(); - getRefWatcher(getActivity()).watch(this); preferences.unregisterOnSharedPreferenceChangeListener(this); } diff --git a/build.gradle b/build.gradle index a995fd04..6fbe3207 100644 --- a/build.gradle +++ b/build.gradle @@ -5,11 +5,10 @@ buildscript { name 'Google' } mavenCentral() - jcenter() - google() + google() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.2' + classpath 'com.android.tools.build:gradle:7.2.2' } } @@ -24,6 +23,5 @@ allprojects { name 'Google' } mavenCentral() - jcenter() } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 5e689c00..aaa09975 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu Feb 11 23:53:25 CET 2021 +#Sun Aug 07 23:06:29 CEST 2022 distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip +zipStoreBase=GRADLE_USER_HOME diff --git a/tor-android b/tor-android index 9ff61322..4fa3a347 160000 --- a/tor-android +++ b/tor-android @@ -1 +1 @@ -Subproject commit 9ff61322e25b290cc8d5eb288974840ac2355b03 +Subproject commit 4fa3a34726544a52d8dc8a1920928830aac2172a -- cgit v1.2.3