package com.littlepanpc.download.services;

import com.littlepanpc.download.aidl.IDownloadService;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;

public class DownloadService extends Service {
	private static final String TAG = DownloadService.class.getName();
	private DownloadManager mDownloadManager;

	@Override
	public IBinder onBind(Intent intent) {
		Log.i(TAG, "onBind");
		return new DownloadServiceBinder();
	}

	@Override
	public void onCreate() {
		Log.i(TAG, "onCreate");
		super.onCreate();
		mDownloadManager = new DownloadManager(this);
	}

	public class DownloadServiceBinder extends IDownloadService.Stub {
		private final String TAG2 = DownloadServiceBinder.class.getName();

		@Override
		public void startManage() throws RemoteException {
			Log.i(TAG2, "startManage");
			mDownloadManager.startManage();
		}

		@Override
		public void addTask(String url) throws RemoteException {
			Log.i(TAG2, "addTask");
			mDownloadManager.addTask(url);
		}

		@Override
		public void pauseTask(String url) throws RemoteException {
			Log.i(TAG2, "pauseTask");
			mDownloadManager.pauseTask(url);
		}

		@Override
		public void deleteTask(String url) throws RemoteException {
			Log.i(TAG2, "deleteTask");
			mDownloadManager.deleteTask(url);
		}

		@Override
		public void continueTask(String url) throws RemoteException {
			Log.i(TAG2, "continueTask");
			mDownloadManager.continueTask(url);
		}

		@Override
		public void pauseAllTask() throws RemoteException {
			Log.i(TAG2, "pauseAllTask");
			mDownloadManager.pauseAllTask();
		}

		@Override
		public void resumeAllTask() throws RemoteException {
			Log.i(TAG2, "resumeAllTask");
			mDownloadManager.resumeAllTask();
		}

		@Override
		public void deleteAllTask() throws RemoteException {
			Log.i(TAG2, "deleteAllTask");
			mDownloadManager.deleteAllTask();
		}

		@Override
		public void finish() throws RemoteException {
			// TODO Auto-generated method stub
			mDownloadManager.finish();
		}

	}

}

@@ -239,16 +239,206 @@
 il.Log;%0A
+/**%0A * @class: DownloadService%0A * @Description: Service to manage download tasks%0A * @author: Peter Pan%0A * @email: happychinapc@gmail.com%0A * @date: 2014-8-19 %E4%B8%8A%E5%8D%889:08:44%0A * @since: 1.0.0%0A *%0A */
 %0Apublic 

Update DownloadService.java