diff options
Diffstat (limited to 'src/com/android/incallui/CallCardPresenter.java')
-rw-r--r-- | src/com/android/incallui/CallCardPresenter.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/com/android/incallui/CallCardPresenter.java b/src/com/android/incallui/CallCardPresenter.java index 355b0b15..b0e83b7c 100644 --- a/src/com/android/incallui/CallCardPresenter.java +++ b/src/com/android/incallui/CallCardPresenter.java @@ -44,6 +44,7 @@ import com.android.incallui.InCallPresenter.InCallState; import com.android.incallui.InCallPresenter.InCallStateListener; import com.android.incallui.InCallPresenter.IncomingCallListener; import com.android.incalluibind.ObjectFactory; +import com.android.phone.common.util.VolteUtils; import com.cyanogen.lookup.phonenumber.response.StatusCode; import com.google.common.base.Preconditions; @@ -302,6 +303,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> false /* isConference */, false /* isWaitingForRemoteSide */); getUi().showHdAudioIndicator(false); + getUi().setVolteCallLabel(false); } maybeShowManageConferenceCallButton(); @@ -405,6 +407,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> mPrimary.isWaitingForRemoteSide()); maybeShowHdAudioIcon(); + maybeShowVolteLabel(); setCallbackNumber(); } } @@ -421,6 +424,16 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> } /** + * Show VoLTE label if call is active and made over VoLTE + */ + private void maybeShowVolteLabel() { + int subId = getSubscriptionId(); + boolean showVolte = isPrimaryCallActive() && (subId > 0) && + VolteUtils.isVolteInUse(mContext, subId); + getUi().setVolteCallLabel(showVolte); + } + + /** * Only show the conference call button if we can manage the conference. */ private void maybeShowManageConferenceCallButton() { @@ -627,6 +640,20 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> return retval; } + private int getSubscriptionId() { + PhoneAccountHandle accountHandle = mPrimary.getAccountHandle(); + if (accountHandle != null) { + try{ + return Integer.parseInt(accountHandle.getId()); + } catch (NumberFormatException ex) { + // handle id is not an int, device might not have sim in it + Log.w(TAG, "Unable to parse phone account handle " + accountHandle.getId() + " as" + + " an int"); + } + } + return 0; + } + private void updatePrimaryDisplayInfo() { final CallCardUi ui = getUi(); if (ui == null) { @@ -1046,5 +1073,6 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> void animateForNewOutgoingCall(); void sendAccessibilityAnnouncement(); void showNoteSentToast(); + void setVolteCallLabel(boolean show); } } |