• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.server.telecom;
18 
19 import static com.android.server.telecom.voip.VideoStateTranslation.TransactionalVideoStateToString;
20 
21 import android.telecom.Log;
22 
23 public class CachedVideoStateChange implements CachedCallback {
24     public static final String ID = CachedVideoStateChange.class.getSimpleName();
25     int mCurrentVideoState;
26 
getCurrentCallEndpoint()27     public int getCurrentCallEndpoint() {
28         return mCurrentVideoState;
29     }
30 
CachedVideoStateChange(int videoState)31     public CachedVideoStateChange(int videoState) {
32         mCurrentVideoState = videoState;
33     }
34 
35     @Override
executeCallback(CallSourceService service, Call call)36     public void executeCallback(CallSourceService service, Call call) {
37         service.onVideoStateChanged(call, mCurrentVideoState);
38         Log.addEvent(call, LogUtils.Events.VIDEO_STATE_CHANGED,
39                 TransactionalVideoStateToString(mCurrentVideoState));
40     }
41 
42     @Override
getCallbackId()43     public String getCallbackId() {
44         return ID;
45     }
46 
47     @Override
hashCode()48     public int hashCode() {
49         return mCurrentVideoState;
50     }
51 
52     @Override
equals(Object obj)53     public boolean equals(Object obj){
54         if (obj == null) {
55             return false;
56         }
57         if (!(obj instanceof CachedVideoStateChange other)) {
58             return false;
59         }
60         return mCurrentVideoState == other.mCurrentVideoState;
61     }
62 }
63 
64