/*
 * Copyright (C) 2010 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package com.google.ase.activity;

import java.util.HashMap;
import java.util.Queue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;

import android.app.Activity;
import android.app.Service;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;

import com.google.ase.AseApplication;
import com.google.ase.future.FutureActivityTask;
import com.google.ase.future.FutureResult;

/**
 * This {@link Activity} is launched by the {@link AseService} in order to perform operations that a
 * {@link Service} is unable to do. For example: start another activity for result, show dialogs,
 * etc.
 * 
 * @author Damon Kohler (damonkohler@gmail.com)
 */
public class AseServiceHelper extends Activity {
  Queue<FutureActivityTask> mTaskQueue;
  private Handler mHandler;
  private HashMap<Integer, FutureResult> mResultMap;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mHandler = new Handler();
    mTaskQueue = ((AseApplication) getApplication()).getTaskQueue();
    mResultMap = new HashMap<Integer, FutureResult>();
    setPersistent(true);
  }

  public void taskDone(int taskId) {
    mResultMap.remove(taskId);
    if (mResultMap.isEmpty()) {
      finish();
    }
  }

  @Override
  protected void onStart() {
    FutureActivityTask task = mTaskQueue.poll();
    mHandler.post(task.getRunnable(this));
    FutureResult result = task.getResult();
    mResultMap.put(task.getTaskId(), result);
  }

  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    FutureResult result = mResultMap.get(requestCode);
    if (result != null) {
      result.set(data);
      taskDone(requestCode);
    }
  }
}

@@ -676,105 +676,8 @@
 eue;
-%0Aimport java.util.concurrent.ConcurrentHashMap;%0Aimport java.util.concurrent.atomic.AtomicInteger;
 %0A%0Aim
@@ -1840,24 +1840,45 @@
 onStart() %7B%0A
+    super.onStart();%0A
     FutureAc

Fix missing call to super.onStart().