1 /* 2 * Copyright (C) 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.server.hdmi; 18 19 import static android.media.AudioDeviceVolumeManager.OnAudioDeviceVolumeChangedListener; 20 import static android.media.AudioDeviceVolumeManager.OnDeviceVolumeBehaviorChangedListener; 21 22 import android.annotation.CallbackExecutor; 23 import android.annotation.NonNull; 24 import android.media.AudioDeviceAttributes; 25 import android.media.AudioDeviceVolumeManager; 26 import android.media.VolumeInfo; 27 28 import java.util.concurrent.Executor; 29 30 /** 31 * Interface with the methods from {@link AudioDeviceVolumeManager} used by the HDMI framework. 32 * Allows the class to be faked for tests. 33 * 34 * See implementations {@link DefaultAudioDeviceVolumeManagerWrapper} and 35 * {@link FakeAudioFramework.FakeAudioDeviceVolumeManagerWrapper}. 36 */ 37 public interface AudioDeviceVolumeManagerWrapper { 38 39 /** 40 * Wrapper for {@link AudioDeviceVolumeManager#addOnDeviceVolumeBehaviorChangedListener( 41 * Executor, OnDeviceVolumeBehaviorChangedListener)} 42 */ addOnDeviceVolumeBehaviorChangedListener( @onNull @allbackExecutor Executor executor, @NonNull AudioDeviceVolumeManager.OnDeviceVolumeBehaviorChangedListener listener)43 void addOnDeviceVolumeBehaviorChangedListener( 44 @NonNull @CallbackExecutor Executor executor, 45 @NonNull AudioDeviceVolumeManager.OnDeviceVolumeBehaviorChangedListener listener); 46 47 /** 48 * Wrapper for {@link AudioDeviceVolumeManager#removeOnDeviceVolumeBehaviorChangedListener( 49 * OnDeviceVolumeBehaviorChangedListener)} 50 */ removeOnDeviceVolumeBehaviorChangedListener( @onNull AudioDeviceVolumeManager.OnDeviceVolumeBehaviorChangedListener listener)51 void removeOnDeviceVolumeBehaviorChangedListener( 52 @NonNull AudioDeviceVolumeManager.OnDeviceVolumeBehaviorChangedListener listener); 53 54 /** 55 * Wrapper for {@link AudioDeviceVolumeManager#setDeviceAbsoluteVolumeBehavior( 56 * AudioDeviceAttributes, VolumeInfo, Executor, OnAudioDeviceVolumeChangedListener, boolean)} 57 */ setDeviceAbsoluteVolumeBehavior( @onNull AudioDeviceAttributes device, @NonNull VolumeInfo volume, @NonNull @CallbackExecutor Executor executor, @NonNull AudioDeviceVolumeManager.OnAudioDeviceVolumeChangedListener vclistener, boolean handlesVolumeAdjustment)58 void setDeviceAbsoluteVolumeBehavior( 59 @NonNull AudioDeviceAttributes device, 60 @NonNull VolumeInfo volume, 61 @NonNull @CallbackExecutor Executor executor, 62 @NonNull AudioDeviceVolumeManager.OnAudioDeviceVolumeChangedListener vclistener, 63 boolean handlesVolumeAdjustment); 64 65 /** 66 * Wrapper for {@link AudioDeviceVolumeManager#setDeviceAbsoluteVolumeAdjustOnlyBehavior( 67 * AudioDeviceAttributes, VolumeInfo, Executor, OnAudioDeviceVolumeChangedListener, boolean)} 68 */ setDeviceAbsoluteVolumeAdjustOnlyBehavior( @onNull AudioDeviceAttributes device, @NonNull VolumeInfo volume, @NonNull @CallbackExecutor Executor executor, @NonNull AudioDeviceVolumeManager.OnAudioDeviceVolumeChangedListener vclistener, boolean handlesVolumeAdjustment)69 void setDeviceAbsoluteVolumeAdjustOnlyBehavior( 70 @NonNull AudioDeviceAttributes device, 71 @NonNull VolumeInfo volume, 72 @NonNull @CallbackExecutor Executor executor, 73 @NonNull AudioDeviceVolumeManager.OnAudioDeviceVolumeChangedListener vclistener, 74 boolean handlesVolumeAdjustment); 75 } 76