Skip to content

Commit

Permalink
Fix libssl crash because of OkHttp changing the global SSL context.
Browse files Browse the repository at this point in the history
- See related square/okhttp#184.
  • Loading branch information
UweTrottmann committed Dec 13, 2013
1 parent 86a83ae commit 4c0e925
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.battlelancer.seriesguide.settings.DisplaySettings;
import com.battlelancer.seriesguide.util.ImageProvider;
import com.battlelancer.seriesguide.util.Utils;
import com.squareup.okhttp.OkHttpClient;
import com.uwetrottmann.androidutils.AndroidUtils;
import com.uwetrottmann.seriesguide.BuildConfig;
import com.uwetrottmann.seriesguide.R;
Expand All @@ -35,6 +36,8 @@
import android.os.StrictMode.VmPolicy;
import android.preference.PreferenceManager;

import java.net.URL;

/**
* Initializes settings and services and on pre-ICS implements actions for low
* memory state.
Expand Down Expand Up @@ -63,6 +66,12 @@ public void onCreate() {
// Load the current theme into a global variable
Utils.updateTheme(DisplaySettings.getThemeIndex(this));

// OkHttp changes the global SSL context, breaks other HTTP clients like used by e.g. Google
// Analytics.
// https://github.com/square/okhttp/issues/184
// So set OkHttp to handle all connections
URL.setURLStreamHandlerFactory(new OkHttpClient());

// Ensure GA opt-out
GoogleAnalytics.getInstance(this).setAppOptOut(AppSettings.isGaAppOptOut(this));

Expand Down

0 comments on commit 4c0e925

Please sign in to comment.