1 /* 2 * Copyright 2021 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 androidx.camera.camera2.pipe.graph 18 19 import androidx.camera.camera2.pipe.CameraGraph 20 import androidx.camera.camera2.pipe.GraphState.GraphStateError 21 22 @JvmDefaultWithCompatibility 23 public interface GraphListener { 24 /** 25 * Used to indicate that the graph is starting. This is called immediately when a [CameraGraph] 26 * is being started. 27 */ onGraphStartingnull28 public fun onGraphStarting() {} 29 30 /** 31 * Used to indicate that the graph has been initialized and is ready to actively process 32 * requests using the provided [GraphRequestProcessor] interface. 33 */ onGraphStartednull34 public fun onGraphStarted(requestProcessor: GraphRequestProcessor) 35 36 /** 37 * Used to indicate that the graph is stopping. This is called immediately when a [CameraGraph] 38 * is being stopped. 39 */ 40 public fun onGraphStopping() {} 41 42 /** 43 * Used to indicate that a previously initialized [GraphRequestProcessor] is no longer 44 * available. 45 */ onGraphStoppednull46 public fun onGraphStopped(requestProcessor: GraphRequestProcessor?) 47 48 /** 49 * Used to indicate that the internal state of the [GraphRequestProcessor] has changed. This is 50 * a signal that previously queued requests may now succeed if they previously failed. 51 */ 52 public fun onGraphModified(requestProcessor: GraphRequestProcessor) 53 54 /** Used to indicate that the graph has encountered an error. */ 55 public fun onGraphError(graphStateError: GraphStateError) 56 } 57