// Path: src/com/concentricsky/android/khanacademy/data/KADataService.java
// public static class KADataBinder extends Binder {
// 	private KADataService dataService;
// 	public KADataBinder(KADataService dataService) {
// 		setDataService(dataService);
// 	}
//     public KADataService getService() {
//         return dataService;
//     }
//     public void setDataService(KADataService dataService) {
// 		this.dataService = dataService;
//     }
// }
// 
// Path: src/com/concentricsky/android/khanacademy/data/KADataService.java
// public interface Provider {
// 	public KADataService getDataService() throws ServiceUnavailableException;
// 	public boolean requestDataService(ObjectCallback<KADataService> callback);
// 	public boolean cancelDataServiceRequest(ObjectCallback<KADataService> callback);
// }
// 
// Path: src/com/concentricsky/android/khanacademy/data/KADataService.java
// public static class ServiceUnavailableException extends Exception {
// 	private static final long serialVersionUID = 581386365380491650L;
// 	public final boolean expected;
// 	public ServiceUnavailableException(boolean expected) {
// 		super();
// 		this.expected = expected;
// 	}
// }
// 
// Path: src/com/concentricsky/android/khanacademy/util/ObjectCallback.java
// public interface ObjectCallback<T> {
// 	public void call(T obj);
// }


import com.concentricsky.android.khanacademy.util.ObjectCallback;
import java.util.ArrayList;
import java.util.List;
import android.app.Activity;
import android.app.Service;
import android.content.ComponentName;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import com.concentricsky.android.khanacademy.data.KADataService.KADataBinder;
import com.concentricsky.android.khanacademy.data.KADataService.Provider;
import com.concentricsky.android.khanacademy.data.KADataService.ServiceUnavailableException;
                callback.call(dataService);
            }
            dataServiceCallbacks.clear();
        }

        @Override
        public void onServiceDisconnected(ComponentName name) {
            // NOTE : we ignore the name, as we only connect to a single type of dataService.
            dataService = null;
        }
        
    };
    
    public void destroy() {
        dataServiceCallbacks.clear();
        if (serviceRequested) {
	        activity.unbindService(serviceConnection);
        }
        activity = null;
        serviceConnection = null;
        dataService = null;
    }

    public KADataServiceProviderImpl(Activity activity) {
        this.activity = activity;
        serviceRequested = false;

    }

    @Override
// Path: src/com/concentricsky/android/khanacademy/data/KADataService.java
// public static class KADataBinder extends Binder {
// 	private KADataService dataService;
// 	public KADataBinder(KADataService dataService) {
// 		setDataService(dataService);
// 	}
//     public KADataService getService() {
//         return dataService;
//     }
//     public void setDataService(KADataService dataService) {
// 		this.dataService = dataService;
//     }
// }
// 
// Path: src/com/concentricsky/android/khanacademy/data/KADataService.java
// public interface Provider {
// 	public KADataService getDataService() throws ServiceUnavailableException;
// 	public boolean requestDataService(ObjectCallback<KADataService> callback);
// 	public boolean cancelDataServiceRequest(ObjectCallback<KADataService> callback);
// }
// 
// Path: src/com/concentricsky/android/khanacademy/data/KADataService.java
// public static class ServiceUnavailableException extends Exception {
// 	private static final long serialVersionUID = 581386365380491650L;
// 	public final boolean expected;
// 	public ServiceUnavailableException(boolean expected) {
// 		super();
// 		this.expected = expected;
// 	}
// }
// 
// Path: src/com/concentricsky/android/khanacademy/util/ObjectCallback.java
// public interface ObjectCallback<T> {
// 	public void call(T obj);
// }


// Path: src/com/concentricsky/android/khanacademy/data/KADataServiceProviderImpl.java
import com.concentricsky.android.khanacademy.util.ObjectCallback;
import java.util.ArrayList;
import java.util.List;
import android.app.Activity;
import android.app.Service;
import android.content.ComponentName;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import com.concentricsky.android.khanacademy.data.KADataService.KADataBinder;
import com.concentricsky.android.khanacademy.data.KADataService.Provider;
import com.concentricsky.android.khanacademy.data.KADataService.ServiceUnavailableException;

                callback.call(dataService);
            }
            dataServiceCallbacks.clear();
        }

        @Override
        public void onServiceDisconnected(ComponentName name) {
            // NOTE : we ignore the name, as we only connect to a single type of dataService.
            dataService = null;
        }
        
    };
    
    public void destroy() {
        dataServiceCallbacks.clear();
        if (serviceRequested) {
	        activity.unbindService(serviceConnection);
        }
        activity = null;
        serviceConnection = null;
        dataService = null;
    }

    public KADataServiceProviderImpl(Activity activity) {
        this.activity = activity;
        serviceRequested = false;

    }

    @Override
    public KADataService getDataService() throws ServiceUnavailableException {