1 /*
2  * Copyright 2022 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.video.internal.compat.quirk;
18 
19 import android.os.Build;
20 
21 import androidx.camera.core.impl.Quirk;
22 
23 /**
24  * A quirk to denote the devices cannot use the {@link android.provider.MediaStore.Video} to
25  * create {@link androidx.camera.video.MediaStoreOutputOptions} for video recording.
26  *
27  * <p>QuirkSummary
28  *     Bug Id: 223576109
29  *     Description: Devices cannot successfully open the output stream and file descriptor for
30  *                  {@link android.provider.MediaStore.Video}. Using
31  *                  {@link androidx.camera.video.FileOutputOptions} or storing the file to a
32  *                  different position can workaround this issue.
33  *     Device(s): Twist 2 Pro and Itel w6004
34  */
35 public class MediaStoreVideoCannotWrite implements Quirk {
36 
isPositivoTwist2Pro()37     public static boolean isPositivoTwist2Pro() {
38         return "positivo".equalsIgnoreCase(Build.BRAND) && "twist 2 pro".equalsIgnoreCase(
39                 Build.MODEL);
40     }
41 
isItelW6004()42     public static boolean isItelW6004() {
43         return "itel".equalsIgnoreCase(Build.BRAND) && "itel w6004".equalsIgnoreCase(Build.MODEL);
44     }
45 
load()46     static boolean load() {
47         return isPositivoTwist2Pro() || isItelW6004();
48     }
49 
50 }
51