diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-09-15 22:11:57 -0400 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-09-15 22:11:57 -0400 |
commit | d9e28017f6e3da3a176d11fd0c722b1d7811d27b (patch) | |
tree | 62454442eda9da22ca07c6d946db67743ae9d39f /telephony/java/com | |
parent | 6ee7b04d270824214fca0296d0386e0c3d733cdf (diff) | |
parent | e22415817febc8d3229d1774f3b0dfda0fda8f46 (diff) | |
download | frameworks_base-d9e28017f6e3da3a176d11fd0c722b1d7811d27b.zip frameworks_base-d9e28017f6e3da3a176d11fd0c722b1d7811d27b.tar.gz frameworks_base-d9e28017f6e3da3a176d11fd0c722b1d7811d27b.tar.bz2 |
Merge change 25092 into eclair
* changes:
New field in CallerInfo to cache if the call is an emergency one.
Diffstat (limited to 'telephony/java/com')
-rw-r--r-- | telephony/java/com/android/internal/telephony/CallerInfo.java | 41 | ||||
-rw-r--r-- | telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java | 9 |
2 files changed, 36 insertions, 14 deletions
diff --git a/telephony/java/com/android/internal/telephony/CallerInfo.java b/telephony/java/com/android/internal/telephony/CallerInfo.java index e1bd1db..c8490e9 100644 --- a/telephony/java/com/android/internal/telephony/CallerInfo.java +++ b/telephony/java/com/android/internal/telephony/CallerInfo.java @@ -100,10 +100,14 @@ public class CallerInfo { public Drawable cachedPhoto; public boolean isCachedPhotoCurrent; + private boolean mIsEmergency; + // Don't keep checking VM if it's going to throw an exception for this proc. private static boolean sSkipVmCheck = false; public CallerInfo() { + // TODO: Move all the basic initialization here? + mIsEmergency = false; } /** @@ -221,13 +225,7 @@ public class CallerInfo { // or if it is the voicemail number. If it is either, take a // shortcut and skip the query. if (PhoneNumberUtils.isEmergencyNumber(number)) { - CallerInfo ci = new CallerInfo(); - - // Note we're setting the phone number here (refer to javadoc - // comments at the top of CallerInfo class). - ci.phoneNumber = context.getString( - com.android.internal.R.string.emergency_call_dialog_number_for_display); - return ci; + return new CallerInfo().markAsEmergency(context); } else { try { if (!sSkipVmCheck && PhoneNumberUtils.compare(number, @@ -296,6 +294,35 @@ public class CallerInfo { return callerID; } + // Accessors + + /** + * @return true if the caller info is an emergency number. + */ + public boolean isEmergencyNumber() { + return mIsEmergency; + } + + /** + * Mark this CallerInfo as an emergency call. + * @param context To lookup the localized 'Emergency Number' string. + * @return this instance. + */ + // TODO: Note we're setting the phone number here (refer to + // javadoc comments at the top of CallerInfo class) to a localized + // string 'Emergency Number'. This is pretty bad because we are + // making UI work here instead of just packaging the data. We + // should set the phone number to the dialed number and name to + // 'Emergency Number' and let the UI make the decision about what + // should be displayed. + /* package */ CallerInfo markAsEmergency(Context context) { + phoneNumber = context.getString( + com.android.internal.R.string.emergency_call_dialog_number_for_display); + photoResource = com.android.internal.R.drawable.picture_emergency; + mIsEmergency = true; + return this; + } + private static String normalize(String s) { if (s == null || s.length() > 0) { return s; diff --git a/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java b/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java index 3d4f78c..4227a84 100644 --- a/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java +++ b/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java @@ -37,7 +37,7 @@ import android.util.Log; public class CallerInfoAsyncQuery { private static final boolean DBG = false; - private static final String LOG_TAG = "PHONE"; + private static final String LOG_TAG = "CallerInfoAsyncQuery"; private static final int EVENT_NEW_QUERY = 1; private static final int EVENT_ADD_LISTENER = 2; @@ -223,13 +223,9 @@ public class CallerInfoAsyncQuery { // voicemail number, and adjust other data (including photoResource) // accordingly. if (cw.event == EVENT_EMERGENCY_NUMBER) { - mCallerInfo = new CallerInfo(); // Note we're setting the phone number here (refer to javadoc // comments at the top of CallerInfo class). - mCallerInfo.phoneNumber = mQueryContext.getString(com.android.internal - .R.string.emergency_call_dialog_number_for_display); - mCallerInfo.photoResource = com.android.internal.R.drawable.picture_emergency; - + mCallerInfo = new CallerInfo().markAsEmergency(mQueryContext); } else if (cw.event == EVENT_VOICEMAIL_NUMBER) { mCallerInfo = new CallerInfo(); try { @@ -390,4 +386,3 @@ public class CallerInfoAsyncQuery { Log.d(LOG_TAG, msg); } } - |