// Path: AIMSICD/src/main/java/zz/aimsicd/lite/AppAIMSICD.java
// public class AppAIMSICD extends InjectionApplication {
// 
//     public static final String TAG = "AICDL";
//     public static final String mTAG = "AppAIMSICD";
// 
//     private static WeakReference<AppAIMSICD> instance;
// 
//     public static AppAIMSICD getInstance() {
//         return instance.get();
//     }
// 
//     private Status currentStatus;
// 
// 
//     /**
//      * Maps between an activity class name and the list of currently running
//      * AsyncTasks that were spawned while it was active.
//      */
//     private SparseArray<List<BaseAsyncTask<?, ?, ?>>> mActivityTaskMap;
// 
//     public AppAIMSICD() {
//         mActivityTaskMap = new SparseArray<>();
//     }
// 
//     @Override
//     public void onCreate() {
//         instance = new WeakReference<>(this);
//         //addModule(new AndroidLoggerModule());
//         //addModule(OkHttpModule.withCache(this));
//         super.onCreate();
//         TinyDB.getInstance().init(getApplicationContext());
//         TinyDB.getInstance().putBoolean(TinyDbKeys.FINISHED_LOAD_IN_MAP, true);
//     }
// 
//     public void removeTask(BaseAsyncTask<?, ?, ?> pTask) {
//         int key;
//         for (int i = 0; i < mActivityTaskMap.size(); i++) {
//             key = mActivityTaskMap.keyAt(i);
//             List<BaseAsyncTask<?, ?, ?>> tasks = mActivityTaskMap.get(key);
//             for (BaseAsyncTask<?, ?, ?> lTask : tasks) {
//                 if (lTask.equals(pTask)) {
//                     tasks.remove(lTask);
//                     Log.i(TAG, mTAG + "BaseTask removed:" + pTask.toString());
// 
//                     break;
//                 }
//             }
//             if (tasks.size() == 0) {
//                 mActivityTaskMap.remove(key);
//                 return;
//             }
//         }
//     }
// 
//     public void addTask(Activity activity, BaseAsyncTask<?, ?, ?> pTask) {
//         if (activity == null) {
//             return;
//         }
// 
//        Log.d(TAG, mTAG + "BaseTask addTask activity:" + activity.getClass().getCanonicalName());
// 
//         int key = activity.getClass().getCanonicalName().hashCode();
//         List<BaseAsyncTask<?, ?, ?>> tasks = mActivityTaskMap.get(key);
//         if (tasks == null) {
//             tasks = new ArrayList<>();
//             mActivityTaskMap.put(key, tasks);
//         }
//         Log.i(TAG, mTAG + "BaseTask added:" + pTask.toString());
//         tasks.add(pTask);
//     }
// 
//     public void detach(Activity activity) {
//         if (activity == null) {
//             return;
//         }
// 
//        Log.d(TAG, mTAG + "BaseTask detach:" + activity.getClass().getCanonicalName());
// 
//         List<BaseAsyncTask<?, ?, ?>> tasks = mActivityTaskMap.get(activity.getClass().getCanonicalName().hashCode());
//         if (tasks != null) {
//             for (BaseAsyncTask<?, ?, ?> task : tasks) {
//                 task.setActivity(null);
//             }
//         }
//     }
// 
//     public void attach(InjectionAppCompatActivity activity) {
//         if (activity == null) {
//             return;
//         }
//        Log.d(TAG, mTAG + "BaseTask attach:" + activity.getClass().getCanonicalName());
// 
//         List<BaseAsyncTask<?, ?, ?>> tasks = mActivityTaskMap.get(activity.getClass().getCanonicalName().hashCode());
//         if (tasks != null) {
//             for (BaseAsyncTask<?, ?, ?> task : tasks) {
//                 task.setActivity(activity);
//             }
//         }
//     }
// 
//     /**
//      * Changes the current status, this will also trigger a local broadcast event
//      * if the new status is different from the previous one
//      */
//     public void setCurrentStatus(Status status, boolean vibrate, int minVibrateLevel) {
//         if (status == null) {
//             status = Status.IDLE;
//         }
//         if (status != currentStatus) {
//             Intent intent = new Intent("StatusChange");
//             LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
// 
//             if (vibrate && status.ordinal() >= minVibrateLevel) {
//                 ((Vibrator) getSystemService(VIBRATOR_SERVICE)).vibrate(100);
//             }
//         }
//         currentStatus = status;
//     }
// 
//     /**
//      * Returns the current status
//      */
//     public Status getStatus() {
//         if (currentStatus == null) {
//             return Status.IDLE;
//         }
//         return currentStatus;
//     }
// }


import android.os.AsyncTask;
import java.lang.ref.WeakReference;
import io.freefair.android.injection.app.InjectionAppCompatActivity;
import zz.aimsicd.lite.AppAIMSICD;
/* Android IMSI-Catcher Detector | (c) AIMSICD Privacy Project
 * -----------------------------------------------------------
 * LICENSE:  http://git.io/vki47 | TERMS:  http://git.io/vki4o
 * -----------------------------------------------------------
 */
package zz.aimsicd.lite.utils;






public abstract class BaseAsyncTask<TParams, TProgress, TResult> extends AsyncTask<TParams, TProgress, TResult> {
    protected AppAIMSICD mApp;
    protected WeakReference<InjectionAppCompatActivity> mWeakReferenceActivity;

