1 /*
2  * Copyright (C) 2021 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.cts.verifier.audio.audiolib;
18 
19 import android.content.Context;
20 import android.content.pm.PackageManager;
21 import android.media.AudioDeviceInfo;
22 import android.util.Log;
23 
24 public class AudioSystemFlags {
25     static final String TAG = AudioSystemFlags.class.getName();
26 
claimsOutput(Context context)27     public static boolean claimsOutput(Context context) {
28         return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUDIO_OUTPUT);
29     }
30 
claimsInput(Context context)31     public static boolean claimsInput(Context context) {
32         return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_MICROPHONE);
33     }
34 
claimsProAudio(Context context)35     public static boolean claimsProAudio(Context context) {
36         return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUDIO_PRO);
37     }
38 
claimsLowLatencyAudio(Context context)39     public static boolean claimsLowLatencyAudio(Context context) {
40         // CDD Section C-1-1: android.hardware.audio.low_latency
41         return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUDIO_LOW_LATENCY);
42     }
43 
claimsMIDI(Context context)44     public static boolean claimsMIDI(Context context) {
45         // CDD Section C-1-4: android.software.midi
46         return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_MIDI);
47     }
48 
claimsUSBHostMode(Context context)49     public static boolean claimsUSBHostMode(Context context) {
50         return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_USB_HOST);
51     }
52 
claimsUSBPeripheralMode(Context context)53     public static boolean claimsUSBPeripheralMode(Context context) {
54         return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_USB_ACCESSORY);
55     }
56 }
57