/*
 * Copyright 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package androidx.camera.video.internal.compat.quirk;

import android.os.Build;

import androidx.annotation.RequiresApi;
import androidx.camera.core.impl.Quirk;

/**
 * <p>QuirkSummary
 *     Bug Id: b/239369953
 *     Description: When taking image with VideoCapture is bound, the capture result is returned
 *                  but the resulting image can not be obtained.
 *     Device(s): BLU Studio X10, Itel w6004, and Vivo 1805.
 */
@RequiresApi(21) // TODO(b/200306659): Remove and replace with annotation on package-info.java
public class ImageCaptureFailedWhenVideoCaptureIsBoundQuirk implements Quirk {

    static boolean load() {
        return isBluStudioX10() || isItelW6004() || isVivo1805();
    }

    public static boolean isBluStudioX10() {
        return "blu".equalsIgnoreCase(Build.BRAND) && "studio x10".equalsIgnoreCase(Build.MODEL);
    }

    public static boolean isItelW6004() {
        return "itel".equalsIgnoreCase(Build.BRAND) && "itel w6004".equalsIgnoreCase(Build.MODEL);
    }

    public static boolean isVivo1805() {
        return "vivo".equalsIgnoreCase(Build.BRAND) && "vivo 1805".equalsIgnoreCase(Build.MODEL);
    }
}

@@ -1028,16 +1028,29 @@
 l w6004,
+ Twist 2 Pro,
  and Viv
@@ -1057,16 +1057,16 @@
 o 1805.%0A
-
  */%0A@Req
@@ -1328,16 +1328,41 @@
 vo1805()
+ %7C%7C isPositivoTwist2Pro()
 ;%0A    %7D%0A
@@ -1697,24 +1697,24 @@
 ivo1805() %7B%0A
-
         retu
@@ -1804,11 +1804,189 @@
 );%0A    %7D
+%0A%0A    public static boolean isPositivoTwist2Pro() %7B%0A        return %22positivo%22.equalsIgnoreCase(Build.BRAND) && %22twist 2 pro%22.equalsIgnoreCase(%0A                Build.MODEL);%0A    %7D
 %0A%7D%0A

Fix image capture no result when VideoCapture is bound on Twist 2 Pro