1 /* 2 * Copyright (C) 2015 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.captureintent.resource; 18 19 import com.android.camera.async.MainThread; 20 import com.android.camera.async.RefCountBase; 21 import com.android.camera.async.SafeCloseable; 22 import com.android.camera.captureintent.CaptureIntentModuleUI; 23 import com.android.camera.one.OneCamera; 24 import com.android.camera.session.CaptureSessionManager; 25 import com.android.camera.ui.TouchCoordinate; 26 import com.android.camera.ui.focus.FocusController; 27 28 import android.media.MediaActionSound; 29 30 import javax.annotation.Nullable; 31 32 /** 33 * Defines an interface that any implementation of this should retain necessary 34 * resources to capture a photo. 35 */ 36 public interface ResourceCaptureTools extends SafeCloseable { 37 public static interface CaptureLoggingInfo { getTouchPointInsideShutterButton()38 public @Nullable TouchCoordinate getTouchPointInsideShutterButton(); getCountDownDuration()39 public int getCountDownDuration(); 40 } 41 42 /** 43 * Sends a photo capture request to the underlying camera system 44 * immediately. 45 * 46 * @param pictureCallback A {@link com.android.camera.one.OneCamera.PictureCallback}. 47 * @param captureLoggingInfo A {@link CaptureLoggingInfo}. 48 */ takePictureNow( OneCamera.PictureCallback pictureCallback, CaptureLoggingInfo captureLoggingInfo)49 void takePictureNow( 50 OneCamera.PictureCallback pictureCallback, 51 CaptureLoggingInfo captureLoggingInfo); 52 53 /** 54 * Plays the sound for a specific remaining second when counting down. 55 * 56 * @param remainingSeconds The remaining seconds. 57 */ playCountDownSound(int remainingSeconds)58 void playCountDownSound(int remainingSeconds); 59 60 /** 61 * Obtains the associated @{link ResourceConstructed}. 62 * 63 * @return A ref counted ResourceConstructed object. 64 */ getResourceConstructed()65 RefCountBase<ResourceConstructed> getResourceConstructed(); 66 67 /** 68 * Obtains the associated @{link ResourceSurfaceTexture}. 69 * 70 * @return A ref counted ResourceSurfaceTexture object. 71 */ getResourceSurfaceTexture()72 RefCountBase<ResourceSurfaceTexture> getResourceSurfaceTexture(); 73 74 /** 75 * Obtains the associated @{link ResourceOpenedCamera}. 76 * 77 * @return A ref counted ResourceOpenedCamera object. 78 */ getResourceOpenedCamera()79 RefCountBase<ResourceOpenedCamera> getResourceOpenedCamera(); 80 81 /** 82 * Obtains the capture session manager to start a new capture. 83 * 84 * @return A {@link com.android.camera.session.CaptureSessionManager} object. 85 */ getCaptureSessionManager()86 CaptureSessionManager getCaptureSessionManager(); 87 88 /** 89 * Obtains the focus controller to control focus ring. 90 * 91 * @return A {@link com.android.camera.ui.focus.FocusController} object. 92 */ getFocusController()93 FocusController getFocusController(); 94 95 /** 96 * Obtains the media action sound. 97 * 98 * @return A {@link android.media.MediaActionSound} object. 99 */ getMediaActionSound()100 MediaActionSound getMediaActionSound(); 101 102 /** 103 * Obtains the main thread. 104 * 105 * @return A {@link com.android.camera.async.MainThread} object. 106 */ getMainThread()107 MainThread getMainThread(); 108 109 /** 110 * Obtains the UI object associated with this module. 111 * 112 * @return A {@link com.android.camera.captureintent.CaptureIntentModuleUI} 113 * object. 114 */ getModuleUI()115 CaptureIntentModuleUI getModuleUI(); 116 117 /** 118 * Obtains the opened camera. 119 * 120 * @return A {@link com.android.camera.one.OneCamera} object. 121 */ getCamera()122 OneCamera getCamera(); 123 } 124