• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.AudioManager;
27 import android.media.VolumeInfo;
28 
29 import java.util.concurrent.Executor;
30 
31 /**
32  * Interface with the methods from {@link AudioDeviceVolumeManager} used by the HDMI framework.
33  * Allows the class to be faked for tests.
34  *
35  * See implementations {@link DefaultAudioDeviceVolumeManagerWrapper} and
36  * {@link FakeAudioFramework.FakeAudioDeviceVolumeManagerWrapper}.
37  */
38 public interface AudioDeviceVolumeManagerWrapper {
39 
40     /**
41      * Wrapper for {@link AudioDeviceVolumeManager#addOnDeviceVolumeBehaviorChangedListener(
42      * Executor, OnDeviceVolumeBehaviorChangedListener)}
43      */
addOnDeviceVolumeBehaviorChangedListener( @onNull @allbackExecutor Executor executor, @NonNull AudioDeviceVolumeManager.OnDeviceVolumeBehaviorChangedListener listener)44     void addOnDeviceVolumeBehaviorChangedListener(
45             @NonNull @CallbackExecutor Executor executor,
46             @NonNull AudioDeviceVolumeManager.OnDeviceVolumeBehaviorChangedListener listener);
47 
48     /**
49      * Wrapper for {@link AudioDeviceVolumeManager#removeOnDeviceVolumeBehaviorChangedListener(
50      * OnDeviceVolumeBehaviorChangedListener)}
51      */
removeOnDeviceVolumeBehaviorChangedListener( @onNull AudioDeviceVolumeManager.OnDeviceVolumeBehaviorChangedListener listener)52     void removeOnDeviceVolumeBehaviorChangedListener(
53             @NonNull AudioDeviceVolumeManager.OnDeviceVolumeBehaviorChangedListener listener);
54 
55     /**
56      * Wrapper for {@link AudioDeviceVolumeManager#setDeviceAbsoluteVolumeBehavior(
57      * AudioDeviceAttributes, VolumeInfo, boolean, Executor, OnAudioDeviceVolumeChangedListener)}
58      */
setDeviceAbsoluteVolumeBehavior( @onNull AudioDeviceAttributes device, @NonNull VolumeInfo volume, boolean handlesVolumeAdjustment, @NonNull @CallbackExecutor Executor executor, @NonNull AudioDeviceVolumeManager.OnAudioDeviceVolumeChangedListener vclistener)59     void setDeviceAbsoluteVolumeBehavior(
60             @NonNull AudioDeviceAttributes device,
61             @NonNull VolumeInfo volume,
62             boolean handlesVolumeAdjustment,
63             @NonNull @CallbackExecutor Executor executor,
64             @NonNull AudioDeviceVolumeManager.OnAudioDeviceVolumeChangedListener vclistener);
65 
66     /**
67      * Wrapper for {@link AudioDeviceVolumeManager#setDeviceAbsoluteVolumeAdjustOnlyBehavior(
68      * AudioDeviceAttributes, VolumeInfo, boolean, Executor, OnAudioDeviceVolumeChangedListener)}
69      */
setDeviceAbsoluteVolumeAdjustOnlyBehavior( @onNull AudioDeviceAttributes device, @NonNull VolumeInfo volume, boolean handlesVolumeAdjustment, @NonNull @CallbackExecutor Executor executor, @NonNull AudioDeviceVolumeManager.OnAudioDeviceVolumeChangedListener vclistener)70     void setDeviceAbsoluteVolumeAdjustOnlyBehavior(
71             @NonNull AudioDeviceAttributes device,
72             @NonNull VolumeInfo volume,
73             boolean handlesVolumeAdjustment,
74             @NonNull @CallbackExecutor Executor executor,
75             @NonNull AudioDeviceVolumeManager.OnAudioDeviceVolumeChangedListener vclistener);
76 
77     /**
78      * Wraps {@link AudioDeviceVolumeManager#getDeviceVolumeBehavior(AudioDeviceAttributes)}
79      */
80     @AudioManager.DeviceVolumeBehavior
getDeviceVolumeBehavior(@onNull AudioDeviceAttributes device)81     int getDeviceVolumeBehavior(@NonNull AudioDeviceAttributes device);
82 
83     /**
84      * Wraps {@link AudioDeviceVolumeManager#setDeviceVolumeBehavior(AudioDeviceAttributes, int)}
85      */
setDeviceVolumeBehavior(@onNull AudioDeviceAttributes device, @AudioDeviceVolumeManager.DeviceVolumeBehavior int deviceVolumeBehavior)86     void setDeviceVolumeBehavior(@NonNull AudioDeviceAttributes device,
87             @AudioDeviceVolumeManager.DeviceVolumeBehavior int deviceVolumeBehavior);
88 }
89