diff options
author | Andrew Lee <anwlee@google.com> | 2015-04-10 13:01:13 -0700 |
---|---|---|
committer | Andrew Lee <anwlee@google.com> | 2015-04-20 14:42:38 -0700 |
commit | 89aad4adce9cc66294f15391fa3e10f3123d3d92 (patch) | |
tree | 3b03d2738c47784874699778dbe128f00fad1c8f /InCallUI/src | |
parent | cb687e7d20c2633d65f22a961e7080ea5692e554 (diff) |
Add EmergencyCallListener.
+ Add EmergencyCallListener, which fires when the call card
is updated to indicate whether the call is an emergency call or not.
Bug: 20300758
Change-Id: Ie9ad6ddecb278b56226804f5009504b4cc8b4cd5
Diffstat (limited to 'InCallUI/src')
3 files changed, 26 insertions, 4 deletions
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java index 535ba3bf0..e4da71e68 100644 --- a/InCallUI/src/com/android/incallui/CallCardPresenter.java +++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java @@ -60,6 +60,13 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> implements InCallStateListener, IncomingCallListener, InCallDetailsListener, InCallEventListener { + public interface EmergencyCallListener { + public void onCallUpdated(BaseFragment fragment, boolean isEmergency); + } + + private static final EmergencyCallListener mEmergencyCallListener = + ObjectFactory.newEmergencyCallListener(); + private static final String TAG = CallCardPresenter.class.getSimpleName(); private static final long CALL_TIME_UPDATE_INTERVAL_MS = 1000; @@ -526,6 +533,11 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> ui.setPrimary(null, null, false, null, null, false); } + if (mEmergencyCallListener != null) { + boolean isEmergencyCall = PhoneNumberUtils.isEmergencyNumber( + getNumberFromHandle(mPrimary.getHandle())); + mEmergencyCallListener.onCallUpdated((BaseFragment) ui, isEmergencyCall); + } } private void updateSecondaryDisplayInfo() { diff --git a/InCallUI/src/com/android/incallui/ContactInfoCache.java b/InCallUI/src/com/android/incallui/ContactInfoCache.java index 49621695b..27bf5a8f6 100644 --- a/InCallUI/src/com/android/incallui/ContactInfoCache.java +++ b/InCallUI/src/com/android/incallui/ContactInfoCache.java @@ -29,7 +29,7 @@ import android.text.TextUtils; import com.android.contacts.common.util.PhoneNumberHelper; import com.android.incallui.service.PhoneNumberService; -import com.android.incalluibind.ServiceFactory; +import com.android.incalluibind.ObjectFactory; import com.android.services.telephony.common.MoreStrings; import com.google.common.collect.Maps; import com.google.common.collect.Sets; @@ -69,7 +69,7 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete private ContactInfoCache(Context context) { mContext = context; - mPhoneNumberService = ServiceFactory.newPhoneNumberService(context); + mPhoneNumberService = ObjectFactory.newPhoneNumberService(context); } public ContactCacheEntry getInfo(String callId) { diff --git a/InCallUI/src/com/android/incalluibind/ObjectFactory.java b/InCallUI/src/com/android/incalluibind/ObjectFactory.java index a2adc102f..0cb4241b2 100644 --- a/InCallUI/src/com/android/incalluibind/ObjectFactory.java +++ b/InCallUI/src/com/android/incalluibind/ObjectFactory.java @@ -19,14 +19,24 @@ package com.android.incalluibind; import android.content.Context; import android.content.Intent; +import com.android.incallui.CallCardPresenter.EmergencyCallListener; + public class ObjectFactory { + public static EmergencyCallListener getEmergencyCallListener() { + return null; + } + /** @return An {@link Intent} to be broadcast when the InCallUI is visible. */ - public static Intent getUiReadyBroadcastIntent(Context context) { return null; } + public static Intent getUiReadyBroadcastIntent(Context context) { + return null; + } /** * @return An {@link Intent} to be broadcast when the call state button in the InCallUI is * touched while in a call. */ - public static Intent getCallStateButtonBroadcastIntent(Context context) { return null; } + public static Intent getCallStateButtonBroadcastIntent(Context context) { + return null; + } } |