aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/de/pixart/messenger/services/MemorizingTrustManager.java31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/main/java/de/pixart/messenger/services/MemorizingTrustManager.java b/src/main/java/de/pixart/messenger/services/MemorizingTrustManager.java
index aacaaaad8..d98e97a58 100644
--- a/src/main/java/de/pixart/messenger/services/MemorizingTrustManager.java
+++ b/src/main/java/de/pixart/messenger/services/MemorizingTrustManager.java
@@ -26,18 +26,18 @@
*/
package de.pixart.messenger.services;
-import android.app.Activity;
import android.app.Application;
import android.app.NotificationManager;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
+import android.os.Handler;
import android.preference.PreferenceManager;
+import android.support.v7.app.AppCompatActivity;
import android.util.Base64;
import android.util.Log;
import android.util.SparseArray;
-import android.os.Handler;
import org.json.JSONArray;
import org.json.JSONException;
@@ -52,19 +52,24 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
-import java.security.NoSuchAlgorithmException;
-import java.security.cert.*;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.MessageDigest;
-import java.util.ArrayList;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateEncodingException;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateExpiredException;
+import java.security.cert.CertificateParsingException;
+import java.security.cert.X509Certificate;
import java.text.SimpleDateFormat;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.List;
import java.util.Locale;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import java.util.regex.Pattern;
import javax.net.ssl.HostnameVerifier;
@@ -113,7 +118,7 @@ public class MemorizingTrustManager {
static String KEYSTORE_FILE = "KeyStore.bks";
Context master;
- Activity foregroundAct;
+ AppCompatActivity foregroundAct;
NotificationManager notificationManager;
private static int decisionId = 0;
private static SparseArray<MTMDecision> openDecisions = new SparseArray<MTMDecision>();
@@ -172,8 +177,8 @@ public class MemorizingTrustManager {
app = (Application)m;
} else if (m instanceof Service) {
app = ((Service)m).getApplication();
- } else if (m instanceof Activity) {
- app = ((Activity)m).getApplication();
+ } else if (m instanceof AppCompatActivity) {
+ app = ((AppCompatActivity)m).getApplication();
} else throw new ClassCastException("MemorizingTrustManager context must be either Activity or Service!");
File dir = app.getDir(KEYSTORE_DIR, Context.MODE_PRIVATE);
@@ -197,7 +202,7 @@ public class MemorizingTrustManager {
*
* @param act Activity to be bound
*/
- public void bindDisplayActivity(Activity act) {
+ public void bindDisplayActivity(AppCompatActivity act) {
foregroundAct = act;
}
@@ -205,11 +210,11 @@ public class MemorizingTrustManager {
* Removes an Activity from the MTM display stack.
*
* Always call this function when the Activity added with
- * {@link #bindDisplayActivity(Activity)} is hidden.
+ * {@link #bindDisplayActivity(AppCompatActivity)} is hidden.
*
* @param act Activity to be unbound
*/
- public void unbindDisplayActivity(Activity act) {
+ public void unbindDisplayActivity(AppCompatActivity act) {
// do not remove if it was overridden by a different activity
if (foregroundAct == act)
foregroundAct = null;