// Path: downloader/src/main/java/org/aisen/download/utils/Constants.java
// public final class Constants {
// 
//     public static final String TAG = "DownloadManager";
// 
//     public static final String TEMP_SUFFIX = ".atmp";
// 
//     /** The intent that gets sent when the service must wake up for a retry */
//     public static final String ACTION_RETRY = "android.intent.action.DOWNLOAD_WAKEUP";
// 
//     /**
//      * The maximum number of redirects.
//      */
//     public static final int MAX_REDIRECTS = 5; // can't be more than 7.
// 
//     /** The buffer size used to stream the data */
//     public static final int BUFFER_SIZE = 8192;
// 
//     /** The minimum amount of progress that has to be done before the progress bar gets updated */
//     public static final int MIN_PROGRESS_STEP = 65536;
// 
//     /** The minimum amount of time that has to elapse before the progress bar gets updated, in ms */
//     public static final long MIN_PROGRESS_TIME = 300;// 2000
// 
//     /**
//      * The time between a failure and the first retry after an IOException.
//      * Each subsequent retry grows exponentially, doubling each time.
//      * The time is in seconds.
//      */
//     public static final int RETRY_FIRST_DELAY = 30;
// 
//     /**
//      * The number of times that the download manager will retry its network
//      * operations when no progress is happening before it gives up.
//      */
//     public static final int MAX_RETRIES = 5;
// 
//     /** The column that is used for the downloads's ETag */
//     public static final String ETAG = "etag";
// 
// }


import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.text.TextUtils;
import android.util.Log;
import org.aisen.download.utils.Constants;
import java.util.Map;
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        if (newVersion == 1) {
            createDownloadInfoTable(db);

            createHeadersTable(db);
        }
    }

    private void createDownloadInfoTable(SQLiteDatabase db) {
        try {
            db.execSQL("DROP TABLE IF EXISTS " + DB_TABLE);
            db.execSQL("CREATE TABLE " + DB_TABLE + "(" +
                    Downloads.Impl._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
                    Downloads.Impl.COLUMN_KEY + " TEXT NOT NULL, " +
                    Downloads.Impl.COLUMN_URI + " TEXT, " +
                    Downloads.Impl._DATA + " TEXT, " +
                    Downloads.Impl.COLUMN_VISIBILITY + " INTEGER, " +
                    Downloads.Impl.COLUMN_CONTROL + " INTEGER, " +
                    Downloads.Impl.COLUMN_STATUS + " INTEGER, " +
                    Downloads.Impl.COLUMN_ERROR_MSG + " TEXT, " +
                    Downloads.Impl.COLUMN_LAST_MODIFICATION + " BIGINT, " +
                    Downloads.Impl.COLUMN_FAILED_CONNECTIONS + " INTEGER, " +
                    Downloads.Impl.COLUMN_TOTAL_BYTES + " INTEGER, " +
                    Downloads.Impl.COLUMN_CURRENT_BYTES + " INTEGER, " +
                    Downloads.Impl.COLUMN_ALLOWED_NETWORK_TYPES + " INTEGER, " +
                    Downloads.Impl.COLUMN_ALLOW_ROAMING + " BOOLEAN, " +
                    Downloads.Impl.COLUMN_BYPASS_RECOMMENDED_SIZE_LIMIT + " BOOLEAN, " +
// Path: downloader/src/main/java/org/aisen/download/utils/Constants.java
// public final class Constants {
// 
//     public static final String TAG = "DownloadManager";
// 
//     public static final String TEMP_SUFFIX = ".atmp";
// 
//     /** The intent that gets sent when the service must wake up for a retry */
//     public static final String ACTION_RETRY = "android.intent.action.DOWNLOAD_WAKEUP";
// 
//     /**
//      * The maximum number of redirects.
//      */
//     public static final int MAX_REDIRECTS = 5; // can't be more than 7.
// 
//     /** The buffer size used to stream the data */
//     public static final int BUFFER_SIZE = 8192;
// 
//     /** The minimum amount of progress that has to be done before the progress bar gets updated */
//     public static final int MIN_PROGRESS_STEP = 65536;
// 
//     /** The minimum amount of time that has to elapse before the progress bar gets updated, in ms */
//     public static final long MIN_PROGRESS_TIME = 300;// 2000
// 
//     /**
//      * The time between a failure and the first retry after an IOException.
//      * Each subsequent retry grows exponentially, doubling each time.
//      * The time is in seconds.
//      */
//     public static final int RETRY_FIRST_DELAY = 30;
// 
//     /**
//      * The number of times that the download manager will retry its network
//      * operations when no progress is happening before it gives up.
//      */
//     public static final int MAX_RETRIES = 5;
// 
//     /** The column that is used for the downloads's ETag */
//     public static final String ETAG = "etag";
// 
// }


// Path: downloader/src/main/java/org/aisen/download/core/DBHelper.java
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.text.TextUtils;
import android.util.Log;
import org.aisen.download.utils.Constants;
import java.util.Map;

    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        if (newVersion == 1) {
            createDownloadInfoTable(db);

            createHeadersTable(db);
        }
    }

    private void createDownloadInfoTable(SQLiteDatabase db) {
        try {
            db.execSQL("DROP TABLE IF EXISTS " + DB_TABLE);
            db.execSQL("CREATE TABLE " + DB_TABLE + "(" +
                    Downloads.Impl._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
                    Downloads.Impl.COLUMN_KEY + " TEXT NOT NULL, " +
                    Downloads.Impl.COLUMN_URI + " TEXT, " +
                    Downloads.Impl._DATA + " TEXT, " +
                    Downloads.Impl.COLUMN_VISIBILITY + " INTEGER, " +
                    Downloads.Impl.COLUMN_CONTROL + " INTEGER, " +
                    Downloads.Impl.COLUMN_STATUS + " INTEGER, " +
                    Downloads.Impl.COLUMN_ERROR_MSG + " TEXT, " +
                    Downloads.Impl.COLUMN_LAST_MODIFICATION + " BIGINT, " +
                    Downloads.Impl.COLUMN_FAILED_CONNECTIONS + " INTEGER, " +
                    Downloads.Impl.COLUMN_TOTAL_BYTES + " INTEGER, " +
                    Downloads.Impl.COLUMN_CURRENT_BYTES + " INTEGER, " +
                    Downloads.Impl.COLUMN_ALLOWED_NETWORK_TYPES + " INTEGER, " +
                    Downloads.Impl.COLUMN_ALLOW_ROAMING + " BOOLEAN, " +
                    Downloads.Impl.COLUMN_BYPASS_RECOMMENDED_SIZE_LIMIT + " BOOLEAN, " +
                    Constants.ETAG + " TEXT, " +