diff options
author | Santos Cordon <santoscordon@google.com> | 2014-07-21 18:06:30 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-07-21 15:43:35 +0000 |
commit | 3d78d0ff165787a1e4ac4bb8d2f2dcd6879556c9 (patch) | |
tree | 375a144cc628c5bd19ab6e1e2c98d97f2ba85009 | |
parent | e0d42c9be53179e60b0f8acd2964ca4428bb1239 (diff) | |
parent | da7f422a46db4bfe5cf76312d23b44e60fa9d806 (diff) |
Merge "Fix InCall to handle null handles." into lmp-dev
-rw-r--r-- | InCallUI/src/com/android/incallui/CallCardPresenter.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java index 6b1ee3508..5a1605090 100644 --- a/InCallUI/src/com/android/incallui/CallCardPresenter.java +++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java @@ -20,6 +20,8 @@ import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.graphics.drawable.Drawable; + +import android.net.Uri; import android.os.Bundle; import android.telecomm.CallCapabilities; import android.telecomm.PhoneAccount; @@ -39,7 +41,6 @@ import com.android.incallui.InCallPresenter.InCallDetailsListener; import com.android.incallui.InCallPresenter.InCallState; import com.android.incallui.InCallPresenter.InCallStateListener; import com.android.incallui.InCallPresenter.IncomingCallListener; - import com.google.common.base.Preconditions; /** @@ -198,7 +199,8 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> getUi().setCallState(callState, mPrimary.getDisconnectCause(), getConnectionLabel(), getConnectionIcon(), getGatewayNumber()); - String currentNumber = mPrimary.getHandle().getSchemeSpecificPart(); + Uri handle = mPrimary.getHandle(); + String currentNumber = getNumberFromHandle(mPrimary.getHandle()); if (PhoneNumberUtils.isEmergencyNumber(currentNumber)) { String callbackNumber = getSubscriptionNumber(); setCallbackNumber(callbackNumber, true); @@ -244,7 +246,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> private void setCallbackNumberIfSet(android.telecomm.Call.Details details) { String callbackNumber = null; - String currentNumber = mPrimary.getHandle().getSchemeSpecificPart(); + String currentNumber = getNumberFromHandle(mPrimary.getHandle()); boolean isEmergencyCall = PhoneNumberUtils.isEmergencyNumber(currentNumber); StatusHints statusHints = details.getStatusHints(); @@ -478,7 +480,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> */ private String getGatewayNumber() { if (hasOutgoingGatewayCall()) { - return mPrimary.getGatewayInfo().getGatewayHandle().getSchemeSpecificPart(); + return getNumberFromHandle(mPrimary.getGatewayInfo().getGatewayHandle()); } return null; } @@ -600,6 +602,10 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> TelecommAdapter.getInstance().disconnectCall(mPrimary.getId()); } + private String getNumberFromHandle(Uri handle) { + return handle == null ? "" : handle.getSchemeSpecificPart(); + } + public interface CallCardUi extends Ui { void setVisible(boolean on); void setPrimary(String number, String name, boolean nameIsNumber, String label, |