// Path: src/edu/bupt/calendar/AsyncQueryService.java
// public static class Operation {
//     static final int EVENT_ARG_QUERY = 1;
//     static final int EVENT_ARG_INSERT = 2;
//     static final int EVENT_ARG_UPDATE = 3;
//     static final int EVENT_ARG_DELETE = 4;
//     static final int EVENT_ARG_BATCH = 5;
// 
//     /**
//      * unique identify for cancellation purpose
//      */
//     public int token;
// 
//     /**
//      * One of the EVENT_ARG_ constants in the class describing the operation
//      */
//     public int op;
// 
//     /**
//      * {@link SystemClock.elapsedRealtime()} based
//      */
//     public long scheduledExecutionTime;
// 
//     protected static char opToChar(int op) {
//         switch (op) {
//             case Operation.EVENT_ARG_QUERY:
//                 return 'Q';
//             case Operation.EVENT_ARG_INSERT:
//                 return 'I';
//             case Operation.EVENT_ARG_UPDATE:
//                 return 'U';
//             case Operation.EVENT_ARG_DELETE:
//                 return 'D';
//             case Operation.EVENT_ARG_BATCH:
//                 return 'B';
//             default:
//                 return '?';
//         }
//     }
// 
//     @Override
//     public String toString() {
//         StringBuilder builder = new StringBuilder();
//         builder.append("Operation [op=");
//         builder.append(op);
//         builder.append(", token=");
//         builder.append(token);
//         builder.append(", scheduledExecutionTime=");
//         builder.append(scheduledExecutionTime);
//         builder.append("]");
//         return builder.toString();
//     }
// }


import edu.bupt.calendar.AsyncQueryService.Operation;
import android.app.IntentService;
import android.content.ContentProviderOperation;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.OperationApplicationException;
import android.database.Cursor;
import android.net.Uri;
import android.os.Handler;
import android.os.Message;
import android.os.RemoteException;
import android.os.SystemClock;
import android.util.Log;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.PriorityQueue;
import java.util.concurrent.Delayed;
import java.util.concurrent.TimeUnit;

        ContentResolver resolver = args.resolver;
        if (resolver != null) {

            switch (args.op) {
                case Operation.EVENT_ARG_QUERY:
                    Cursor cursor;
                    try {
                        cursor = resolver.query(args.uri, args.projection, args.selection,
                                args.selectionArgs, args.orderBy);
                        /*
                         * Calling getCount() causes the cursor window to be
                         * filled, which will make the first access on the main
                         * thread a lot faster
                         */
                        if (cursor != null) {
                            cursor.getCount();
                        }
                    } catch (Exception e) {
                        Log.w(TAG, e.toString());
                        cursor = null;
                    }

                    args.result = cursor;
                    break;

                case Operation.EVENT_ARG_INSERT:
                    args.result = resolver.insert(args.uri, args.values);
                    break;

// Path: src/edu/bupt/calendar/AsyncQueryService.java
// public static class Operation {
//     static final int EVENT_ARG_QUERY = 1;
//     static final int EVENT_ARG_INSERT = 2;
//     static final int EVENT_ARG_UPDATE = 3;
//     static final int EVENT_ARG_DELETE = 4;
//     static final int EVENT_ARG_BATCH = 5;
// 
//     /**
//      * unique identify for cancellation purpose
//      */
//     public int token;
// 
//     /**
//      * One of the EVENT_ARG_ constants in the class describing the operation
//      */
//     public int op;
// 
//     /**
//      * {@link SystemClock.elapsedRealtime()} based
//      */
//     public long scheduledExecutionTime;
// 
//     protected static char opToChar(int op) {
//         switch (op) {
//             case Operation.EVENT_ARG_QUERY:
//                 return 'Q';
//             case Operation.EVENT_ARG_INSERT:
//                 return 'I';
//             case Operation.EVENT_ARG_UPDATE:
//                 return 'U';
//             case Operation.EVENT_ARG_DELETE:
//                 return 'D';
//             case Operation.EVENT_ARG_BATCH:
//                 return 'B';
//             default:
//                 return '?';
//         }
//     }
// 
//     @Override
//     public String toString() {
//         StringBuilder builder = new StringBuilder();
//         builder.append("Operation [op=");
//         builder.append(op);
//         builder.append(", token=");
//         builder.append(token);
//         builder.append(", scheduledExecutionTime=");
//         builder.append(scheduledExecutionTime);
//         builder.append("]");
//         return builder.toString();
//     }
// }


// Path: src/edu/bupt/calendar/AsyncQueryServiceHelper.java
import edu.bupt.calendar.AsyncQueryService.Operation;
import android.app.IntentService;
import android.content.ContentProviderOperation;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.OperationApplicationException;
import android.database.Cursor;
import android.net.Uri;
import android.os.Handler;
import android.os.Message;
import android.os.RemoteException;
import android.os.SystemClock;
import android.util.Log;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.PriorityQueue;
import java.util.concurrent.Delayed;
import java.util.concurrent.TimeUnit;


        ContentResolver resolver = args.resolver;
        if (resolver != null) {

            switch (args.op) {
                case Operation.EVENT_ARG_QUERY:
                    Cursor cursor;
                    try {
                        cursor = resolver.query(args.uri, args.projection, args.selection,
                                args.selectionArgs, args.orderBy);
                        /*
                         * Calling getCount() causes the cursor window to be
                         * filled, which will make the first access on the main
                         * thread a lot faster
                         */
                        if (cursor != null) {
                            cursor.getCount();
                        }
                    } catch (Exception e) {
                        Log.w(TAG, e.toString());
                        cursor = null;
                    }

                    args.result = cursor;
                    break;

                case Operation.EVENT_ARG_INSERT:
                    args.result = resolver.insert(args.uri, args.values);
                    break;

                case Operation.EVENT_ARG_UPDATE: