diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-10-12 23:02:32 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-10-12 23:02:32 +0000 |
commit | 5f57e30484848b7b0b8d3fbdfe8b32338aa641a5 (patch) | |
tree | 5a37619a955212672a57d86ef50587b3545805ac /java/com/android/incallui/call/DialerCall.java | |
parent | 2633778c274746a35e4a54266a3319c53fd1cded (diff) | |
parent | 392f8cd64936a626cc035ac9bb0302094d8dd957 (diff) |
Merge changes I14a2c0b6,Ic67566c2,Id0ef9164,Iec48f030,Ibe1f9de6, ...
* changes:
Handle invalid PhoneAccountHandle component name in MissedCallNotifier
Use TelephonyManagerCompat for IS_REFRESH
Updated animation to enter and exit search ui.
Optimization for incoming call latency.
Fix for voice screen showing for a short time when making a video call
Fix incallui to use latest ux mocks for assisted dialing.
Remove voicemail count changed check for legacy notifications
Diffstat (limited to 'java/com/android/incallui/call/DialerCall.java')
-rw-r--r-- | java/com/android/incallui/call/DialerCall.java | 58 |
1 files changed, 52 insertions, 6 deletions
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 |