diff options
Diffstat (limited to 'java/com/android/incallui/call')
-rw-r--r-- | java/com/android/incallui/call/CallList.java | 13 | ||||
-rw-r--r-- | java/com/android/incallui/call/DialerCall.java | 58 |
2 files changed, 59 insertions, 12 deletions
diff --git a/java/com/android/incallui/call/CallList.java b/java/com/android/incallui/call/CallList.java index 8d6620628..7c35e4b92 100644 --- a/java/com/android/incallui/call/CallList.java +++ b/java/com/android/incallui/call/CallList.java @@ -34,7 +34,6 @@ import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.enrichedcall.EnrichedCallComponent; import com.android.dialer.enrichedcall.EnrichedCallManager; -import com.android.dialer.location.GeoUtil; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; import com.android.dialer.shortcuts.ShortcutUsageReporter; @@ -139,7 +138,7 @@ public class CallList implements DialerCallDelegate { Spam.get(context) .checkSpamStatus( number, - null, + call.getCountryIso(), new SpamBindings.Listener() { @Override public void onComplete(boolean isSpam) { @@ -196,7 +195,7 @@ public class CallList implements DialerCallDelegate { } }, call.getNumber(), - GeoUtil.getCurrentCountryIso(context)); + call.getCountryIso()); Trace.endSection(); if (call.getState() == DialerCall.State.INCOMING @@ -257,7 +256,7 @@ public class CallList implements DialerCallDelegate { Spam.get(context) .checkUserMarkedNonSpamStatus( number, - null, + call.getCountryIso(), new SpamBindings.Listener() { @Override public void onComplete(boolean isInUserWhiteList) { @@ -268,7 +267,7 @@ public class CallList implements DialerCallDelegate { Spam.get(context) .checkGlobalSpamListStatus( number, - null, + call.getCountryIso(), new SpamBindings.Listener() { @Override public void onComplete(boolean isInGlobalSpamList) { @@ -279,7 +278,7 @@ public class CallList implements DialerCallDelegate { Spam.get(context) .checkUserMarkedSpamStatus( number, - null, + call.getCountryIso(), new SpamBindings.Listener() { @Override public void onComplete(boolean isInUserSpamList) { @@ -626,9 +625,11 @@ public class CallList implements DialerCallDelegate { * listeners to call back to determine what changed. */ private void notifyGenericListeners() { + Trace.beginSection("CallList.notifyGenericListeners"); for (Listener listener : mListeners) { listener.onCallListChange(this); } + Trace.endSection(); } private void notifyListenersOfDisconnect(DialerCall call) { diff --git a/java/com/android/incallui/call/DialerCall.java b/java/com/android/incallui/call/DialerCall.java index 2511bb8ca..47a4a70f5 100644 --- a/java/com/android/incallui/call/DialerCall.java +++ b/java/com/android/incallui/call/DialerCall.java @@ -16,6 +16,7 @@ package com.android.incallui.call; +import android.Manifest.permission; import android.content.Context; import android.hardware.camera2.CameraCharacteristics; import android.net.Uri; @@ -42,6 +43,7 @@ import android.telecom.VideoProfile; import android.text.TextUtils; import com.android.contacts.common.compat.CallCompat; import com.android.contacts.common.compat.telecom.TelecomManagerCompat; +import com.android.dialer.assisteddialing.TransformationInfo; import com.android.dialer.callintent.CallInitiationType; import com.android.dialer.callintent.CallIntentParser; import com.android.dialer.callintent.CallSpecificAppData; @@ -57,11 +59,14 @@ import com.android.dialer.enrichedcall.EnrichedCallManager.Filter; import com.android.dialer.enrichedcall.EnrichedCallManager.StateChangedListener; import com.android.dialer.enrichedcall.Session; import com.android.dialer.lightbringer.LightbringerComponent; +import com.android.dialer.location.GeoUtil; import com.android.dialer.logging.ContactLookupResult; import com.android.dialer.logging.ContactLookupResult.Type; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; +import com.android.dialer.telecom.TelecomUtil; import com.android.dialer.theme.R; +import com.android.dialer.util.PermissionsUtil; import com.android.incallui.audiomode.AudioModeProvider; import com.android.incallui.latencyreport.LatencyReport; import com.android.incallui.util.TelecomCallUtil; @@ -157,6 +162,9 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa private com.android.dialer.logging.VideoTech.Type selectedAvailableVideoTechType = com.android.dialer.logging.VideoTech.Type.NONE; + private boolean isVoicemailNumber; + private List<PhoneAccountHandle> callCapableAccounts; + private String countryIso; public static String getNumberFromHandle(Uri handle) { return handle == null ? "" : handle.getSchemeSpecificPart(); @@ -449,6 +457,30 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa return mLogState.conferencedCalls != 0; } + public boolean isVoiceMailNumber() { + return isVoicemailNumber; + } + + public List<PhoneAccountHandle> getCallCapableAccounts() { + return callCapableAccounts; + } + + public String getCountryIso() { + return countryIso; + } + + private void updateIsVoiceMailNumber() { + if (getHandle() != null && PhoneAccount.SCHEME_VOICEMAIL.equals(getHandle().getScheme())) { + isVoicemailNumber = true; + } + + if (!PermissionsUtil.hasPermission(mContext, permission.READ_PHONE_STATE)) { + isVoicemailNumber = false; + } + + isVoicemailNumber = TelecomUtil.isVoicemailNumber(mContext, getAccountHandle(), getNumber()); + } + private void update() { Trace.beginSection("DialerCall.update"); int oldState = getState(); @@ -474,6 +506,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa Trace.endSection(); } + @SuppressWarnings("MissingPermission") private void updateFromTelecomCall() { Trace.beginSection("DialerCall.updateFromTelecomCall"); LogUtil.v("DialerCall.updateFromTelecomCall", mTelecomCall.toString()); @@ -509,6 +542,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa updateEmergencyCallState(); } + TelecomManager telecomManager = mContext.getSystemService(TelecomManager.class); // If the phone account handle of the call is set, cache capability bit indicating whether // the phone account supports call subjects. PhoneAccountHandle newPhoneAccountHandle = mTelecomCall.getDetails().getAccountHandle(); @@ -516,14 +550,18 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa mPhoneAccountHandle = newPhoneAccountHandle; if (mPhoneAccountHandle != null) { - PhoneAccount phoneAccount = - mContext.getSystemService(TelecomManager.class).getPhoneAccount(mPhoneAccountHandle); + PhoneAccount phoneAccount = telecomManager.getPhoneAccount(mPhoneAccountHandle); if (phoneAccount != null) { mIsCallSubjectSupported = phoneAccount.hasCapabilities(PhoneAccount.CAPABILITY_CALL_SUBJECT); } } } + if (PermissionsUtil.hasPermission(mContext, permission.READ_PHONE_STATE)) { + updateIsVoiceMailNumber(); + callCapableAccounts = telecomManager.getCallCapablePhoneAccounts(); + countryIso = GeoUtil.getCurrentCountryIso(mContext); + } Trace.endSection(); } @@ -856,7 +894,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa } public boolean isVideoCall() { - return getVideoTech().isTransmittingOrReceiving(); + return getVideoTech().isTransmittingOrReceiving() || VideoProfile.isVideo(getVideoState()); } public boolean hasReceivedVideoUpgradeRequest() { @@ -1036,6 +1074,14 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa return false; } + public TransformationInfo getAssistedDialingExtras() { + if (isAssistedDialed()) { + return TransformationInfo.newInstanceFromBundle( + getIntentExtras().getBundle(TelephonyManagerCompat.ASSISTED_DIALING_EXTRAS)); + } + return null; + } + public LatencyReport getLatencyReport() { return mLatencyReport; } @@ -1139,9 +1185,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa if (callProviderLabel == null) { PhoneAccount account = getPhoneAccount(); if (account != null && !TextUtils.isEmpty(account.getLabel())) { - List<PhoneAccountHandle> accounts = - mContext.getSystemService(TelecomManager.class).getCallCapablePhoneAccounts(); - if (accounts != null && accounts.size() > 1) { + if (callCapableAccounts != null && callCapableAccounts.size() > 1) { callProviderLabel = account.getLabel().toString(); } } @@ -1211,9 +1255,11 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa @Override public void onSessionModificationStateChanged() { + Trace.beginSection("DialerCall.onSessionModificationStateChanged"); for (DialerCallListener listener : mListeners) { listener.onDialerCallSessionModificationStateChange(); } + Trace.endSection(); } @Override |