1b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde/* 2b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde * Copyright (C) 2015 The Android Open Source Project 3b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde * 4b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde * Licensed under the Apache License, Version 2.0 (the "License"); 5b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde * you may not use this file except in compliance with the License. 6b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde * You may obtain a copy of the License at 7b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde * 8b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde * http://www.apache.org/licenses/LICENSE-2.0 9b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde * 10b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde * Unless required by applicable law or agreed to in writing, software 11b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde * distributed under the License is distributed on an "AS IS" BASIS, 12b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde * See the License for the specific language governing permissions and 14b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde * limitations under the License. 15b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde */ 16b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde 17b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohdepackage com.android.camera.device; 18b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde 19b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohdeimport android.hardware.camera2.CameraDevice; 20b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohdeimport android.hardware.camera2.CameraManager; 21b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde 22b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohdeimport com.android.camera.async.HandlerFactory; 23b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohdeimport com.android.camera.debug.Logger; 24b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde 25b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohdeimport java.util.concurrent.ExecutorService; 26b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde 27b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde/** 28b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde * Provides a set of executable actions that can be used to open or close 29b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde * a Camera2 API camera device. 30b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde */ 311d84d7107686aa428ee2eeb1a8caf0ea3e43b1dfPaul Rohdepublic class Camera2ActionProvider implements CameraDeviceActionProvider<CameraDevice> { 32b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde private final CameraManager mCameraManager; 33b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde private final HandlerFactory mHandlerFactory; 34b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde private final ExecutorService mBackgroundRunner; 35b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde private final Logger.Factory mLogFactory; 36b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde 37b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde public Camera2ActionProvider(CameraManager cameraManager, HandlerFactory handlerFactory, 38b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde ExecutorService backgroundRunner, Logger.Factory logFactory) { 39b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde mCameraManager = cameraManager; 40b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde mHandlerFactory = handlerFactory; 41b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde mBackgroundRunner = backgroundRunner; 42b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde mLogFactory = logFactory; 43b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde } 44b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde 45b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde @Override 461d84d7107686aa428ee2eeb1a8caf0ea3e43b1dfPaul Rohde public SingleDeviceActions<CameraDevice> get(CameraDeviceKey key) { 47b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde return new Camera2Actions(key, mCameraManager, mBackgroundRunner, mHandlerFactory, 48b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde mLogFactory); 49b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde } 50b6a4d96a310a1dee22ddea89b09130bcda206bb3Paul Rohde} 51