diff options
author | Santos Cordon <santoscordon@google.com> | 2014-07-21 02:24:12 -0700 |
---|---|---|
committer | Santos Cordon <santoscordon@google.com> | 2014-07-21 02:24:12 -0700 |
commit | da7f422a46db4bfe5cf76312d23b44e60fa9d806 (patch) | |
tree | ec645416cb84a45777a14baeaaa38b6e10a0e622 | |
parent | b6f45c2768f5af916ee3257542a3ab03611c1f5e (diff) |
Fix InCall to handle null handles.
Change-Id: I56d90d4b74b6d44d6be438a7268cc3e99ceeec04
-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 a17729051..2c77d9b67 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); @@ -239,7 +241,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(); @@ -473,7 +475,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; } @@ -595,6 +597,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, |