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 com.android.bluetooth.btservice.storage; 18 19 import android.bluetooth.BluetoothSinkAudioPolicy; 20 21 import androidx.room.ColumnInfo; 22 import androidx.room.Entity; 23 24 @Entity 25 class AudioPolicyEntity { 26 @ColumnInfo(name = "call_establish_audio_policy") 27 public int callEstablishAudioPolicy; 28 29 @ColumnInfo(name = "connecting_time_audio_policy") 30 public int connectingTimeAudioPolicy; 31 32 @ColumnInfo(name = "in_band_ringtone_audio_policy") 33 public int inBandRingtoneAudioPolicy; 34 AudioPolicyEntity()35 AudioPolicyEntity() { 36 callEstablishAudioPolicy = BluetoothSinkAudioPolicy.POLICY_UNCONFIGURED; 37 connectingTimeAudioPolicy = BluetoothSinkAudioPolicy.POLICY_UNCONFIGURED; 38 inBandRingtoneAudioPolicy = BluetoothSinkAudioPolicy.POLICY_UNCONFIGURED; 39 } 40 toString()41 public String toString() { 42 StringBuilder builder = new StringBuilder(); 43 builder.append("callEstablishAudioPolicy=") 44 .append(metadataToString(callEstablishAudioPolicy)) 45 .append("|connectingTimeAudioPolicy=") 46 .append(metadataToString(connectingTimeAudioPolicy)) 47 .append("|inBandRingtoneAudioPolicy=") 48 .append(metadataToString(inBandRingtoneAudioPolicy)); 49 50 return builder.toString(); 51 } 52 metadataToString(int metadata)53 private String metadataToString(int metadata) { 54 return String.valueOf(metadata); 55 } 56 } 57