summaryrefslogtreecommitdiff
path: root/InCallUI
diff options
context:
space:
mode:
authorEvan Charlton <evanc@google.com>2014-07-17 20:20:06 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-07-17 20:20:06 +0000
commit147279594cad00dc9fee1ed3580dba09deab7730 (patch)
tree9678e612585075314e6449a68b7fb9a505698208 /InCallUI
parent73c615f6edcc391bad36fada24f126a9a8451afe (diff)
parent0e84b83f23af354872b64fc1d1d77d22d825c71c (diff)
am 3f4f33bc: Show message or call-back number in InCallUI
* commit '3f4f33bc27ee1c9a12c9e55856b29079301c8a08': Show message or call-back number in InCallUI
Diffstat (limited to 'InCallUI')
-rw-r--r--InCallUI/res/layout/call_card_content.xml8
-rw-r--r--InCallUI/res/values/strings.xml4
-rw-r--r--InCallUI/src/com/android/incallui/CallCardFragment.java33
-rw-r--r--InCallUI/src/com/android/incallui/CallCardPresenter.java42
-rw-r--r--InCallUI/src/com/android/incallui/InCallPresenter.java23
5 files changed, 105 insertions, 5 deletions
diff --git a/InCallUI/res/layout/call_card_content.xml b/InCallUI/res/layout/call_card_content.xml
index cb6f53309..c59c1c712 100644
--- a/InCallUI/res/layout/call_card_content.xml
+++ b/InCallUI/res/layout/call_card_content.xml
@@ -39,6 +39,14 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />
+ <TextView android:id="@+id/connectionServiceMessage"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:visibility="gone"
+ android:padding="@dimen/call_banner_side_padding"
+ android:background="@android:color/white" />
+
</LinearLayout>
<FrameLayout
diff --git a/InCallUI/res/values/strings.xml b/InCallUI/res/values/strings.xml
index 78fe885cd..d0f300d60 100644
--- a/InCallUI/res/values/strings.xml
+++ b/InCallUI/res/values/strings.xml
@@ -156,6 +156,10 @@
<!-- In-call screen: status label when there is a problem connecting a video call. -->
<string name="card_title_video_call_error">Cannot connect video call</string>
+ <string name="card_title_callback_number_emergency">Your emergency call back number\n
+ <xliff:g id="dark_number">%1$s</xliff:g>
+ </string>
+
<!-- Notification strings -->
<!-- The "label" of the in-call Notification for a dialing call, used
as the format string for a Chronometer widget. [CHAR LIMIT=60] -->
diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java
index abc53ae17..5080da048 100644
--- a/InCallUI/src/com/android/incallui/CallCardFragment.java
+++ b/InCallUI/src/com/android/incallui/CallCardFragment.java
@@ -28,6 +28,7 @@ import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.telephony.DisconnectCause;
+import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
import android.view.Display;
import android.view.LayoutInflater;
@@ -43,7 +44,6 @@ import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
-import com.android.contacts.common.util.ViewUtil;
import com.android.contacts.common.widget.FloatingActionButtonController;
import com.android.phone.common.animation.AnimUtils;
@@ -84,6 +84,9 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
private TextView mSecondaryCallProviderLabel;
private ImageView mSecondaryCallProviderIcon;
+ // Dark number info bar
+ private TextView mInCallMessageLabel;
+
private FloatingActionButtonController mFloatingActionButtonController;
private View mFloatingActionButtonContainer;
private int mFloatingActionButtonHideOffset;
@@ -160,6 +163,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
mPrimaryCallCardContainer = view.findViewById(R.id.primary_call_info_container);
mPrimaryCallInfo = view.findViewById(R.id.primary_call_banner);
mCallButtonsContainer = view.findViewById(R.id.callButtonFragment);
+ mInCallMessageLabel = (TextView) view.findViewById(R.id.connectionServiceMessage);
mFloatingActionButtonContainer = view.findViewById(
R.id.floating_end_call_action_button_container);
@@ -360,6 +364,27 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
}
}
+
+ @Override
+ public void setCallDetails(android.telecomm.Call.Details details) {
+ }
+
+ @Override
+ public void setEmergencyCallbackNumber(String callbackNumber) {
+ if (TextUtils.isEmpty(callbackNumber)) {
+ mInCallMessageLabel.setVisibility(View.GONE);
+ return;
+ }
+
+ // TODO: The new Locale-specific methods don't seem to be working. Revisit this.
+ callbackNumber = PhoneNumberUtils.formatNumber(callbackNumber);
+
+ String text = getString(R.string.card_title_callback_number_emergency, callbackNumber);
+ mInCallMessageLabel.setText(text);
+
+ mInCallMessageLabel.setVisibility(View.VISIBLE);
+ }
+
private void showInternetCallLabel(boolean show) {
if (show) {
final String label = getView().getContext().getString(
@@ -637,8 +662,10 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
mFloatingActionButtonController.manuallyTranslate(
mFloatingActionButtonController.getTranslationXForAlignment(
mIsLandscape ? FloatingActionButtonController.ALIGN_QUARTER_RIGHT
- : FloatingActionButtonController.ALIGN_MIDDLE),
- mFloatingActionButtonHideOffset);
+ : FloatingActionButtonController.ALIGN_MIDDLE
+ ),
+ mFloatingActionButtonHideOffset
+ );
mCallButtonsContainer.setAlpha(0);
mCallStateLabel.setAlpha(0);
mPrimaryName.setAlpha(0);
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java
index 32becd286..eb4640312 100644
--- a/InCallUI/src/com/android/incallui/CallCardPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java
@@ -20,21 +20,25 @@ import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
+import android.os.Bundle;
import android.telecomm.CallCapabilities;
import android.telecomm.PhoneAccount;
import android.telecomm.PhoneAccountMetadata;
+import android.telecomm.StatusHints;
+import android.telecomm.TelecommConstants;
import android.telecomm.TelecommManager;
import android.telephony.DisconnectCause;
+import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
import android.text.format.DateUtils;
import com.android.incallui.AudioModeProvider.AudioModeListener;
import com.android.incallui.ContactInfoCache.ContactCacheEntry;
import com.android.incallui.ContactInfoCache.ContactInfoCacheCallback;
+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.android.services.telephony.common.AudioMode;
import com.google.common.base.Preconditions;
@@ -44,7 +48,8 @@ import com.google.common.base.Preconditions;
* This class listens for changes to InCallState and passes it along to the fragment.
*/
public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
- implements InCallStateListener, AudioModeListener, IncomingCallListener {
+ implements InCallStateListener, AudioModeListener, IncomingCallListener,
+ InCallDetailsListener {
private static final String TAG = CallCardPresenter.class.getSimpleName();
private static final long CALL_TIME_UPDATE_INTERVAL = 1000; // in milliseconds
@@ -98,6 +103,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
// Register for call state changes last
InCallPresenter.getInstance().addListener(this);
InCallPresenter.getInstance().addIncomingCallListener(this);
+ InCallPresenter.getInstance().addDetailsListener(this);
}
@Override
@@ -107,6 +113,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
// stop getting call state changes
InCallPresenter.getInstance().removeListener(this);
InCallPresenter.getInstance().removeIncomingCallListener(this);
+ InCallPresenter.getInstance().removeDetailsListener(this);
AudioModeProvider.getInstance().removeListener(this);
@@ -200,6 +207,35 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
}
@Override
+ public void onDetailsChanged(android.telecomm.Call.Details details) {
+ getUi().setCallDetails(details);
+
+ String currentNumber = mPrimary.getHandle().getSchemeSpecificPart();
+ if (PhoneNumberUtils.isEmergencyNumber(currentNumber)) {
+ setEmergencyNumberIfSet(details);
+ }
+ }
+
+ private void setEmergencyNumberIfSet(android.telecomm.Call.Details details) {
+ String callbackNumber = null;
+
+ StatusHints statusHints = details.getStatusHints();
+ if (statusHints != null) {
+ Bundle extras = statusHints.getExtras();
+ if (extras != null) {
+ callbackNumber = extras.getString(
+ TelecommConstants.EXTRA_EMERGENCY_CALL_BACK_NUMBER, null);
+ } else {
+ Log.d(this, "No extras; not updating callback number");
+ }
+ } else {
+ Log.d(this, "No status hints; not updating callback number");
+ }
+
+ getUi().setEmergencyCallbackNumber(callbackNumber);
+ }
+
+ @Override
public void onAudioMode(int mode) {
}
@@ -533,6 +569,8 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
void setPrimaryPhoneNumber(String phoneNumber);
void setPrimaryLabel(String label);
void setEndCallButtonEnabled(boolean enabled);
+ void setEmergencyCallbackNumber(String number);
+ void setCallDetails(android.telecomm.Call.Details details);
}
private TelecommManager getTelecommManager() {
diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java
index 5965a950a..83d21b83f 100644
--- a/InCallUI/src/com/android/incallui/InCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/InCallPresenter.java
@@ -44,6 +44,7 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener {
private final Set<InCallStateListener> mListeners = Sets.newHashSet();
private final ArrayList<IncomingCallListener> mIncomingCallListeners = Lists.newArrayList();
+ private final Set<InCallDetailsListener> mDetailsListeners = Sets.newHashSet();
private AudioModeProvider mAudioModeProvider;
private StatusBarNotifier mStatusBarNotifier;
@@ -80,6 +81,14 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener {
CallList.getInstance().getCallByTelecommCall(call).getId(),
remainingPostDialSequence);
}
+
+ @Override
+ public void onDetailsChanged(android.telecomm.Call call,
+ android.telecomm.Call.Details details) {
+ for (InCallDetailsListener listener : mDetailsListeners) {
+ listener.onDetailsChanged(details);
+ }
+ }
};
/**
@@ -369,6 +378,16 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener {
mListeners.remove(listener);
}
+ public void addDetailsListener(InCallDetailsListener listener) {
+ Preconditions.checkNotNull(listener);
+ mDetailsListeners.add(listener);
+ }
+
+ public void removeDetailsListener(InCallDetailsListener listener) {
+ Preconditions.checkNotNull(listener);
+ mDetailsListeners.remove(listener);
+ }
+
public ProximitySensor getProximitySensor() {
return mProximitySensor;
}
@@ -842,4 +861,8 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener {
public interface IncomingCallListener {
public void onIncomingCall(InCallState state, Call call);
}
+
+ public interface InCallDetailsListener {
+ public void onDetailsChanged(android.telecomm.Call.Details details);
+ }
}