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 // Stands for STRATEGY_ACCESSIBILITY 44 AudioAttributes.USAGE_ASSISTANCE_ACCESSIBILITY, 45 // Stands for STRATEGY_DTMF 46 AudioAttributes.USAGE_VOICE_COMMUNICATION_SIGNALLING, 47 }; 48 49 public static final int[] RINGTONE_ROUTING_ATTRIBUTES = new int[] { 50 // Stands for STRATEGY_SONIFICATION, including USAGE_ALARM 51 AudioAttributes.USAGE_NOTIFICATION_RINGTONE 52 }; 53 54 public static final int[] NOTIFICATION_ROUTING_ATTRIBUTES = new int[] { 55 // Stands for STRATEGY_SONIFICATION_RESPECTFUL, including USAGE_NOTIFICATION_EVENT 56 AudioAttributes.USAGE_NOTIFICATION, 57 58 }; 59 60 @Retention(RetentionPolicy.SOURCE) 61 @IntDef({ 62 RoutingValue.AUTO, 63 RoutingValue.HEARING_DEVICE, 64 RoutingValue.DEVICE_SPEAKER, 65 }) 66 67 public @interface RoutingValue { 68 int AUTO = 0; 69 int HEARING_DEVICE = 1; 70 int DEVICE_SPEAKER = 2; 71 } 72 73 public static final AudioDeviceAttributes DEVICE_SPEAKER_OUT = new AudioDeviceAttributes( 74 AudioDeviceAttributes.ROLE_OUTPUT, AudioDeviceInfo.TYPE_BUILTIN_SPEAKER, ""); 75 } 76