OSDN Git Service

Allow processing tasks to supply their own
authorSeth Raphael <magicseth@google.com>
Mon, 10 Mar 2014 23:15:13 +0000 (16:15 -0700)
committerSeth Raphael <magicseth@google.com>
Mon, 10 Mar 2014 23:15:13 +0000 (16:15 -0700)
sessions.

This is part of a fix for

Bug: 13100494
Change-Id: If58fa1212bf666be3f974c35c6be6ef964415405

src/com/android/camera/processing/ProcessingService.java
src/com/android/camera/processing/ProcessingTask.java

index a7992d1..b57228d 100644 (file)
@@ -27,6 +27,7 @@ import android.util.Log;
 
 import com.android.camera.app.CameraApp;
 import com.android.camera.app.CameraServices;
+import com.android.camera.session.CaptureSession;
 import com.android.camera.session.CaptureSessionManager;
 
 /**
@@ -133,8 +134,11 @@ public class ProcessingService extends Service {
             Log.e(TAG, "Reference to ProcessingTask is null");
             return;
         }
-        task.process(this, getServices(),
-                mSessionManager.createNewSession(task.getName(), task.getLocation()));
+        CaptureSession session = task.getSession();
+        if (session == null) {
+            session = mSessionManager.createNewSession(task.getName(), task.getLocation());
+        }
+        task.process(this, getServices(), session);
     }
 
     /**
index a29d11b..a73cd31 100644 (file)
@@ -79,6 +79,11 @@ public interface ProcessingTask {
      */
     public Location getLocation();
 
+    /**
+     * @return The CaptureSession if it has been created, or null.
+     */
+    public CaptureSession getSession();
+
     /** Sets a listener that is informed when this task is done processing. */
     public void setDoneListener(ProcessingTaskDoneListener listener);
 }