diff options
Diffstat (limited to 'java/com/android/incallui/call')
-rw-r--r-- | java/com/android/incallui/call/CallList.java | 22 | ||||
-rw-r--r-- | java/com/android/incallui/call/DialerCall.java | 47 | ||||
-rw-r--r-- | java/com/android/incallui/call/DialerCallListener.java | 2 |
3 files changed, 66 insertions, 5 deletions
diff --git a/java/com/android/incallui/call/CallList.java b/java/com/android/incallui/call/CallList.java index 0bb16080b..34f0cc0d7 100644 --- a/java/com/android/incallui/call/CallList.java +++ b/java/com/android/incallui/call/CallList.java @@ -290,6 +290,10 @@ public class CallList implements DialerCallDelegate { "CallList.onCallRemoved", "Removing call not previously disconnected " + call.getId()); } } + + if (!hasLiveCall()) { + DialerCall.clearRestrictedCount(); + } } InCallUiLegacyBindings getLegacyBindings(Context context) { @@ -723,15 +727,17 @@ public class CallList implements DialerCallDelegate { * WiFi */ void onHandoverToWifiFailed(DialerCall call); + + /** Called when the user initiates a call to an international number while on WiFi. */ + void onInternationalCallOnWifi(@NonNull DialerCall call); } private class DialerCallListenerImpl implements DialerCallListener { - private final DialerCall mCall; + @NonNull private final DialerCall mCall; - DialerCallListenerImpl(DialerCall call) { - Assert.isNotNull(call); - mCall = call; + DialerCallListenerImpl(@NonNull DialerCall call) { + mCall = Assert.isNotNull(call); } @Override @@ -779,6 +785,14 @@ public class CallList implements DialerCallDelegate { } @Override + public void onInternationalCallOnWifi() { + LogUtil.enterBlock("DialerCallListenerImpl.onInternationalCallOnWifi"); + for (Listener listener : mListeners) { + listener.onInternationalCallOnWifi(mCall); + } + } + + @Override public void onDialerCallSessionModificationStateChange() { for (Listener listener : mListeners) { listener.onSessionModificationStateChange(mCall); diff --git a/java/com/android/incallui/call/DialerCall.java b/java/com/android/incallui/call/DialerCall.java index 3825e6e26..acedf41f1 100644 --- a/java/com/android/incallui/call/DialerCall.java +++ b/java/com/android/incallui/call/DialerCall.java @@ -56,6 +56,7 @@ import com.android.dialer.lightbringer.LightbringerComponent; import com.android.dialer.logging.ContactLookupResult; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; +import com.android.dialer.theme.R; import com.android.incallui.audiomode.AudioModeProvider; import com.android.incallui.latencyreport.LatencyReport; import com.android.incallui.util.TelecomCallUtil; @@ -92,6 +93,13 @@ public class DialerCall implements VideoTechListener { private static int sIdCounter = 0; /** + * A counter used to append to restricted/private/hidden calls so that users can identify them in + * a conversation. This value is reset in {@link CallList#onCallRemoved(Context, Call)} when there + * are no live calls. + */ + private static int sHiddenCounter; + + /** * The unique call ID for every call. This will help us to identify each call and allow us the * ability to stitch impressions to calls if needed. */ @@ -100,6 +108,7 @@ public class DialerCall implements VideoTechListener { private final Call mTelecomCall; private final LatencyReport mLatencyReport; private final String mId; + private final int mHiddenId; private final List<String> mChildCallIds = new ArrayList<>(); private final LogState mLogState = new LogState(); private final Context mContext; @@ -243,11 +252,15 @@ public class DialerCall implements VideoTechListener { isRemotelyHeld = false; update(); break; + case TelephonyManagerCompat.EVENT_NOTIFY_INTERNATIONAL_CALL_ON_WFC: + notifyInternationalCallOnWifi(); + break; default: break; } } }; + private long mTimeAddedMs; public DialerCall( @@ -267,6 +280,11 @@ public class DialerCall implements VideoTechListener { mVideoTechManager = new VideoTechManager(this); updateFromTelecomCall(); + if (isHiddenNumber() && TextUtils.isEmpty(getNumber())) { + mHiddenId = ++sHiddenCounter; + } else { + mHiddenId = 0; + } if (registerCallback) { mTelecomCall.registerCallback(mTelecomCallCallback); @@ -358,6 +376,13 @@ public class DialerCall implements VideoTechListener { } } + public void notifyInternationalCallOnWifi() { + LogUtil.enterBlock("DialerCall.notifyInternationalCallOnWifi"); + for (DialerCallListener dialerCallListener : mListeners) { + dialerCallListener.onInternationalCallOnWifi(); + } + } + /* package-private */ Call getTelecomCall() { return mTelecomCall; } @@ -526,6 +551,27 @@ public class DialerCall implements VideoTechListener { return mId; } + /** + * @return name appended with a number if the number is restricted/unknown and the user has + * received more than one restricted/unknown call. + */ + @Nullable + public String updateNameIfRestricted(@Nullable String name) { + if (name != null && isHiddenNumber() && mHiddenId != 0 && sHiddenCounter > 1) { + return mContext.getString(R.string.unknown_counter, name, mHiddenId); + } + return name; + } + + public static void clearRestrictedCount() { + sHiddenCounter = 0; + } + + private boolean isHiddenNumber() { + return getNumberPresentation() == TelecomManager.PRESENTATION_RESTRICTED + || getNumberPresentation() == TelecomManager.PRESENTATION_UNKNOWN; + } + public boolean hasShownWiFiToLteHandoverToast() { return hasShownWiFiToLteHandoverToast; } @@ -1326,7 +1372,6 @@ public class DialerCall implements VideoTechListener { String phoneNumber = call.getNumber(); phoneNumber = phoneNumber != null ? phoneNumber : ""; - phoneNumber = phoneNumber.replaceAll("[^+0-9]", ""); // Insert order here determines the priority of that video tech option videoTechs = new ArrayList<>(); diff --git a/java/com/android/incallui/call/DialerCallListener.java b/java/com/android/incallui/call/DialerCallListener.java index fece103fa..ed321be05 100644 --- a/java/com/android/incallui/call/DialerCallListener.java +++ b/java/com/android/incallui/call/DialerCallListener.java @@ -34,4 +34,6 @@ public interface DialerCallListener { void onWiFiToLteHandover(); void onHandoverToWifiFailure(); + + void onInternationalCallOnWifi(); } |