// Path: Simperium/src/main/java/com/simperium/client/ClientFactory.java
// public interface ClientFactory {
// 
//     public AuthProvider buildAuthProvider(String appId, String appSecret);
//     public ChannelProvider buildChannelProvider(String appId);
//     public StorageProvider buildStorageProvider();
//     public GhostStorageProvider buildGhostStorageProvider();
//     public Executor buildExecutor();
// 
// }
// 
// Path: Simperium/src/main/java/com/simperium/util/Uuid.java
// public class Uuid {
// 
//     public static String uuid(){
//         return UUID.randomUUID().toString().replace("-","");
//     }
// 
//     /**
//      * Take only the specified number of characters from the front of the UUID 
//      */
//     public static String uuid(int length){
//         return uuid().substring(0, length);
//     }
// 
// }


import android.content.Context;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import com.koushikdutta.async.http.AsyncHttpClient;
import org.thoughtcrime.ssl.pinning.PinningTrustManager;
import org.thoughtcrime.ssl.pinning.SystemKeyStore;
import com.simperium.BuildConfig;
import com.simperium.Version;
import com.simperium.client.ClientFactory;
import com.simperium.util.Uuid;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.ExecutorService;
import javax.net.ssl.TrustManager;
import android.util.Log;
    protected final String mSessionId;

    protected ExecutorService mExecutor;
    protected AsyncHttpClient mHttpClient = AsyncHttpClient.getDefaultInstance();

    public AndroidClient(Context context){
        int threads = Runtime.getRuntime().availableProcessors();
        if (threads > 1) {
            threads -= 1;
        }

        if (BuildConfig.DEBUG) {
            Log.d(TAG, String.format("Using %d cores for executors", threads));
        }
        mExecutor = Executors.newFixedThreadPool(threads);
        mContext = context;
        mDatabase = mContext.openOrCreateDatabase(DEFAULT_DATABASE_NAME, 0, null);

        SharedPreferences preferences = sharedPreferences(mContext);
        String sessionToken = null;

        if (preferences.contains(SESSION_ID_PREFERENCE)) {
            try {
                sessionToken = preferences.getString(SESSION_ID_PREFERENCE, null);
            } catch (ClassCastException e) {
                sessionToken = null;
            }
        }

        if (sessionToken == null) {
// Path: Simperium/src/main/java/com/simperium/client/ClientFactory.java
// public interface ClientFactory {
// 
//     public AuthProvider buildAuthProvider(String appId, String appSecret);
//     public ChannelProvider buildChannelProvider(String appId);
//     public StorageProvider buildStorageProvider();
//     public GhostStorageProvider buildGhostStorageProvider();
//     public Executor buildExecutor();
// 
// }
// 
// Path: Simperium/src/main/java/com/simperium/util/Uuid.java
// public class Uuid {
// 
//     public static String uuid(){
//         return UUID.randomUUID().toString().replace("-","");
//     }
// 
//     /**
//      * Take only the specified number of characters from the front of the UUID 
//      */
//     public static String uuid(int length){
//         return uuid().substring(0, length);
//     }
// 
// }


// Path: Simperium/src/main/java/com/simperium/android/AndroidClient.java
import android.content.Context;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import com.koushikdutta.async.http.AsyncHttpClient;
import org.thoughtcrime.ssl.pinning.PinningTrustManager;
import org.thoughtcrime.ssl.pinning.SystemKeyStore;
import com.simperium.BuildConfig;
import com.simperium.Version;
import com.simperium.client.ClientFactory;
import com.simperium.util.Uuid;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.ExecutorService;
import javax.net.ssl.TrustManager;
import android.util.Log;

    protected final String mSessionId;

    protected ExecutorService mExecutor;
    protected AsyncHttpClient mHttpClient = AsyncHttpClient.getDefaultInstance();

    public AndroidClient(Context context){
        int threads = Runtime.getRuntime().availableProcessors();
        if (threads > 1) {
            threads -= 1;
        }

        if (BuildConfig.DEBUG) {
            Log.d(TAG, String.format("Using %d cores for executors", threads));
        }
        mExecutor = Executors.newFixedThreadPool(threads);
        mContext = context;
        mDatabase = mContext.openOrCreateDatabase(DEFAULT_DATABASE_NAME, 0, null);

        SharedPreferences preferences = sharedPreferences(mContext);
        String sessionToken = null;

        if (preferences.contains(SESSION_ID_PREFERENCE)) {
            try {
                sessionToken = preferences.getString(SESSION_ID_PREFERENCE, null);
            } catch (ClassCastException e) {
                sessionToken = null;
            }
        }

        if (sessionToken == null) {
            sessionToken = Uuid.uuid(6);