    public BaseAsyncTask(InjectionAppCompatActivity activity) {
        mWeakReferenceActivity = new WeakReference<>(activity);
// Path: AIMSICD/src/main/java/zz/aimsicd/lite/AppAIMSICD.java
// public class AppAIMSICD extends InjectionApplication {
// 
//     public static final String TAG = "AICDL";
//     public static final String mTAG = "AppAIMSICD";
// 
//     private static WeakReference<AppAIMSICD> instance;
// 
//     public static AppAIMSICD getInstance() {
//         return instance.get();
//     }
// 
//     private Status currentStatus;
// 
// 
//     /**
//      * Maps between an activity class name and the list of currently running
//      * AsyncTasks that were spawned while it was active.
//      */
//     private SparseArray<List<BaseAsyncTask<?, ?, ?>>> mActivityTaskMap;
// 
//     public AppAIMSICD() {
//         mActivityTaskMap = new SparseArray<>();
//     }
// 
//     @Override
//     public void onCreate() {
//         instance = new WeakReference<>(this);
//         //addModule(new AndroidLoggerModule());
//         //addModule(OkHttpModule.withCache(this));
//         super.onCreate();
//         TinyDB.getInstance().init(getApplicationContext());
//         TinyDB.getInstance().putBoolean(TinyDbKeys.FINISHED_LOAD_IN_MAP, true);
//     }
// 
//     public void removeTask(BaseAsyncTask<?, ?, ?> pTask) {
//         int key;
//         for (int i = 0; i < mActivityTaskMap.size(); i++) {
//             key = mActivityTaskMap.keyAt(i);
//             List<BaseAsyncTask<?, ?, ?>> tasks = mActivityTaskMap.get(key);
//             for (BaseAsyncTask<?, ?, ?> lTask : tasks) {
//                 if (lTask.equals(pTask)) {
//                     tasks.remove(lTask);
//                     Log.i(TAG, mTAG + "BaseTask removed:" + pTask.toString());
// 
//                     break;
//                 }
//             }
//             if (tasks.size() == 0) {
//                 mActivityTaskMap.remove(key);
//                 return;
//             }
//         }
//     }
// 
//     public void addTask(Activity activity, BaseAsyncTask<?, ?, ?> pTask) {
//         if (activity == null) {
//             return;
//         }
// 
//        Log.d(TAG, mTAG + "BaseTask addTask activity:" + activity.getClass().getCanonicalName());
// 
//         int key = activity.getClass().getCanonicalName().hashCode();
//         List<BaseAsyncTask<?, ?, ?>> tasks = mActivityTaskMap.get(key);
//         if (tasks == null) {
//             tasks = new ArrayList<>();
//             mActivityTaskMap.put(key, tasks);
//         }
//         Log.i(TAG, mTAG + "BaseTask added:" + pTask.toString());
//         tasks.add(pTask);
//     }
// 
//     public void detach(Activity activity) {
//         if (activity == null) {
//             return;
//         }
// 
//        Log.d(TAG, mTAG + "BaseTask detach:" + activity.getClass().getCanonicalName());
// 
//         List<BaseAsyncTask<?, ?, ?>> tasks = mActivityTaskMap.get(activity.getClass().getCanonicalName().hashCode());
//         if (tasks != null) {
//             for (BaseAsyncTask<?, ?, ?> task : tasks) {
//                 task.setActivity(null);
//             }
//         }
//     }
// 
//     public void attach(InjectionAppCompatActivity activity) {
//         if (activity == null) {
//             return;
//         }
//        Log.d(TAG, mTAG + "BaseTask attach:" + activity.getClass().getCanonicalName());
// 
//         List<BaseAsyncTask<?, ?, ?>> tasks = mActivityTaskMap.get(activity.getClass().getCanonicalName().hashCode());
//         if (tasks != null) {
//             for (BaseAsyncTask<?, ?, ?> task : tasks) {
//                 task.setActivity(activity);
//             }
//         }
//     }
// 
//     /**
//      * Changes the current status, this will also trigger a local broadcast event
//      * if the new status is different from the previous one
//      */
//     public void setCurrentStatus(Status status, boolean vibrate, int minVibrateLevel) {
//         if (status == null) {
//             status = Status.IDLE;
//         }
//         if (status != currentStatus) {
//             Intent intent = new Intent("StatusChange");
//             LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
// 
//             if (vibrate && status.ordinal() >= minVibrateLevel) {
//                 ((Vibrator) getSystemService(VIBRATOR_SERVICE)).vibrate(100);
//             }
//         }
//         currentStatus = status;
//     }
// 
//     /**
//      * Returns the current status
//      */
//     public Status getStatus() {
//         if (currentStatus == null) {
//             return Status.IDLE;
//         }
//         return currentStatus;
//     }
// }


// Path: AIMSICD/src/main/java/zz/aimsicd/lite/utils/BaseAsyncTask.java
import android.os.AsyncTask;
import java.lang.ref.WeakReference;
import io.freefair.android.injection.app.InjectionAppCompatActivity;
import zz.aimsicd.lite.AppAIMSICD;

/* Android IMSI-Catcher Detector | (c) AIMSICD Privacy Project
 * -----------------------------------------------------------
 * LICENSE:  http://git.io/vki47 | TERMS:  http://git.io/vki4o
 * -----------------------------------------------------------
 */
package zz.aimsicd.lite.utils;






public abstract class BaseAsyncTask<TParams, TProgress, TResult> extends AsyncTask<TParams, TProgress, TResult> {
    protected AppAIMSICD mApp;
    protected WeakReference<InjectionAppCompatActivity> mWeakReferenceActivity;

    public BaseAsyncTask(InjectionAppCompatActivity activity) {
        mWeakReferenceActivity = new WeakReference<>(activity);
        mApp = (AppAIMSICD) activity.getApplication();