diff options
Diffstat (limited to 'java/com/android/dialer/calldetails')
3 files changed, 10 insertions, 12 deletions
diff --git a/java/com/android/dialer/calldetails/CallDetailsActivity.java b/java/com/android/dialer/calldetails/CallDetailsActivity.java index f1d0d8487..36b830851 100644 --- a/java/com/android/dialer/calldetails/CallDetailsActivity.java +++ b/java/com/android/dialer/calldetails/CallDetailsActivity.java @@ -127,7 +127,7 @@ public final class CallDetailsActivity extends CallDetailsActivityCommon { @Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { - updateCallDetailsEntries(CallDetailsCursorLoader.toCallDetailsEntries(data)); + updateCallDetailsEntries(CallDetailsCursorLoader.toCallDetailsEntries(activity, data)); activity.loadRttTranscriptAvailability(); } diff --git a/java/com/android/dialer/calldetails/CallDetailsActivityCommon.java b/java/com/android/dialer/calldetails/CallDetailsActivityCommon.java index 8f850ae25..80a41919d 100644 --- a/java/com/android/dialer/calldetails/CallDetailsActivityCommon.java +++ b/java/com/android/dialer/calldetails/CallDetailsActivityCommon.java @@ -63,6 +63,7 @@ import com.android.dialer.postcall.PostCall; import com.android.dialer.precall.PreCall; import com.android.dialer.rtt.RttTranscriptActivity; import com.android.dialer.rtt.RttTranscriptUtil; +import com.google.common.base.Optional; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableSet; import com.google.i18n.phonenumbers.NumberParseException; @@ -327,15 +328,15 @@ abstract class CallDetailsActivityCommon extends AppCompatActivity { Logger.get(getActivity()) .logImpression(DialerImpression.Type.CALL_DETAILS_LIGHTBRINGER_CALL_BACK); Duo duo = DuoComponent.get(getActivity()).getDuo(); - if (!duo.isReachable(getActivity(), phoneNumber)) { + Optional<Intent> intentOptional = duo.getCallIntent(phoneNumber); + if (!duo.isReachable(getActivity(), phoneNumber) || !intentOptional.isPresent()) { placeImsVideoCall(phoneNumber); return; } try { getActivity() - .startActivityForResult( - duo.getIntent(getActivity(), phoneNumber), ActivityRequestCodes.DIALTACTS_DUO); + .startActivityForResult(intentOptional.get(), ActivityRequestCodes.DIALTACTS_DUO); } catch (ActivityNotFoundException e) { Toast.makeText(getActivity(), R.string.activity_not_available, Toast.LENGTH_SHORT).show(); } diff --git a/java/com/android/dialer/calldetails/CallDetailsCursorLoader.java b/java/com/android/dialer/calldetails/CallDetailsCursorLoader.java index a7e17717f..9d55b9fda 100644 --- a/java/com/android/dialer/calldetails/CallDetailsCursorLoader.java +++ b/java/com/android/dialer/calldetails/CallDetailsCursorLoader.java @@ -23,7 +23,7 @@ import com.android.dialer.CoalescedIds; import com.android.dialer.calldetails.CallDetailsEntries.CallDetailsEntry; import com.android.dialer.calllog.database.contract.AnnotatedCallLogContract.AnnotatedCallLog; import com.android.dialer.common.Assert; -import com.android.dialer.duo.DuoConstants; +import com.android.dialer.duo.DuoComponent; /** * A {@link CursorLoader} that loads call detail entries from {@link AnnotatedCallLog} for {@link @@ -119,21 +119,21 @@ public final class CallDetailsCursorLoader extends CursorLoader { * the cursor is not null and the data set it points to is not empty. * @return A {@link CallDetailsEntries} proto. */ - static CallDetailsEntries toCallDetailsEntries(Cursor cursor) { + static CallDetailsEntries toCallDetailsEntries(Context context, Cursor cursor) { Assert.isNotNull(cursor); Assert.checkArgument(cursor.moveToFirst()); CallDetailsEntries.Builder entries = CallDetailsEntries.newBuilder(); do { - entries.addEntries(toCallDetailsEntry(cursor)); + entries.addEntries(toCallDetailsEntry(context, cursor)); } while (cursor.moveToNext()); return entries.build(); } /** Creates a new {@link CallDetailsEntry} from the provided cursor using its current position. */ - private static CallDetailsEntry toCallDetailsEntry(Cursor cursor) { + private static CallDetailsEntry toCallDetailsEntry(Context context, Cursor cursor) { CallDetailsEntry.Builder entry = CallDetailsEntry.newBuilder(); entry .setCallId(cursor.getLong(ID)) @@ -145,10 +145,7 @@ public final class CallDetailsCursorLoader extends CursorLoader { .setCallMappingId(cursor.getString(CALL_MAPPING_ID)); String phoneAccountComponentName = cursor.getString(PHONE_ACCOUNT_COMPONENT_NAME); - entry.setIsDuoCall( - DuoConstants.PHONE_ACCOUNT_COMPONENT_NAME - .flattenToString() - .equals(phoneAccountComponentName)); + entry.setIsDuoCall(DuoComponent.get(context).getDuo().isDuoAccount(phoneAccountComponentName)); return entry.build(); } |