summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/build.gradle5
-rw-r--r--app/src/androidTest/java/se/leap/bitmaskclient/test/TestGatewaysManager.java4
-rw-r--r--app/src/insecure/java/se/leap/bitmaskclient/ProviderAPI.java10
-rw-r--r--app/src/insecure/java/se/leap/bitmaskclient/ProviderDetailFragment.java8
-rw-r--r--app/src/main/AndroidManifest.xml8
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/BaseConfigurationWizard.java8
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/Constants.java6
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/Dashboard.java41
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/LeapSRPSession.java3
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/OnBootReceiver.java7
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/ProviderApiBase.java8
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/StartActivity.java115
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/VpnFragment.java33
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/Constants.java44
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/EIP.java4
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/EIPConstants.java44
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java4
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnLauncher.java2
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java2
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java4
-rw-r--r--app/src/main/res/drawable-hdpi/splash_background.pngbin0 -> 66619 bytes
-rw-r--r--app/src/main/res/drawable-land-hdpi/splash_background.pngbin0 -> 68637 bytes
-rw-r--r--app/src/main/res/drawable-land-ldpi/splash_background.pngbin0 -> 43127 bytes
-rw-r--r--app/src/main/res/drawable-land-mdpi/splash_background.pngbin0 -> 33924 bytes
-rw-r--r--app/src/main/res/drawable-land-xxxhdpi/splash_background.pngbin0 -> 182692 bytes
-rw-r--r--app/src/main/res/drawable-ldpi/mask.pngbin0 -> 8743 bytes
-rw-r--r--app/src/main/res/drawable-ldpi/splash_background.pngbin0 -> 41839 bytes
-rw-r--r--app/src/main/res/drawable-mdpi/mask.pngbin0 -> 6324 bytes
-rw-r--r--app/src/main/res/drawable-mdpi/splash_background.pngbin0 -> 32718 bytes
-rw-r--r--app/src/main/res/drawable-xxxhdpi/mask.pngbin0 -> 43251 bytes
-rw-r--r--app/src/main/res/drawable-xxxhdpi/splash_background.pngbin0 -> 187062 bytes
-rw-r--r--app/src/main/res/drawable/splash_page.xml10
-rw-r--r--app/src/main/res/values/attrs.xml8
-rw-r--r--app/src/main/res/values/colors.xml5
-rw-r--r--app/src/main/res/values/themes.xml12
-rw-r--r--app/src/production/java/se/leap/bitmaskclient/ProviderAPI.java10
-rw-r--r--app/src/production/java/se/leap/bitmaskclient/ProviderDetailFragment.java10
-rw-r--r--app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java4
38 files changed, 272 insertions, 147 deletions
diff --git a/app/build.gradle b/app/build.gradle
index cdeccb6c..b9db8cd6 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -75,8 +75,9 @@ dependencies {
compile 'org.thoughtcrime.ssl.pinning:AndroidPinning:1.0.0'
compile 'com.squareup.okhttp3:okhttp:3.9.0'
compile 'mbanje.kurt:fabbutton:1.1.4'
- compile 'com.android.support:support-annotations:25.3.1'
- compile 'com.android.support:support-v4:26.0.0-alpha1'
+ compile 'com.android.support:support-annotations:27.0.1'
+ compile 'com.android.support:support-v4:26.1.0'
+ compile 'com.android.support:appcompat-v7:26.1.0'
}
def processFileInplace(file, Closure processText) {
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestGatewaysManager.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/TestGatewaysManager.java
index 0a76638f..b8cc9715 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestGatewaysManager.java
+++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/TestGatewaysManager.java
@@ -25,7 +25,7 @@ import org.json.*;
import java.io.IOException;
import java.util.Arrays;
-import se.leap.bitmaskclient.*;
+import se.leap.bitmaskclient.Constants;
import se.leap.bitmaskclient.eip.*;
/**
@@ -109,7 +109,7 @@ public class TestGatewaysManager extends InstrumentationTestCase {
private void mockGatewaysManager() {
context = getInstrumentation().getContext();
- preferences = context.getSharedPreferences(Dashboard.SHARED_PREFERENCES, Activity.MODE_PRIVATE);
+ preferences = context.getSharedPreferences(Constants.SHARED_PREFERENCES, Activity.MODE_PRIVATE);
gateways_manager = new GatewaysManager(context, preferences);
}
diff --git a/app/src/insecure/java/se/leap/bitmaskclient/ProviderAPI.java b/app/src/insecure/java/se/leap/bitmaskclient/ProviderAPI.java
index 87fff283..fd6d4b79 100644
--- a/app/src/insecure/java/se/leap/bitmaskclient/ProviderAPI.java
+++ b/app/src/insecure/java/se/leap/bitmaskclient/ProviderAPI.java
@@ -45,7 +45,7 @@ import javax.net.ssl.X509TrustManager;
import okhttp3.OkHttpClient;
import se.leap.bitmaskclient.ProviderListContent.ProviderItem;
-import se.leap.bitmaskclient.eip.Constants;
+import se.leap.bitmaskclient.eip.EIPConstants;
import se.leap.bitmaskclient.eip.EIP;
import static se.leap.bitmaskclient.R.string.certificate_error;
@@ -138,8 +138,8 @@ public class ProviderAPI extends ProviderApiBase {
//TODO setProviderName(name);
preferences.edit().putString(Provider.KEY, provider_json.toString()).commit();
- preferences.edit().putBoolean(Constants.ALLOWED_ANON, provider_json.getJSONObject(Provider.SERVICE).getBoolean(Constants.ALLOWED_ANON)).commit();
- preferences.edit().putBoolean(Constants.ALLOWED_REGISTERED, provider_json.getJSONObject(Provider.SERVICE).getBoolean(Constants.ALLOWED_REGISTERED)).commit();
+ preferences.edit().putBoolean(EIPConstants.ALLOWED_ANON, provider_json.getJSONObject(Provider.SERVICE).getBoolean(EIPConstants.ALLOWED_ANON)).commit();
+ preferences.edit().putBoolean(EIPConstants.ALLOWED_REGISTERED, provider_json.getJSONObject(Provider.SERVICE).getBoolean(EIPConstants.ALLOWED_REGISTERED)).commit();
result.putBoolean(RESULT_KEY, true);
} catch (JSONException e) {
@@ -168,7 +168,7 @@ public class ProviderAPI extends ProviderApiBase {
JSONObject eip_service_json = new JSONObject(eip_service_json_string);
eip_service_json.getInt(Provider.API_RETURN_SERIAL);
- preferences.edit().putString(Constants.KEY, eip_service_json.toString()).commit();
+ preferences.edit().putString(EIPConstants.KEY, eip_service_json.toString()).commit();
result.putBoolean(RESULT_KEY, true);
} catch (NullPointerException | JSONException e) {
@@ -191,7 +191,7 @@ public class ProviderAPI extends ProviderApiBase {
JSONObject provider_json = new JSONObject(preferences.getString(Provider.KEY, ""));
String provider_main_url = provider_json.getString(Provider.API_URL);
- URL new_cert_string_url = new URL(provider_main_url + "/" + provider_json.getString(Provider.API_VERSION) + "/" + Constants.VPN_CERTIFICATE);
+ URL new_cert_string_url = new URL(provider_main_url + "/" + provider_json.getString(Provider.API_VERSION) + "/" + EIPConstants.VPN_CERTIFICATE);
String cert_string = downloadWithProviderCA(new_cert_string_url.toString(), last_danger_on);
diff --git a/app/src/insecure/java/se/leap/bitmaskclient/ProviderDetailFragment.java b/app/src/insecure/java/se/leap/bitmaskclient/ProviderDetailFragment.java
index 629867e6..9c401da4 100644
--- a/app/src/insecure/java/se/leap/bitmaskclient/ProviderDetailFragment.java
+++ b/app/src/insecure/java/se/leap/bitmaskclient/ProviderDetailFragment.java
@@ -23,7 +23,7 @@ public class ProviderDetailFragment extends DialogFragment {
LayoutInflater inflater = getActivity().getLayoutInflater();
View provider_detail_view = inflater.inflate(R.layout.provider_detail_fragment, null);
- JSONObject provider_json = new JSONObject(getActivity().getSharedPreferences(Dashboard.SHARED_PREFERENCES, getActivity().MODE_PRIVATE).getString(Provider.KEY, ""));
+ JSONObject provider_json = new JSONObject(getActivity().getSharedPreferences(Constants.SHARED_PREFERENCES, getActivity().MODE_PRIVATE).getString(Provider.KEY, ""));
final TextView domain = (TextView) provider_detail_view.findViewById(R.id.provider_detail_domain);
domain.setText(provider_json.getString(Provider.DOMAIN));
@@ -60,7 +60,7 @@ public class ProviderDetailFragment extends DialogFragment {
private boolean anon_allowed(JSONObject provider_json) {
try {
JSONObject service_description = provider_json.getJSONObject(Provider.SERVICE);
- return service_description.has(Constants.ALLOWED_ANON) && service_description.getBoolean(Constants.ALLOWED_ANON);
+ return service_description.has(EIPConstants.ALLOWED_ANON) && service_description.getBoolean(EIPConstants.ALLOWED_ANON);
} catch (JSONException e) {
return false;
}
@@ -78,8 +78,8 @@ public class ProviderDetailFragment extends DialogFragment {
@Override
public void onCancel(DialogInterface dialog) {
super.onCancel(dialog);
- SharedPreferences.Editor editor = getActivity().getSharedPreferences(Dashboard.SHARED_PREFERENCES, Activity.MODE_PRIVATE).edit();
- editor.remove(Provider.KEY).remove(ProviderItem.DANGER_ON).remove(Constants.ALLOWED_ANON).remove(Constants.KEY).commit();
+ SharedPreferences.Editor editor = getActivity().getSharedPreferences(Constants.SHARED_PREFERENCES, Activity.MODE_PRIVATE).edit();
+ editor.remove(Provider.KEY).remove(ProviderItem.DANGER_ON).remove(EIPConstants.ALLOWED_ANON).remove(EIPConstants.KEY).commit();
interface_with_configuration_wizard.cancelAndShowAllProviders();
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 8c6b25d5..16168e0f 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -88,6 +88,14 @@
android:uiOptions="splitActionBarWhenNarrow"
android:launchMode="singleTop"
>
+ </activity>
+ <activity
+ android:name="se.leap.bitmaskclient.StartActivity"
+ android:label="@string/app_name"
+ android:launchMode="singleTop"
+ android:noHistory="true"
+ android:theme="@style/SplashTheme"
+ >
<intent-filter android:label="@string/app_name">
<action android:name="android.intent.action.MAIN" />
diff --git a/app/src/main/java/se/leap/bitmaskclient/BaseConfigurationWizard.java b/app/src/main/java/se/leap/bitmaskclient/BaseConfigurationWizard.java
index 4f6163bc..5dae1227 100644
--- a/app/src/main/java/se/leap/bitmaskclient/BaseConfigurationWizard.java
+++ b/app/src/main/java/se/leap/bitmaskclient/BaseConfigurationWizard.java
@@ -51,7 +51,7 @@ import javax.inject.Inject;
import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnItemClick;
-import se.leap.bitmaskclient.eip.Constants;
+import se.leap.bitmaskclient.eip.EIPConstants;
import se.leap.bitmaskclient.userstatus.SessionDialog;
import static android.view.View.GONE;
@@ -134,7 +134,7 @@ public abstract class BaseConfigurationWizard extends Activity
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- preferences = getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE);
+ preferences = getSharedPreferences(Constants.SHARED_PREFERENCES, MODE_PRIVATE);
fragment_manager = new FragmentManagerEnhanced(getFragmentManager());
provider_manager = ProviderManager.getInstance(getAssets(), getExternalFilesDir(null));
@@ -220,7 +220,7 @@ public abstract class BaseConfigurationWizard extends Activity
e.printStackTrace();
}
- if (preferences.getBoolean(Constants.ALLOWED_ANON, false)) {
+ if (preferences.getBoolean(EIPConstants.ALLOWED_ANON, false)) {
mConfigState.putExtra(SERVICES_RETRIEVED, true);
downloadVpnCertificate();
@@ -297,7 +297,7 @@ public abstract class BaseConfigurationWizard extends Activity
public void cancelSettingUpProvider() {
mConfigState.setAction(PROVIDER_NOT_SET);
adapter.showAllProviders();
- preferences.edit().remove(Provider.KEY).remove(Constants.ALLOWED_ANON).remove(Constants.KEY).apply();
+ preferences.edit().remove(Provider.KEY).remove(EIPConstants.ALLOWED_ANON).remove(EIPConstants.KEY).apply();
}
private void askDashboardToQuitApp() {
diff --git a/app/src/main/java/se/leap/bitmaskclient/Constants.java b/app/src/main/java/se/leap/bitmaskclient/Constants.java
new file mode 100644
index 00000000..4ce09892
--- /dev/null
+++ b/app/src/main/java/se/leap/bitmaskclient/Constants.java
@@ -0,0 +1,6 @@
+package se.leap.bitmaskclient;
+
+public interface Constants {
+ String SHARED_PREFERENCES = "LEAPPreferences";
+ String PREFERENCES_APP_VERSION = "bitmask version";
+}
diff --git a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
index 3f1663d0..e2366551 100644
--- a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
+++ b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
@@ -1,20 +1,4 @@
-/**
- * Copyright (c) 2013 LEAP Encryption Access Project and contributers
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-/**
+/*
* Copyright (c) 2013 LEAP Encryption Access Project and contributers
*
* This program is free software: you can redistribute it and/or modify
@@ -57,8 +41,7 @@ import java.net.URL;
import butterknife.ButterKnife;
import butterknife.InjectView;
-import de.blinkt.openvpn.core.VpnStatus;
-import se.leap.bitmaskclient.eip.Constants;
+import se.leap.bitmaskclient.eip.EIPConstants;
import se.leap.bitmaskclient.userstatus.SessionDialog;
import se.leap.bitmaskclient.userstatus.User;
import se.leap.bitmaskclient.userstatus.UserStatusFragment;
@@ -76,7 +59,6 @@ public class Dashboard extends Activity implements ProviderAPIResultReceiver.Rec
protected static final int SWITCH_PROVIDER = 1;
public static final String TAG = Dashboard.class.getSimpleName();
- public static final String SHARED_PREFERENCES = "LEAPPreferences";
public static final String ACTION_QUIT = "quit";
public static final String ACTION_ASK_TO_CANCEL_VPN = "ask to cancel vpn";
public static final String REQUEST_CODE = "request_code";
@@ -84,7 +66,6 @@ public class Dashboard extends Activity implements ProviderAPIResultReceiver.Rec
public static final String START_ON_BOOT = "dashboard start on boot";
//FIXME: remove OR FIX ON_BOOT
public static final String ON_BOOT = "dashboard on boot";
- public static final String APP_VERSION = "bitmask version";
private static Context app;
protected static SharedPreferences preferences;
@@ -102,18 +83,14 @@ public class Dashboard extends Activity implements ProviderAPIResultReceiver.Rec
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- preferences = getSharedPreferences(SHARED_PREFERENCES, MODE_PRIVATE);
+ preferences = getSharedPreferences(Constants.SHARED_PREFERENCES, MODE_PRIVATE);
fragment_manager = new FragmentManagerEnhanced(getFragmentManager());
- ProviderAPICommand.initialize(this);
providerAPI_result_receiver = new ProviderAPIResultReceiver(new Handler(), this);
if (app == null) {
app = this;
-
- VpnStatus.initLogCache(getApplicationContext().getCacheDir());
handleVersion();
- User.init(getString(R.string.default_username));
}
boolean provider_exists = previousProviderExists(savedInstanceState);
if (provider_exists) {
@@ -154,7 +131,7 @@ public class Dashboard extends Activity implements ProviderAPIResultReceiver.Rec
private boolean providerInSharedPreferences() {
return preferences != null &&
- preferences.getBoolean(Constants.PROVIDER_CONFIGURED, false);
+ preferences.getBoolean(EIPConstants.PROVIDER_CONFIGURED, false);
}
@@ -179,13 +156,11 @@ public class Dashboard extends Activity implements ProviderAPIResultReceiver.Rec
private void handleVersion() {
try {
int versionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
- int lastDetectedVersion = preferences.getInt(APP_VERSION, 0);
- preferences.edit().putInt(APP_VERSION, versionCode).apply();
switch (versionCode) {
case 91: // 0.6.0 without Bug #5999
case 101: // 0.8.0
- if (!preferences.getString(Constants.KEY, "").isEmpty())
+ if (!preferences.getString(EIPConstants.KEY, "").isEmpty())
eip_fragment.updateEipService();
break;
}
@@ -230,7 +205,7 @@ public class Dashboard extends Activity implements ProviderAPIResultReceiver.Rec
@SuppressLint("CommitPrefEdits")
private void providerToPreferences(Provider provider) {
- preferences.edit().putBoolean(Constants.PROVIDER_CONFIGURED, true).commit();
+ preferences.edit().putBoolean(EIPConstants.PROVIDER_CONFIGURED, true).commit();
preferences.edit().putString(Provider.MAIN_URL, provider.mainUrl().toString()).apply();
preferences.edit().putString(Provider.KEY, provider.definition().toString()).apply();
}
@@ -250,7 +225,7 @@ public class Dashboard extends Activity implements ProviderAPIResultReceiver.Rec
.setNegativeButton(getResources().getString(R.string.setup_error_close_button), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
- preferences.edit().remove(Provider.KEY).remove(Constants.PROVIDER_CONFIGURED).apply();
+ preferences.edit().remove(Provider.KEY).remove(EIPConstants.PROVIDER_CONFIGURED).apply();
finish();
}
})
@@ -341,7 +316,7 @@ public class Dashboard extends Activity implements ProviderAPIResultReceiver.Rec
public void downloadVpnCertificate() {
boolean is_authenticated = User.loggedIn();
- boolean allowed_anon = preferences.getBoolean(Constants.ALLOWED_ANON, false);
+ boolean allowed_anon = preferences.getBoolean(EIPConstants.ALLOWED_ANON, false);
if (allowed_anon || is_authenticated)
ProviderAPICommand.execute(Bundle.EMPTY, ProviderAPI.DOWNLOAD_CERTIFICATE, providerAPI_result_receiver);
else
diff --git a/app/src/main/java/se/leap/bitmaskclient/LeapSRPSession.java b/app/src/main/java/se/leap/bitmaskclient/LeapSRPSession.java
index 49cf3774..3a1fd6e0 100644
--- a/app/src/main/java/se/leap/bitmaskclient/LeapSRPSession.java
+++ b/app/src/main/java/se/leap/bitmaskclient/LeapSRPSession.java
@@ -72,7 +72,6 @@ public class LeapSRPSession {
*
* @param username, the user ID
* @param password, the user clear text password
- * @param params, the SRP parameters for the session
*/
public LeapSRPSession(String username, String password) {
this(username, password, null);
@@ -84,7 +83,6 @@ public class LeapSRPSession {
*
* @param username, the user ID
* @param password, the user clear text password
- * @param params, the SRP parameters for the session
* @param abytes, the random exponent used in the A public key
*/
public LeapSRPSession(String username, String password, byte[] abytes) {
@@ -187,7 +185,6 @@ public class LeapSRPSession {
*
* @param b1 the positive source to build first BigInteger
* @param b2 the positive source to build second BigInteger
- * @param length
* @return
*/
public byte[] xor(byte[] b1, byte[] b2) {
diff --git a/app/src/main/java/se/leap/bitmaskclient/OnBootReceiver.java b/app/src/main/java/se/leap/bitmaskclient/OnBootReceiver.java
index 9171e816..a72a8809 100644
--- a/app/src/main/java/se/leap/bitmaskclient/OnBootReceiver.java
+++ b/app/src/main/java/se/leap/bitmaskclient/OnBootReceiver.java
@@ -2,7 +2,8 @@ package se.leap.bitmaskclient;
import android.content.*;
-import se.leap.bitmaskclient.eip.*;
+import se.leap.bitmaskclient.eip.EIPConstants;
+
public class OnBootReceiver extends BroadcastReceiver {
@@ -11,12 +12,12 @@ public class OnBootReceiver extends BroadcastReceiver {
// Debug: am broadcast -a android.intent.action.BOOT_COMPLETED
@Override
public void onReceive(Context context, Intent intent) {
- preferences = context.getSharedPreferences(Dashboard.SHARED_PREFERENCES, Context.MODE_PRIVATE);
+ preferences = context.getSharedPreferences(Constants.SHARED_PREFERENCES, Context.MODE_PRIVATE);
boolean provider_configured = !preferences.getString(Provider.KEY, "").isEmpty();
boolean start_on_boot = preferences.getBoolean(Dashboard.START_ON_BOOT, false);
if (provider_configured && start_on_boot) {
Intent dashboard_intent = new Intent(context, Dashboard.class);
- dashboard_intent.setAction(Constants.ACTION_START_EIP);
+ dashboard_intent.setAction(EIPConstants.ACTION_START_EIP);
dashboard_intent.putExtra(Dashboard.ON_BOOT, true);
dashboard_intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(dashboard_intent);
diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderApiBase.java b/app/src/main/java/se/leap/bitmaskclient/ProviderApiBase.java
index acac607c..81852983 100644
--- a/app/src/main/java/se/leap/bitmaskclient/ProviderApiBase.java
+++ b/app/src/main/java/se/leap/bitmaskclient/ProviderApiBase.java
@@ -67,7 +67,7 @@ import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.TlsVersion;
-import se.leap.bitmaskclient.eip.Constants;
+import se.leap.bitmaskclient.eip.EIPConstants;
import se.leap.bitmaskclient.userstatus.SessionDialog;
import se.leap.bitmaskclient.userstatus.User;
import se.leap.bitmaskclient.userstatus.UserStatus;
@@ -151,7 +151,7 @@ public abstract class ProviderApiBase extends IntentService {
public void onCreate() {
super.onCreate();
- preferences = getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE);
+ preferences = getSharedPreferences(Constants.SHARED_PREFERENCES, MODE_PRIVATE);
resources = getResources();
}
@@ -817,11 +817,11 @@ public abstract class ProviderApiBase extends IntentService {
RSAPrivateKey key = ConfigHelper.parseRsaKeyFromString(keyString);
keyString = Base64.encodeToString(key.getEncoded(), Base64.DEFAULT);
- preferences.edit().putString(Constants.PRIVATE_KEY, "-----BEGIN RSA PRIVATE KEY-----\n" + keyString + "-----END RSA PRIVATE KEY-----").commit();
+ preferences.edit().putString(EIPConstants.PRIVATE_KEY, "-----BEGIN RSA PRIVATE KEY-----\n" + keyString + "-----END RSA PRIVATE KEY-----").commit();
X509Certificate certificate = ConfigHelper.parseX509CertificateFromString(certificateString);
certificateString = Base64.encodeToString(certificate.getEncoded(), Base64.DEFAULT);
- preferences.edit().putString(Constants.VPN_CERTIFICATE, "-----BEGIN CERTIFICATE-----\n" + certificateString + "-----END CERTIFICATE-----").commit();
+ preferences.edit().putString(EIPConstants.VPN_CERTIFICATE, "-----BEGIN CERTIFICATE-----\n" + certificateString + "-----END CERTIFICATE-----").commit();
return true;
} catch (CertificateException e) {
// TODO Auto-generated catch block
diff --git a/app/src/main/java/se/leap/bitmaskclient/StartActivity.java b/app/src/main/java/se/leap/bitmaskclient/StartActivity.java
new file mode 100644
index 00000000..410daf7d
--- /dev/null
+++ b/app/src/main/java/se/leap/bitmaskclient/StartActivity.java
@@ -0,0 +1,115 @@
+package se.leap.bitmaskclient;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.content.pm.PackageManager;
+import android.os.Bundle;
+import android.support.annotation.IntDef;
+import android.support.annotation.Nullable;
+import android.util.Log;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import de.blinkt.openvpn.core.VpnStatus;
+import se.leap.bitmaskclient.userstatus.User;
+
+/**
+ * Activity shown at startup. Evaluates if App is started for the first time or has been upgraded
+ * and acts and calls another activity accordingly.
+ *
+ */
+public class StartActivity extends Activity {
+ public static final String TAG = Dashboard.class.getSimpleName();
+
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef({FIRST, NORMAL, UPGRADE, DOWNGRADE})
+ private @interface StartupMode {}
+ private static final int FIRST = 0;
+ private static final int NORMAL = 1;
+ private static final int UPGRADE = 2;
+ private static final int DOWNGRADE = 3;
+
+ /**
+ * check if normal start, first run, up or downgrade
+ * @return @StartupMode
+ */
+ @StartupMode
+ private int checkAppStart() {
+ SharedPreferences preferences = getSharedPreferences(Constants.SHARED_PREFERENCES, MODE_PRIVATE);
+ try {
+ int versionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
+ int lastDetectedVersion = preferences.getInt(Constants.PREFERENCES_APP_VERSION, -1);
+
+ // versions do match -> normal start
+ if (versionCode == lastDetectedVersion) {
+ Log.d(TAG, "App start was: NORMAL START");
+ return NORMAL;
+ }
+
+ // something changed -> save current version
+ preferences.edit().putInt(Constants.PREFERENCES_APP_VERSION, versionCode).apply();
+
+ // no previous app version -> first start
+ if (lastDetectedVersion == -1 ) {
+ Log.d(TAG, "App start was: FIRST START");
+ return FIRST;
+ }
+
+ // version has increased -> upgrade
+ if (versionCode > lastDetectedVersion) {
+ Log.d(TAG, "App start was: UPGRADE");
+ return UPGRADE;
+ }
+ // version has decreased -> downgrade
+ if (versionCode < lastDetectedVersion) {
+ Log.d(TAG, "App start was: DOWNGRADE");
+ return DOWNGRADE;
+ }
+
+ } catch (PackageManager.NameNotFoundException e) {
+ Log.d(TAG, "Splash screen didn't find any " + getPackageName() + " package");
+ }
+
+ return NORMAL;
+ }
+
+
+ @Override
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ Intent intent;
+
+ Log.d(TAG, "Started");
+
+ switch (checkAppStart()) {
+ case NORMAL:
+ break;
+
+ case FIRST:
+ // TODO start ProfileCreation & replace below code
+ intent = new Intent(this, Dashboard.class);
+ startActivity(intent);
+ break;
+
+ case UPGRADE:
+ // TODO appropriate data copying
+ // TODO show donation dialog
+ break;
+
+ case DOWNGRADE:
+ // TODO think how and why this should happen and what todo
+ break;
+ }
+
+ // initialize app necessities
+ ProviderAPICommand.initialize(this);
+ VpnStatus.initLogCache(getApplicationContext().getCacheDir());
+ User.init(getString(R.string.default_username));
+
+ // go to Dashboard
+ intent = new Intent(this, Dashboard.class);
+ startActivity(intent);
+ }
+}
diff --git a/app/src/main/java/se/leap/bitmaskclient/VpnFragment.java b/app/src/main/java/se/leap/bitmaskclient/VpnFragment.java
index c85b0151..eff02193 100644
--- a/app/src/main/java/se/leap/bitmaskclient/VpnFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/VpnFragment.java
@@ -33,7 +33,10 @@ import de.blinkt.openvpn.core.OpenVPNService;
import de.blinkt.openvpn.core.ProfileManager;
import de.blinkt.openvpn.core.VpnStatus;
import mbanje.kurt.fabbutton.*;
-import se.leap.bitmaskclient.eip.*;
+import se.leap.bitmaskclient.eip.EIPConstants;
+import se.leap.bitmaskclient.eip.EIP;
+import se.leap.bitmaskclient.eip.EipStatus;
+import se.leap.bitmaskclient.eip.VoidVpnService;
public class VpnFragment extends Fragment implements Observer {
@@ -112,7 +115,7 @@ public class VpnFragment extends Fragment implements Observer {
public void onResume() {
super.onResume();
//FIXME: avoid race conditions while checking certificate an logging in at about the same time
- //eipCommand(Constants.ACTION_CHECK_CERT_VALIDITY);
+ //eipCommand(EIPConstants.ACTION_CHECK_CERT_VALIDITY);
handleNewState(eip_status);
bindOpenVpnService();
}
@@ -161,13 +164,13 @@ public class VpnFragment extends Fragment implements Observer {
}
private boolean canStartEIP() {
- boolean certificateExists = !Dashboard.preferences.getString(Constants.VPN_CERTIFICATE, "").isEmpty();
- boolean isAllowedAnon = Dashboard.preferences.getBoolean(Constants.ALLOWED_ANON, false);
+ boolean certificateExists = !Dashboard.preferences.getString(EIPConstants.VPN_CERTIFICATE, "").isEmpty();
+ boolean isAllowedAnon = Dashboard.preferences.getBoolean(EIPConstants.ALLOWED_ANON, false);
return (isAllowedAnon || certificateExists) && !eip_status.isConnected() && !eip_status.isConnecting();
}
private boolean canLogInToStartEIP() {
- boolean isAllowedRegistered = Dashboard.preferences.getBoolean(Constants.ALLOWED_REGISTERED, false);
+ boolean isAllowedRegistered = Dashboard.preferences.getBoolean(EIPConstants.ALLOWED_REGISTERED, false);
boolean isLoggedIn = !LeapSRPSession.getToken().isEmpty();
return isAllowedRegistered && !isLoggedIn && !eip_status.isConnecting() && !eip_status.isConnected();
}
@@ -204,7 +207,7 @@ public class VpnFragment extends Fragment implements Observer {
eip_status.setConnecting();
saveStatus();
- eipCommand(Constants.ACTION_START_EIP);
+ eipCommand(EIPConstants.ACTION_START_EIP);
}
private void stop() {
@@ -227,7 +230,7 @@ public class VpnFragment extends Fragment implements Observer {
}
protected void stopEipIfPossible() {
- eipCommand(Constants.ACTION_STOP_EIP);
+ eipCommand(EIPConstants.ACTION_STOP_EIP);
}
private void downloadEIPServiceConfig() {
@@ -255,7 +258,7 @@ public class VpnFragment extends Fragment implements Observer {
}
protected void updateEipService() {
- eipCommand(Constants.ACTION_UPDATE_EIP_SERVICE);
+ eipCommand(EIPConstants.ACTION_UPDATE_EIP_SERVICE);
}
/**
@@ -268,7 +271,7 @@ public class VpnFragment extends Fragment implements Observer {
// TODO validate "action"...how do we get the list of intent-filters for a class via Android API?
Intent vpn_intent = new Intent(dashboard.getApplicationContext(), EIP.class);
vpn_intent.setAction(action);
- vpn_intent.putExtra(Constants.RECEIVER_TAG, eip_receiver);
+ vpn_intent.putExtra(EIPConstants.RECEIVER_TAG, eip_receiver);
dashboard.startService(vpn_intent);
}
@@ -341,9 +344,9 @@ public class VpnFragment extends Fragment implements Observer {
protected void onReceiveResult(int resultCode, Bundle resultData) {
super.onReceiveResult(resultCode, resultData);
- String request = resultData.getString(Constants.REQUEST_TAG);
+ String request = resultData.getString(EIPConstants.REQUEST_TAG);
- if (request.equals(Constants.ACTION_START_EIP)) {
+ if (request.equals(EIPConstants.ACTION_START_EIP)) {
switch (resultCode) {
case Activity.RESULT_OK:
break;
@@ -351,7 +354,7 @@ public class VpnFragment extends Fragment implements Observer {
break;
}
- } else if (request.equals(Constants.ACTION_STOP_EIP)) {
+ } else if (request.equals(EIPConstants.ACTION_STOP_EIP)) {
switch (resultCode) {
case Activity.RESULT_OK:
stop();
@@ -359,14 +362,14 @@ public class VpnFragment extends Fragment implements Observer {
case Activity.RESULT_CANCELED:
break;
}
- } else if (request.equals(Constants.EIP_NOTIFICATION)) {
+ } else if (request.equals(EIPConstants.EIP_NOTIFICATION)) {
switch (resultCode) {
case Activity.RESULT_OK:
break;
case Activity.RESULT_CANCELED:
break;
}
- } else if (request.equals(Constants.ACTION_CHECK_CERT_VALIDITY)) {
+ } else if (request.equals(EIPConstants.ACTION_CHECK_CERT_VALIDITY)) {
switch (resultCode) {
case Activity.RESULT_OK:
break;
@@ -374,7 +377,7 @@ public class VpnFragment extends Fragment implements Observer {
dashboard.downloadVpnCertificate();
break;
}
- } else if (request.equals(Constants.ACTION_UPDATE_EIP_SERVICE)) {
+ } else if (request.equals(EIPConstants.ACTION_UPDATE_EIP_SERVICE)) {
switch (resultCode) {
case Activity.RESULT_OK:
if (wants_to_connect)
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/Constants.java b/app/src/main/java/se/leap/bitmaskclient/eip/Constants.java
deleted file mode 100644
index db1cb4a1..00000000
--- a/app/src/main/java/se/leap/bitmaskclient/eip/Constants.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * Copyright (c) 2013 LEAP Encryption Access Project and contributers
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package se.leap.bitmaskclient.eip;
-
-/**
- * Constants for intent passing, shared preferences
- *
- * @author Parménides GV <parmegv@sdf.org>
- */
-public interface Constants {
-
- public final static String TAG = Constants.class.getSimpleName();
-
- public final static String ACTION_CHECK_CERT_VALIDITY = TAG + ".CHECK_CERT_VALIDITY";
- public final static String ACTION_START_EIP = TAG + ".START_EIP";
- public final static String ACTION_STOP_EIP = TAG + ".STOP_EIP";
- public final static String ACTION_UPDATE_EIP_SERVICE = TAG + ".UPDATE_EIP_SERVICE";
- public final static String ACTION_IS_EIP_RUNNING = TAG + ".IS_RUNNING";
- public final static String EIP_NOTIFICATION = TAG + ".EIP_NOTIFICATION";
- public final static String ALLOWED_ANON = "allow_anonymous";
- public final static String ALLOWED_REGISTERED = "allow_registration";
- public final static String VPN_CERTIFICATE = "cert";
- public final static String PRIVATE_KEY = TAG + ".PRIVATE_KEY";
- public final static String KEY = TAG + ".KEY";
- public final static String RECEIVER_TAG = TAG + ".RECEIVER_TAG";
- public final static String REQUEST_TAG = TAG + ".REQUEST_TAG";
- public final static String START_BLOCKING_VPN_PROFILE = TAG + ".START_BLOCKING_VPN_PROFILE";
- public final static String PROVIDER_CONFIGURED = TAG + ".PROVIDER_CONFIGURED";
-
-}
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java
index 28a9bb50..8bbdf901 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java
@@ -25,7 +25,7 @@ import org.json.*;
import de.blinkt.openvpn.*;
import se.leap.bitmaskclient.*;
-import static se.leap.bitmaskclient.eip.Constants.*;
+import static se.leap.bitmaskclient.eip.EIPConstants.*;
/**
* EIP is the abstract base class for interacting with and managing the Encrypted
@@ -59,7 +59,7 @@ public final class EIP extends IntentService {
super.onCreate();
context = getApplicationContext();
- preferences = getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE);
+ preferences = getSharedPreferences(Constants.SHARED_PREFERENCES, MODE_PRIVATE);
eip_definition = eipDefinitionFromPreferences();
if (gateways_manager.isEmpty())
gatewaysFromPreferences();
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EIPConstants.java b/app/src/main/java/se/leap/bitmaskclient/eip/EIPConstants.java
new file mode 100644
index 00000000..a56868f1
--- /dev/null
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/EIPConstants.java
@@ -0,0 +1,44 @@
+/**
+ * Copyright (c) 2013 LEAP Encryption Access Project and contributers
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package se.leap.bitmaskclient.eip;
+
+/**
+ * EIPConstants for intent passing, shared preferences
+ *
+ * @author Parménides GV <parmegv@sdf.org>
+ */
+public interface EIPConstants {
+
+ String TAG = "Constants";
+
+ String ACTION_CHECK_CERT_VALIDITY = TAG + ".CHECK_CERT_VALIDITY";
+ String ACTION_START_EIP = TAG + ".START_EIP";
+ String ACTION_STOP_EIP = TAG + ".STOP_EIP";
+ String ACTION_UPDATE_EIP_SERVICE = TAG + ".UPDATE_EIP_SERVICE";
+ String ACTION_IS_EIP_RUNNING = TAG + ".IS_RUNNING";
+ String EIP_NOTIFICATION = TAG + ".EIP_NOTIFICATION";
+ String ALLOWED_ANON = "allow_anonymous";
+ String ALLOWED_REGISTERED = "allow_registration";
+ String VPN_CERTIFICATE = "cert";
+ String PRIVATE_KEY = TAG + ".PRIVATE_KEY";
+ String KEY = TAG + ".KEY";
+ String RECEIVER_TAG = TAG + ".RECEIVER_TAG";
+ String REQUEST_TAG = TAG + ".REQUEST_TAG";
+ String START_BLOCKING_VPN_PROFILE = TAG + ".START_BLOCKING_VPN_PROFILE";
+ String PROVIDER_CONFIGURED = TAG + ".PROVIDER_CONFIGURED";
+
+}
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
index 177f553e..25c99098 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
@@ -123,8 +123,8 @@ public class GatewaysManager {
JSONObject result = new JSONObject();
try {
result.put(Provider.CA_CERT, preferences.getString(Provider.CA_CERT, ""));
- result.put(Constants.PRIVATE_KEY, preferences.getString(Constants.PRIVATE_KEY, ""));
- result.put(Constants.VPN_CERTIFICATE, preferences.getString(Constants.VPN_CERTIFICATE, ""));
+ result.put(EIPConstants.PRIVATE_KEY, preferences.getString(EIPConstants.PRIVATE_KEY, ""));
+ result.put(EIPConstants.VPN_CERTIFICATE, preferences.getString(EIPConstants.VPN_CERTIFICATE, ""));
} catch (JSONException e) {
e.printStackTrace();
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnLauncher.java b/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnLauncher.java
index 5c9263b3..8ce8aa81 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnLauncher.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnLauncher.java
@@ -28,7 +28,7 @@ public class VoidVpnLauncher extends Activity {
if (requestCode == VPN_USER_PERMISSION) {
if (resultCode == RESULT_OK) {
Intent void_vpn_service = new Intent(getApplicationContext(), VoidVpnService.class);
- void_vpn_service.setAction(Constants.START_BLOCKING_VPN_PROFILE);
+ void_vpn_service.setAction(EIPConstants.START_BLOCKING_VPN_PROFILE);
startService(void_vpn_service);
}
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java b/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java
index cbf0fed2..629b4304 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java
@@ -16,7 +16,7 @@ public class VoidVpnService extends VpnService {
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
String action = intent != null ? intent.getAction() : "";
- if (action == Constants.START_BLOCKING_VPN_PROFILE) {
+ if (action == EIPConstants.START_BLOCKING_VPN_PROFILE) {
thread = new Thread(new Runnable() {
public void run() {
Builder builder = new Builder();
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java b/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java
index f428099e..33993139 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java
@@ -118,14 +118,14 @@ public class VpnConfigGenerator {
String key =
"<key>"
+ new_line
- + secrets.getString(Constants.PRIVATE_KEY)
+ + secrets.getString(EIPConstants.PRIVATE_KEY)
+ new_line
+ "</key>";
String openvpn_cert =
"<cert>"
+ new_line
- + secrets.getString(Constants.VPN_CERTIFICATE)
+ + secrets.getString(EIPConstants.VPN_CERTIFICATE)
+ new_line
+ "</cert>";
diff --git a/app/src/main/res/drawable-hdpi/splash_background.png b/app/src/main/res/drawable-hdpi/splash_background.png
new file mode 100644
index 00000000..11dfd005
--- /dev/null
+++ b/app/src/main/res/drawable-hdpi/splash_background.png
Binary files differ
diff --git a/app/src/main/res/drawable-land-hdpi/splash_background.png b/app/src/main/res/drawable-land-hdpi/splash_background.png
new file mode 100644
index 00000000..c2e123ce
--- /dev/null
+++ b/app/src/main/res/drawable-land-hdpi/splash_background.png
Binary files differ
diff --git a/app/src/main/res/drawable-land-ldpi/splash_background.png b/app/src/main/res/drawable-land-ldpi/splash_background.png
new file mode 100644
index 00000000..29f9e7cb
--- /dev/null
+++ b/app/src/main/res/drawable-land-ldpi/splash_background.png
Binary files differ
diff --git a/app/src/main/res/drawable-land-mdpi/splash_background.png b/app/src/main/res/drawable-land-mdpi/splash_background.png
new file mode 100644
index 00000000..bf43f632
--- /dev/null
+++ b/app/src/main/res/drawable-land-mdpi/splash_background.png
Binary files differ
diff --git a/app/src/main/res/drawable-land-xxxhdpi/splash_background.png b/app/src/main/res/drawable-land-xxxhdpi/splash_background.png
new file mode 100644
index 00000000..12a9e8a8
--- /dev/null
+++ b/app/src/main/res/drawable-land-xxxhdpi/splash_background.png
Binary files differ
diff --git a/app/src/main/res/drawable-ldpi/mask.png b/app/src/main/res/drawable-ldpi/mask.png
new file mode 100644
index 00000000..4e22d99f
--- /dev/null
+++ b/app/src/main/res/drawable-ldpi/mask.png
Binary files differ
diff --git a/app/src/main/res/drawable-ldpi/splash_background.png b/app/src/main/res/drawable-ldpi/splash_background.png
new file mode 100644
index 00000000..eaae5efb
--- /dev/null
+++ b/app/src/main/res/drawable-ldpi/splash_background.png
Binary files differ
diff --git a/app/src/main/res/drawable-mdpi/mask.png b/app/src/main/res/drawable-mdpi/mask.png
new file mode 100644
index 00000000..e53cb15c
--- /dev/null
+++ b/app/src/main/res/drawable-mdpi/mask.png
Binary files differ
diff --git a/app/src/main/res/drawable-mdpi/splash_background.png b/app/src/main/res/drawable-mdpi/splash_background.png
new file mode 100644
index 00000000..4df57929
--- /dev/null
+++ b/app/src/main/res/drawable-mdpi/splash_background.png
Binary files differ
diff --git a/app/src/main/res/drawable-xxxhdpi/mask.png b/app/src/main/res/drawable-xxxhdpi/mask.png
new file mode 100644
index 00000000..4297d90c
--- /dev/null
+++ b/app/src/main/res/drawable-xxxhdpi/mask.png
Binary files differ
diff --git a/app/src/main/res/drawable-xxxhdpi/splash_background.png b/app/src/main/res/drawable-xxxhdpi/splash_background.png
new file mode 100644
index 00000000..4ad0e2c3
--- /dev/null
+++ b/app/src/main/res/drawable-xxxhdpi/splash_background.png
Binary files differ
diff --git a/app/src/main/res/drawable/splash_page.xml b/app/src/main/res/drawable/splash_page.xml
new file mode 100644
index 00000000..1d8a6bf6
--- /dev/null
+++ b/app/src/main/res/drawable/splash_page.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+ <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item android:drawable="@drawable/splash_background" />
+
+ <item android:drawable="@drawable/mask"
+ android:gravity="center" >
+ </item>
+
+</layer-list> \ No newline at end of file
diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml
deleted file mode 100644
index cb503b86..00000000
--- a/app/src/main/res/values/attrs.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<resources>
- <declare-styleable name="FileSelectLayout">
- <attr name="title" format="string|reference" />
-<!-- <attr name="taskid" format="integer" /> -->
- </declare-styleable>
-</resources> \ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100644
index 00000000..9f5d8813
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <color name="colorPrimary">#8080b0</color>
+ <color name="colorPrimaryDark">#555575</color>
+</resources>
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
new file mode 100644
index 00000000..80607409
--- /dev/null
+++ b/app/src/main/res/values/themes.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
+ <item name="colorPrimary">@color/colorPrimary</item>
+ <item name="colorPrimaryDark">@color/colorPrimary</item>
+ </style>
+ <style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
+ <item name="colorPrimary">@color/colorPrimary</item>
+ <item name="colorPrimaryDark">@color/colorPrimary</item>
+ <item name="android:windowBackground">@drawable/splash_page</item>
+ </style>
+</resources>
diff --git a/app/src/production/java/se/leap/bitmaskclient/ProviderAPI.java b/app/src/production/java/se/leap/bitmaskclient/ProviderAPI.java
index 70a2c27c..eebc54c1 100644
--- a/app/src/production/java/se/leap/bitmaskclient/ProviderAPI.java
+++ b/app/src/production/java/se/leap/bitmaskclient/ProviderAPI.java
@@ -33,7 +33,7 @@ import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLHandshakeException;
import okhttp3.OkHttpClient;
-import se.leap.bitmaskclient.eip.Constants;
+import se.leap.bitmaskclient.eip.EIPConstants;
import se.leap.bitmaskclient.eip.EIP;
import static se.leap.bitmaskclient.R.string.error_io_exception_user_message;
@@ -120,8 +120,8 @@ public class ProviderAPI extends ProviderApiBase {
//TODO setProviderName(name);
preferences.edit().putString(Provider.KEY, provider_json.toString()).commit();
- preferences.edit().putBoolean(Constants.ALLOWED_ANON, provider_json.getJSONObject(Provider.SERVICE).getBoolean(Constants.ALLOWED_ANON)).commit();
- preferences.edit().putBoolean(Constants.ALLOWED_REGISTERED, provider_json.getJSONObject(Provider.SERVICE).getBoolean(Constants.ALLOWED_REGISTERED)).commit();
+ preferences.edit().putBoolean(EIPConstants.ALLOWED_ANON, provider_json.getJSONObject(Provider.SERVICE).getBoolean(EIPConstants.ALLOWED_ANON)).commit();
+ preferences.edit().putBoolean(EIPConstants.ALLOWED_REGISTERED, provider_json.getJSONObject(Provider.SERVICE).getBoolean(EIPConstants.ALLOWED_REGISTERED)).commit();
result.putBoolean(RESULT_KEY, true);
} catch (JSONException e) {
@@ -150,7 +150,7 @@ public class ProviderAPI extends ProviderApiBase {
JSONObject eip_service_json = new JSONObject(eip_service_json_string);
eip_service_json.getInt(Provider.API_RETURN_SERIAL);
- preferences.edit().putString(Constants.KEY, eip_service_json.toString()).commit();
+ preferences.edit().putString(EIPConstants.KEY, eip_service_json.toString()).commit();
result.putBoolean(RESULT_KEY, true);
} catch (NullPointerException | JSONException e) {
@@ -173,7 +173,7 @@ public class ProviderAPI extends ProviderApiBase {
JSONObject provider_json = new JSONObject(preferences.getString(Provider.KEY, ""));
String provider_main_url = provider_json.getString(Provider.API_URL);
- URL new_cert_string_url = new URL(provider_main_url + "/" + provider_json.getString(Provider.API_VERSION) + "/" + Constants.VPN_CERTIFICATE);
+ URL new_cert_string_url = new URL(provider_main_url + "/" + provider_json.getString(Provider.API_VERSION) + "/" + EIPConstants.VPN_CERTIFICATE);
String cert_string = downloadWithProviderCA(new_cert_string_url.toString());
diff --git a/app/src/production/java/se/leap/bitmaskclient/ProviderDetailFragment.java b/app/src/production/java/se/leap/bitmaskclient/ProviderDetailFragment.java
index da7f8763..bd4c0d72 100644
--- a/app/src/production/java/se/leap/bitmaskclient/ProviderDetailFragment.java
+++ b/app/src/production/java/se/leap/bitmaskclient/ProviderDetailFragment.java
@@ -2,7 +2,7 @@ package se.leap.bitmaskclient;
import org.json.*;
-import se.leap.bitmaskclient.eip.*;
+import se.leap.bitmaskclient.eip.EIPConstants;
import android.app.*;
import android.content.*;
@@ -22,7 +22,7 @@ public class ProviderDetailFragment extends DialogFragment {
LayoutInflater inflater = getActivity().getLayoutInflater();
View provider_detail_view = inflater.inflate(R.layout.provider_detail_fragment, null);
- JSONObject provider_json = new JSONObject(getActivity().getSharedPreferences(Dashboard.SHARED_PREFERENCES, getActivity().MODE_PRIVATE).getString(Provider.KEY, ""));
+ JSONObject provider_json = new JSONObject(getActivity().getSharedPreferences(Constants.SHARED_PREFERENCES, getActivity().MODE_PRIVATE).getString(Provider.KEY, ""));
final TextView domain = (TextView) provider_detail_view.findViewById(R.id.provider_detail_domain);
domain.setText(provider_json.getString(Provider.DOMAIN));
@@ -59,7 +59,7 @@ public class ProviderDetailFragment extends DialogFragment {
private boolean anon_allowed(JSONObject provider_json) {
try {
JSONObject service_description = provider_json.getJSONObject(Provider.SERVICE);
- return service_description.has(Constants.ALLOWED_ANON) && service_description.getBoolean(Constants.ALLOWED_ANON);
+ return service_description.has(EIPConstants.ALLOWED_ANON) && service_description.getBoolean(EIPConstants.ALLOWED_ANON);
} catch (JSONException e) {
return false;
}
@@ -77,8 +77,8 @@ public class ProviderDetailFragment extends DialogFragment {
@Override
public void onCancel(DialogInterface dialog) {
super.onCancel(dialog);
- SharedPreferences.Editor editor = getActivity().getSharedPreferences(Dashboard.SHARED_PREFERENCES, Activity.MODE_PRIVATE).edit();
- editor.remove(Provider.KEY).remove(Constants.ALLOWED_ANON).remove(Constants.KEY).commit();
+ SharedPreferences.Editor editor = getActivity().getSharedPreferences(Constants.SHARED_PREFERENCES, Activity.MODE_PRIVATE).edit();
+ editor.remove(Provider.KEY).remove(EIPConstants.ALLOWED_ANON).remove(EIPConstants.KEY).commit();
interface_with_configuration_wizard.cancelAndShowAllProviders();
}
diff --git a/app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java b/app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java
index 833346fa..291d027e 100644
--- a/app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java
+++ b/app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java
@@ -42,9 +42,9 @@ public class GatewaysManagerTest {
JSONObject secrets = new JSONObject(getJsonStringFor("secrets.json"));
- when(sharedPreferences.getString(eq(Constants.PRIVATE_KEY), anyString())).thenReturn(secrets.getString(Constants.PRIVATE_KEY));
+ when(sharedPreferences.getString(eq(EIPConstants.PRIVATE_KEY), anyString())).thenReturn(secrets.getString(EIPConstants.PRIVATE_KEY));
when(sharedPreferences.getString(eq(Provider.CA_CERT), anyString())).thenReturn(secrets.getString(Provider.CA_CERT));
- when(sharedPreferences.getString(eq(Constants.VPN_CERTIFICATE), anyString())).thenReturn(secrets.getString(Constants.VPN_CERTIFICATE));
+ when(sharedPreferences.getString(eq(EIPConstants.VPN_CERTIFICATE), anyString())).thenReturn(secrets.getString(EIPConstants.VPN_CERTIFICATE));
when(mockContext.getSharedPreferences(anyString(), anyInt())).thenReturn(sharedPreferences);