1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.camera.processing.imagebackend; 18 19 import android.net.Uri; 20 21 /** 22 * Defines the interactions between the Tasks that are running on ImageBackend and other subsystems 23 * (such as UI) which need to update and listen for said event (such as preview completition). 24 */ 25 public interface ImageProcessorListener { 26 27 /* 28 * !!!!PLACEHOLDER IMPLEMENTATION!!!! Unclear what the best pattern for listeners, given the 29 * types of tasks and the return types For now, I've gone with a minimal interface that is not 30 * currently plumbed for error handling. 31 */ 32 33 /** 34 * Called when a task starts running. 35 * 36 * @param task Task specification that includes unique content id 37 */ onStart(TaskImageContainer.TaskInfo task)38 public void onStart(TaskImageContainer.TaskInfo task); 39 40 /** 41 * Called when compressed image is complete and is ready for further processing 42 * 43 * @param task Task specification that includes unique content id 44 * @param payload Byte array that contains the compressed image data 45 */ onResultCompressed(TaskImageContainer.TaskInfo task, TaskImageContainer.CompressedPayload payload)46 public void onResultCompressed(TaskImageContainer.TaskInfo task, 47 TaskImageContainer.CompressedPayload payload); 48 49 /** 50 * Called when uncompressed image conversion is done and is ready for further processing 51 * 52 * @param task Task specification that includes unique content id 53 * @param payload 32-bit Integer array that contains the uncompressed image data 54 */ onResultUncompressed(TaskImageContainer.TaskInfo task, TaskImageContainer.UncompressedPayload payload)55 public void onResultUncompressed(TaskImageContainer.TaskInfo task, 56 TaskImageContainer.UncompressedPayload payload); 57 58 /** 59 * Called when image has been written to disk and ready for further processing via uri. 60 * 61 * @param task Task specification that includes unique content id 62 * @param uri Uri that serves as handle to image written to disk 63 */ onResultUri(TaskImageContainer.TaskInfo task, Uri uri)64 public void onResultUri(TaskImageContainer.TaskInfo task, Uri uri); 65 66 // TODO: Figure out how to best error handling interface 67 // public void onError(TaskImageContainer.JobInfo task); 68 } 69