1 /* 2 * Copyright 2019 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.core; 18 19 import androidx.annotation.RestrictTo; 20 21 import org.jspecify.annotations.NonNull; 22 23 /** 24 * Result of the {@link CameraControl#startFocusAndMetering(FocusMeteringAction)}. 25 */ 26 public final class FocusMeteringResult { 27 private boolean mIsFocusSuccessful; 28 29 @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) emptyInstance()30 public static @NonNull FocusMeteringResult emptyInstance() { 31 return new FocusMeteringResult(false); 32 } 33 34 @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) create(boolean isFocusSuccess)35 public static @NonNull FocusMeteringResult create(boolean isFocusSuccess) { 36 return new FocusMeteringResult(isFocusSuccess); 37 } 38 FocusMeteringResult(boolean isFocusSuccess)39 private FocusMeteringResult(boolean isFocusSuccess) { 40 mIsFocusSuccessful = isFocusSuccess; 41 } 42 43 /** 44 * Returns if auto focus is successful. 45 * 46 * <p>If AF is requested in {@link FocusMeteringAction} but current camera does not support 47 * AF, it will return true. If AF is not requested, it will return false. 48 */ isFocusSuccessful()49 public boolean isFocusSuccessful() { 50 return mIsFocusSuccessful; 51 } 52 } 53