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 package android.car.oem;
17 
18 import android.annotation.NonNull;
19 import android.media.AudioFocusInfo;
20 
21 import java.io.PrintWriter;
22 import java.util.List;
23 
24 /**
25  * This code will be running as part of the OEM Service. This implements
26  * {@code IOemCarAudioFocusService} as hidden class. It is exposed as IBinder from {@link
27  * OemCarService#getOemAudioFocusService()}
28  *
29  * @hide
30  */
31 final class OemCarAudioFocusServiceImpl extends IOemCarAudioFocusService.Stub
32         implements OemCarServiceComponent {
33 
34     private final OemCarAudioFocusService mOemCarAudioFocusService;
35 
OemCarAudioFocusServiceImpl( @onNull OemCarAudioFocusService oemCarAudioFocusService)36     OemCarAudioFocusServiceImpl(
37             @NonNull OemCarAudioFocusService oemCarAudioFocusService) {
38         mOemCarAudioFocusService = oemCarAudioFocusService;
39     }
40 
41     @Override
notifyAudioFocusChange(@onNull List<AudioFocusInfo> currentFocusHolders, @NonNull List<AudioFocusInfo> currentFocusLosers, int zoneId)42     public void notifyAudioFocusChange(@NonNull List<AudioFocusInfo> currentFocusHolders,
43             @NonNull List<AudioFocusInfo> currentFocusLosers, int zoneId) {
44         mOemCarAudioFocusService.notifyAudioFocusChange(currentFocusHolders, currentFocusLosers,
45                 zoneId);
46     }
47 
48     @Override
49     @NonNull
evaluateAudioFocusRequest( @onNull OemCarAudioFocusEvaluationRequest request)50     public OemCarAudioFocusResult evaluateAudioFocusRequest(
51             @NonNull OemCarAudioFocusEvaluationRequest request) {
52         return mOemCarAudioFocusService.evaluateAudioFocusRequest(request);
53     }
54 
55     @Override
init()56     public void init() {
57         mOemCarAudioFocusService.init();
58     }
59 
60     @Override
release()61     public void release() {
62         mOemCarAudioFocusService.release();
63     }
64 
65     @Override
dump(PrintWriter writer, String[] args)66     public void dump(PrintWriter writer, String[] args) {
67         mOemCarAudioFocusService.dump(writer, args);
68     }
69 
70     @Override
onCarServiceReady()71     public void onCarServiceReady() {
72         mOemCarAudioFocusService.onCarServiceReady();
73     }
74 }
75