Home | History | Annotate | Download | only in photo
      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.one.v2.photo;
     18 
     19 import android.hardware.camera2.CameraCharacteristics;
     20 
     21 import com.android.camera.async.MainThread;
     22 import com.android.camera.one.v2.commands.CameraCommandExecutor;
     23 import com.android.camera.one.v2.core.FrameServer;
     24 import com.android.camera.one.v2.core.RequestBuilder;
     25 import com.android.camera.one.v2.imagesaver.ImageSaver;
     26 import com.android.camera.one.v2.sharedimagereader.ManagedImageReader;
     27 
     28 import javax.annotation.Nonnull;
     29 import javax.annotation.ParametersAreNonnullByDefault;
     30 
     31 /**
     32  * Creates a {@link PictureTaker} for devices which only support
     33  * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY}.
     34  */
     35 @ParametersAreNonnullByDefault
     36 public final class LegacyPictureTakerFactory {
     37     private final PictureTaker mPictureTaker;
     38 
     39     public LegacyPictureTakerFactory(ImageSaver.Builder imageSaverBuilder,
     40             CameraCommandExecutor cameraCommandExecutor, MainThread mainExecutor, FrameServer
     41             frameServer, RequestBuilder.Factory rootRequestBuilder,
     42             ManagedImageReader imageReader) {
     43         SimpleImageCaptureCommand imageCaptureCommand = new SimpleImageCaptureCommand(frameServer,
     44                 rootRequestBuilder, imageReader);
     45         mPictureTaker = new PictureTakerImpl(mainExecutor, cameraCommandExecutor,
     46                 imageSaverBuilder, imageCaptureCommand);
     47     }
     48 
     49     @Nonnull
     50     public PictureTaker providePictureTaker() {
     51         return mPictureTaker;
     52     }
     53 }
     54