diff options
Diffstat (limited to 'java/com/android/incallui/call/DialerCall.java')
-rw-r--r-- | java/com/android/incallui/call/DialerCall.java | 47 |
1 files changed, 46 insertions, 1 deletions
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<>(); |