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.compat; 18 19 import android.telecom.Call; 20 21 import java.lang.reflect.InvocationTargetException; 22 import java.lang.reflect.Method; 23 24 public class CallSdkCompat { 25 public static class Details { 26 // TODO: This property is hidden in the N release; replace with actual when the API is 27 // made public. 28 public static final int PROPERTY_IS_EXTERNAL_CALL = 0x00000040; 29 public static final int PROPERTY_ENTERPRISE_CALL = Call.Details.PROPERTY_ENTERPRISE_CALL; 30 // TODO: This capability is hidden in the N release; replace with actual when the API is 31 // made public. 32 public static final int CAPABILITY_CAN_PULL_CALL = 0x00800000; 33 public static final int CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO = 34 Call.Details.CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO; 35 } 36 37 /** 38 * TODO: This API is hidden in the N release; replace the implementation with a call to the 39 * actual once it is made public. 40 */ pullExternalCall(Call call)41 public static void pullExternalCall(Call call) { 42 if (!CompatUtils.isNCompatible()) { 43 return; 44 } 45 Class<?> callClass = Call.class; 46 try { 47 Method pullExternalCallMethod = callClass.getDeclaredMethod("pullExternalCall"); 48 pullExternalCallMethod.invoke(call); 49 } catch (NoSuchMethodException e) { 50 // Ignore requests to pull call if there is a problem. 51 } catch (InvocationTargetException e) { 52 // Ignore requests to pull call if there is a problem. 53 } catch (IllegalAccessException e) { 54 // Ignore requests to pull call if there is a problem. 55 } 56 } 57 } 58