1 /* 2 * Copyright (C) 2023 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.settingslib.bluetooth; 18 19 import android.media.AudioAttributes; 20 import android.media.AudioDeviceAttributes; 21 import android.media.AudioDeviceInfo; 22 23 import androidx.annotation.IntDef; 24 25 import java.lang.annotation.Retention; 26 import java.lang.annotation.RetentionPolicy; 27 28 /** 29 * Constant values used to configure hearing aid audio routing. 30 * 31 * {@link HearingAidAudioRoutingHelper} 32 */ 33 public final class HearingAidAudioRoutingConstants { 34 public static final int[] CALL_ROUTING_ATTRIBUTES = new int[] { 35 // Stands for STRATEGY_PHONE 36 AudioAttributes.USAGE_VOICE_COMMUNICATION, 37 }; 38 39 public static final int[] MEDIA_ROUTING_ATTRIBUTES = new int[] { 40 // Stands for STRATEGY_MEDIA, including USAGE_GAME, USAGE_ASSISTANT, 41 // USAGE_ASSISTANCE_NAVIGATION_GUIDANCE, USAGE_ASSISTANCE_SONIFICATION 42 AudioAttributes.USAGE_MEDIA 43 }; 44 45 public static final int[] RINGTONE_ROUTING_ATTRIBUTE = new int[] { 46 // Stands for STRATEGY_SONIFICATION, including USAGE_ALARM 47 AudioAttributes.USAGE_NOTIFICATION_RINGTONE 48 }; 49 50 public static final int[] SYSTEM_SOUNDS_ROUTING_ATTRIBUTES = new int[] { 51 // Stands for STRATEGY_SONIFICATION_RESPECTFUL, including USAGE_NOTIFICATION_EVENT 52 AudioAttributes.USAGE_NOTIFICATION, 53 // Stands for STRATEGY_ACCESSIBILITY 54 AudioAttributes.USAGE_ASSISTANCE_ACCESSIBILITY, 55 // Stands for STRATEGY_DTMF 56 AudioAttributes.USAGE_VOICE_COMMUNICATION_SIGNALLING, 57 }; 58 59 @Retention(RetentionPolicy.SOURCE) 60 @IntDef({ 61 RoutingValue.AUTO, 62 RoutingValue.HEARING_DEVICE, 63 RoutingValue.DEVICE_SPEAKER, 64 }) 65 66 public @interface RoutingValue { 67 int AUTO = 0; 68 int HEARING_DEVICE = 1; 69 int DEVICE_SPEAKER = 2; 70 } 71 72 public static final AudioDeviceAttributes DEVICE_SPEAKER_OUT = new AudioDeviceAttributes( 73 AudioDeviceAttributes.ROLE_OUTPUT, AudioDeviceInfo.TYPE_BUILTIN_SPEAKER, ""); 74 } 75