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 com.android.settingslib.volume.data.repository 18 19 import com.android.settingslib.volume.shared.AudioSharingLogger 20 import java.util.concurrent.CopyOnWriteArrayList 21 22 class FakeAudioSharingRepositoryLogger : AudioSharingLogger { 23 private val mutableLogs = CopyOnWriteArrayList<String>() 24 val logs: List<String> 25 get() = mutableLogs.toList() 26 resetnull27 fun reset() { 28 mutableLogs.clear() 29 } 30 onAudioSharingStateChangednull31 override fun onAudioSharingStateChanged(state: Boolean) { 32 mutableLogs.add("onAudioSharingStateChanged state=$state") 33 } 34 onSecondaryGroupIdChangednull35 override fun onSecondaryGroupIdChanged(groupId: Int) { 36 mutableLogs.add("onSecondaryGroupIdChanged groupId=$groupId") 37 } 38 onVolumeMapChangednull39 override fun onVolumeMapChanged(map: GroupIdToVolumes) { 40 mutableLogs.add("onVolumeMapChanged map=$map") 41 } 42 onSetDeviceVolumeRequestednull43 override fun onSetDeviceVolumeRequested(volume: Int) { 44 mutableLogs.add("onSetVolumeRequested volume=$volume") 45 } 46 onAudioSharingAvailabilityRequestedErrornull47 override fun onAudioSharingAvailabilityRequestedError(requestFrom: String, e: String) { 48 mutableLogs.add("onAudioSharingAvailabilityRequestedError, requestFrom=$requestFrom") 49 } 50 }