1 /* 2 * Copyright (C) 2017 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 com.android.dialer.calllogutils; 17 18 import android.app.Activity; 19 import android.provider.CallLog.Calls; 20 import com.android.dialer.callintent.CallInitiationType; 21 import com.android.dialer.callintent.CallIntentBuilder; 22 import com.android.dialer.calllog.model.CoalescedRow; 23 import com.android.dialer.duo.DuoComponent; 24 import com.android.dialer.precall.PreCall; 25 26 /** Actions which can be performed on a call log row. */ 27 public final class CallLogRowActions { 28 29 /** 30 * Places a call to the number in the provided {@link CoalescedRow}. 31 * 32 * <p>If the call was a video call, a video call will be placed, and if the call was an audio 33 * call, an audio call will be placed. The phone account corresponding to the row is used. 34 */ startCallForRow(Activity activity, CoalescedRow row)35 public static void startCallForRow(Activity activity, CoalescedRow row) { 36 // TODO(zachh): More granular logging? 37 PreCall.start( 38 activity, 39 new CallIntentBuilder( 40 row.getNumber().getNormalizedNumber(), CallInitiationType.Type.CALL_LOG) 41 .setIsVideoCall((row.getFeatures() & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO) 42 .setIsDuoCall( 43 DuoComponent.get(activity) 44 .getDuo() 45 .isDuoAccount(row.getPhoneAccountComponentName()))); 46 } 47 } 48