aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/github
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2016-10-06 17:48:53 -0700
committerScott Jackson <daneren2005@gmail.com>2016-10-06 17:48:53 -0700
commit3af3fc9495491c6263fb5794e10aa72a47b727c5 (patch)
tree5df43f8dab9bf268267fc7fb6fc13dacc523fa66 /app/src/main/java/github
parent74986cb2a593deca85e2eda83d1fb18d5485f7f0 (diff)
downloaddsub-3af3fc9495491c6263fb5794e10aa72a47b727c5.tar.gz
dsub-3af3fc9495491c6263fb5794e10aa72a47b727c5.tar.bz2
dsub-3af3fc9495491c6263fb5794e10aa72a47b727c5.zip
Move to using Google Play Services SSL by default where available
Diffstat (limited to 'app/src/main/java/github')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java b/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
index 72faa7e1..178b8d13 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
@@ -40,6 +40,8 @@ import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;
+import com.google.android.gms.security.ProviderInstaller;
+
import github.daneren2005.dsub.R;
import github.daneren2005.dsub.domain.*;
import github.daneren2005.dsub.fragments.MainFragment;
@@ -105,6 +107,7 @@ public class RESTMusicService implements MusicService {
private String redirectFrom;
private String redirectTo;
private Integer instance;
+ private boolean hasInstalledGoogleSSL = false;
public RESTMusicService() {
selfSignedHostnameVerifier = new HostnameVerifier() {
@@ -1831,6 +1834,16 @@ public class RESTMusicService implements MusicService {
}
private HttpURLConnection getConnectionDirect(Context context, String url, int minNetworkTimeout) throws Exception {
+ if(!hasInstalledGoogleSSL) {
+ try {
+ ProviderInstaller.installIfNeeded(context);
+ } catch(Exception e) {
+ // Just continue on anyways, doesn't really harm anything if this fails
+ Log.w(TAG, "Failed to update to use Google Play SSL", e);
+ }
+ hasInstalledGoogleSSL = true;
+ }
+
// Connect and add headers
URL urlObj = new URL(url);
HttpURLConnection connection = (HttpURLConnection) urlObj.openConnection();