Commit 71a97834 authored by cyberta's avatar cyberta

update sdk to version 28, update dependencies, fix potential memory leaks

parent 678024d9
......@@ -6,8 +6,8 @@ apply plugin: 'com.android.application'
def appName = 'Bitmask'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
compileSdkVersion 28
buildToolsVersion '28.0.3'
compileOptions {
targetCompatibility 1.8
......@@ -169,9 +169,9 @@ dependencies {
androidTestImplementation 'com.jayway.android.robotium:robotium-solo:5.6.3'
testImplementation 'junit:junit:4.12'
testImplementation 'org.json:json:20170516'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
betaImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
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'
annotationProcessor 'com.jakewharton:butterknife:6.1.0'
annotationProcessor 'com.squareup.dagger:dagger-compiler:1.2.2'
implementation 'com.jakewharton:butterknife:6.1.0'
......@@ -182,15 +182,15 @@ dependencies {
implementation 'com.intellij:annotations:12.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.squareup.okhttp3:okhttp:3.9.0'
implementation "com.android.support:support-core-utils:27.0.2"
implementation 'com.android.support:support-annotations:27.0.2'
implementation 'com.android.support:support-v4:27.0.2'
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:design:27.0.2'
implementation 'com.android.support:support-fragment:27.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:multidex:1.0.2'
implementation 'com.android.support:cardview-v7:27.0.2'
implementation "com.android.support:support-core-utils:28.0.0"
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-fragment:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:cardview-v7:28.0.0'
}
// Ensure the no-op dependency is always used in JVM tests.
......@@ -202,12 +202,23 @@ configurations.all { config ->
}
}
}
resolutionStrategy.force "com.android.support:support-annotations:27.0.2"
resolutionStrategy.force "com.android.support:support-v4:27.0.2"
resolutionStrategy.force "com.android.support:support-core-utils:27.0.2"
resolutionStrategy.force "com.android.support:appcompat-v7:27.0.2"
resolutionStrategy.force "com.android.support:design:27.0.2"
resolutionStrategy.force "com.android.support:support-fragment:27.0.2"
resolutionStrategy.force "com.android.support:support-annotations:28.0.0"
resolutionStrategy.force "com.android.support:support-v4:28.0.0"
resolutionStrategy.force "com.android.support:support-core-utils:28.0.0"
resolutionStrategy.force "com.android.support:appcompat-v7:28.0.0"
resolutionStrategy.force "com.android.support:design:28.0.0"
resolutionStrategy.force "com.android.support:support-fragment:28.0.0"
}
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
}
}
}
}
def processFileInplace(file, Closure processText) {
......
......@@ -19,7 +19,6 @@ public class BitmaskApp extends MultiDexApplication {
private final static String TAG = BitmaskApp.class.getSimpleName();
private RefWatcher refWatcher;
private ProviderObservable providerObservable;
private SharedPreferences preferences;
@Override
......@@ -33,7 +32,7 @@ public class BitmaskApp extends MultiDexApplication {
refWatcher = LeakCanary.install(this);
// Normal app init code...*/
PRNGFixes.apply();
preferences = getSharedPreferences(SHARED_PREFERENCES, MODE_PRIVATE);
SharedPreferences preferences = getSharedPreferences(SHARED_PREFERENCES, MODE_PRIVATE);
providerObservable = ProviderObservable.getInstance();
providerObservable.updateProvider(getSavedProviderFromSharedPreferences(preferences));
EipSetupObserver.init(this, preferences);
......
......@@ -33,6 +33,8 @@ public interface Constants {
String DEFAULT_BITMASK = "normal";
String CUSTOM_BITMASK = "custom";
String ASK_TO_CANCEL_VPN = "ask_to_cancel_vpn";
//////////////////////////////////////////////
// EIP CONSTANTS
......
......@@ -19,7 +19,6 @@ package se.leap.bitmaskclient;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
......@@ -67,6 +66,7 @@ import static se.leap.bitmaskclient.Constants.PROVIDER_KEY;
import static se.leap.bitmaskclient.Constants.REQUEST_CODE_CONFIGURE_LEAP;
import static se.leap.bitmaskclient.Constants.REQUEST_CODE_LOG_IN;
import static se.leap.bitmaskclient.Constants.REQUEST_CODE_SWITCH_PROVIDER;
import static se.leap.bitmaskclient.Constants.ASK_TO_CANCEL_VPN;
import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES;
import static se.leap.bitmaskclient.EipSetupObserver.connectionRetry;
import static se.leap.bitmaskclient.EipSetupObserver.gatewayOrder;
......@@ -81,7 +81,6 @@ public class EipFragment extends Fragment implements Observer {
public final static String TAG = EipFragment.class.getSimpleName();
public static final String ASK_TO_CANCEL_VPN = "ask_to_cancel_vpn";
private SharedPreferences preferences;
private Provider provider;
......@@ -106,8 +105,8 @@ public class EipFragment extends Fragment implements Observer {
private EipStatus eipStatus;
//---saved Instance -------
private final static String KEY_SHOW_PENDING_START_CANCELLATION = "KEY_SHOW_PENDING_START_CANCELLATION";
private final static String KEY_SHOW_ASK_TO_STOP_EIP = "KEY_SHOW_ASK_TO_STOP_EIP";
private final String KEY_SHOW_PENDING_START_CANCELLATION = "KEY_SHOW_PENDING_START_CANCELLATION";
private final String KEY_SHOW_ASK_TO_STOP_EIP = "KEY_SHOW_ASK_TO_STOP_EIP";
private boolean showPendingStartCancellation = false;
private boolean showAskToStopEip = false;
//------------------------
......@@ -324,22 +323,9 @@ public class EipFragment extends Fragment implements Observer {
showPendingStartCancellation = true;
alertDialog = alertBuilder.setTitle(activity.getString(R.string.eip_cancel_connect_title))
.setMessage(activity.getString(R.string.eip_cancel_connect_text))
.setPositiveButton((android.R.string.yes), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
stopEipIfPossible();
}
})
.setNegativeButton(activity.getString(android.R.string.no), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
}).setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
showPendingStartCancellation = false;
}
}).show();
.setPositiveButton((android.R.string.yes), (dialog, which) -> stopEipIfPossible())
.setNegativeButton(activity.getString(android.R.string.no), (dialog, which) -> {
}).setOnDismissListener(dialog -> showPendingStartCancellation = false).show();
}
......@@ -353,22 +339,9 @@ public class EipFragment extends Fragment implements Observer {
showAskToStopEip = true;
alertDialog = alertBuilder.setTitle(activity.getString(R.string.eip_cancel_connect_title))
.setMessage(activity.getString(R.string.eip_warning_browser_inconsistency))
.setPositiveButton((android.R.string.yes), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
stopEipIfPossible();
}
})
.setNegativeButton(activity.getString(android.R.string.no), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
}).setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
showAskToStopEip = false;
}
}).show();
.setPositiveButton((android.R.string.yes), (dialog, which) -> stopEipIfPossible())
.setNegativeButton(activity.getString(android.R.string.no), (dialog, which) -> {
}).setOnDismissListener(dialog -> showAskToStopEip = false).show();
}
@Override
......@@ -377,12 +350,7 @@ public class EipFragment extends Fragment implements Observer {
eipStatus = (EipStatus) observable;
Activity activity = getActivity();
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
handleNewState();
}
});
activity.runOnUiThread(() -> handleNewState());
} else {
Log.e("EipFragment", "activity is null");
}
......
......@@ -38,6 +38,7 @@ import se.leap.bitmaskclient.drawer.NavigationDrawerFragment;
import se.leap.bitmaskclient.eip.EipCommand;
import se.leap.bitmaskclient.fragments.LogFragment;
import static se.leap.bitmaskclient.Constants.ASK_TO_CANCEL_VPN;
import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_CODE;
import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_KEY;
import static se.leap.bitmaskclient.Constants.EIP_ACTION_START;
......@@ -47,7 +48,6 @@ import static se.leap.bitmaskclient.Constants.REQUEST_CODE_CONFIGURE_LEAP;
import static se.leap.bitmaskclient.Constants.REQUEST_CODE_LOG_IN;
import static se.leap.bitmaskclient.Constants.REQUEST_CODE_SWITCH_PROVIDER;
import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES;
import static se.leap.bitmaskclient.EipFragment.ASK_TO_CANCEL_VPN;
import static se.leap.bitmaskclient.ProviderAPI.ERRORS;
import static se.leap.bitmaskclient.ProviderAPI.INCORRECTLY_DOWNLOADED_EIP_SERVICE;
import static se.leap.bitmaskclient.ProviderAPI.INCORRECTLY_UPDATED_INVALID_VPN_CERTIFICATE;
......
......@@ -44,7 +44,7 @@ import static android.text.TextUtils.isEmpty;
import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_NONETWORK;
import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_WAITING_FOR_USER_INPUT;
import static se.leap.bitmaskclient.Constants.EIP_ACTION_STOP_BLOCKING_VPN;
import static se.leap.bitmaskclient.EipFragment.ASK_TO_CANCEL_VPN;
import static se.leap.bitmaskclient.Constants.ASK_TO_CANCEL_VPN;
import static se.leap.bitmaskclient.MainActivity.ACTION_SHOW_VPN_FRAGMENT;
/**
......
......@@ -382,31 +382,18 @@ public class NavigationDrawerFragment extends Fragment {
alertDialog = alertBuilder
.setTitle(activity.getString(R.string.save_battery))
.setMessage(activity.getString(R.string.save_battery_message))
.setPositiveButton((android.R.string.yes), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
DrawerSettingsItem item = settingsListAdapter.getDrawerItem(BATTERY_SAVER);
item.setChecked(true);
settingsListAdapter.notifyDataSetChanged();
saveBattery(getContext(), item.isChecked());
}
.setPositiveButton((android.R.string.yes), (dialog, which) -> {
DrawerSettingsItem item = settingsListAdapter.getDrawerItem(BATTERY_SAVER);
item.setChecked(true);
settingsListAdapter.notifyDataSetChanged();
saveBattery(getContext(), item.isChecked());
})
.setNegativeButton(activity.getString(android.R.string.no), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
disableSwitch(BATTERY_SAVER);
}
}).setOnDismissListener(new DialogInterface.OnDismissListener() {
.setNegativeButton(activity.getString(android.R.string.no), (dialog, which) -> disableSwitch(BATTERY_SAVER)).setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
showEnableExperimentalFeature = false;
}
}).setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
disableSwitch(BATTERY_SAVER);
}
}).show();
}).setOnCancelListener(dialog -> disableSwitch(BATTERY_SAVER)).show();
} catch (IllegalStateException e) {
e.printStackTrace();
}
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="foo">
<attr name="textColorError" format="color" />
</declare-styleable>
</resources>
\ No newline at end of file
......@@ -21,4 +21,8 @@
<item name="android:windowBackground">@drawable/splash_page</item>
</style>
<style name="foo">
<item name="textColorError">@color/colorPrimary</item>
</style>
</resources>
FROM 0xacab.org:4567/leap/docker/debian:stretch_amd64
MAINTAINER LEAP Encryption Access Project <info@leap.se>
LABEL Description="Android SDK baseimage based on debian:stretch" Vendor="LEAP" Version="26.0.0"
LABEL Description="Android SDK baseimage based on debian:stretch" Vendor="LEAP" Version="27.0.0"
# ------------------------------------------------------
# --- Install System Dependencies
......@@ -59,11 +59,13 @@ RUN echo y | sdkmanager "platform-tools" # echo y to accept google licenses
RUN sdkmanager "extras;android;m2repository"
# Install Build Tools (Please keep in descending order)
RUN sdkmanager "build-tools;28.0.3"
RUN sdkmanager "build-tools;27.0.3"
RUN sdkmanager "build-tools;25.0.2"
RUN sdkmanager "build-tools;23.0.3"
# Install Target SDK Packages (Please keep in descending order)
RUN sdkmanager "platforms;android-28"
RUN sdkmanager "platforms;android-27"
RUN sdkmanager "platforms;android-25"
RUN sdkmanager "platforms;android-23"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment