1 /*
2  * Copyright (C) 2024 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 android.mediapc.cts.common;
18 
19 import android.os.Build;
20 
21 /**
22  * Constructors and measurement setters for EGL MPC requirements.
23  */
24 public final class EglRequirement extends Requirement {
25 
26     /**
27      * <b>7.1.4.1/H-1-2</b> MUST support the {@code EGL_IMG_context_priority} and
28      * {@code EGL_EXT_protected_content}
29      * extensions.
30      */
createR7_1_4_1__H_1_2()31     public static EglRequirement createR7_1_4_1__H_1_2() {
32         RequiredMeasurement<Boolean> protected_content =
33                 RequiredMeasurement.<Boolean>builder().setId(
34                                 RequirementConstants.EGL_EXT_PROTECTED_CONTENT)
35                         .setPredicate(RequirementConstants.BOOLEAN_EQ)
36                         .addRequiredValue(Build.VERSION_CODES.VANILLA_ICE_CREAM, true)
37                         .build();
38         RequiredMeasurement<Boolean> img_context_priority =
39                 RequiredMeasurement.<Boolean>builder().setId(
40                                 RequirementConstants.EGL_IMG_CONTEXT_PRIORITY)
41                         .setPredicate(RequirementConstants.BOOLEAN_EQ)
42                         .addRequiredValue(Build.VERSION_CODES.VANILLA_ICE_CREAM, true)
43                         .build();
44 
45         return new EglRequirement(RequirementConstants.R7_1_4_1__H_1_2,
46                 protected_content, img_context_priority);
47     }
48 
EglRequirement(String id, RequiredMeasurement<?>... reqs)49     private EglRequirement(String id, RequiredMeasurement<?>... reqs) {
50         super(id, reqs);
51     }
52 
53     /** Is EGL_IMG_context_priority supported. */
setImageContextPrioritySupported(boolean supported)54     public void setImageContextPrioritySupported(boolean supported) {
55         this.setMeasuredValue(RequirementConstants.EGL_IMG_CONTEXT_PRIORITY, supported);
56     }
57 
58     /** Is EGL_EXT_protected_content supported. */
setProtectedContentSupported(boolean supported)59     public void setProtectedContentSupported(boolean supported) {
60         this.setMeasuredValue(RequirementConstants.EGL_EXT_PROTECTED_CONTENT, supported);
61     }
62 }
63