• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 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.contacts.common.compat;
18 
19 import android.os.Build.VERSION;
20 import android.os.Build.VERSION_CODES;
21 import android.support.annotation.NonNull;
22 import android.telecom.Call;
23 
24 /** Compatibility utilities for android.telecom.Call */
25 public class CallCompat {
26 
canPullExternalCall(@onNull android.telecom.Call call)27   public static boolean canPullExternalCall(@NonNull android.telecom.Call call) {
28     return VERSION.SDK_INT >= VERSION_CODES.N_MR1
29         && ((call.getDetails().getCallCapabilities() & Details.CAPABILITY_CAN_PULL_CALL)
30             == Details.CAPABILITY_CAN_PULL_CALL);
31   }
32 
33   /** android.telecom.Call.Details */
34   public static class Details {
35 
36     public static final int PROPERTY_IS_EXTERNAL_CALL = Call.Details.PROPERTY_IS_EXTERNAL_CALL;
37     public static final int PROPERTY_ENTERPRISE_CALL = Call.Details.PROPERTY_ENTERPRISE_CALL;
38     public static final int CAPABILITY_CAN_PULL_CALL = Call.Details.CAPABILITY_CAN_PULL_CALL;
39     public static final int CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO =
40         Call.Details.CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO;
41 
42     public static final String EXTRA_ANSWERING_DROPS_FOREGROUND_CALL =
43         "android.telecom.extra.ANSWERING_DROPS_FG_CALL";
44   }
45 }
46