Consolidate Contacts code.
As per the issue 2217164, I roughly looked over how the variable "phoneNumber" is treaded in Eclair, and found the code around it looked a little flaky.
I believe this change does not make Contacts code easier to read, while there's no malicious regression.
Internal issue number: 2217164
diff --git a/src/com/android/contacts/ContactsUtils.java b/src/com/android/contacts/ContactsUtils.java
index 622edbe..24f683f 100644
--- a/src/com/android/contacts/ContactsUtils.java
+++ b/src/com/android/contacts/ContactsUtils.java
@@ -51,7 +51,6 @@
import java.util.ArrayList;
public class ContactsUtils {
-
private static final String TAG = "ContactsUtils";
/**
* Build the display title for the {@link Data#CONTENT_URI} entry in the
@@ -387,7 +386,6 @@
/**
* Utility for creating a standard tab indicator view.
*
- * @param context The label to display in the tab indicator. If null, not label will be displayed.
* @param parent The parent ViewGroup to attach the new view to.
* @param source The {@link ContactsSource} to build the tab view from.
* @return The tab indicator View.
@@ -402,6 +400,9 @@
/**
* Kick off an intent to initiate a call.
+ *
+ * @param phoneNumber must not be null.
+ * @throws NullPointerException when the given argument is null.
*/
public static void initiateCall(Context context, CharSequence phoneNumber) {
Intent intent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
@@ -411,6 +412,9 @@
/**
* Kick off an intent to initiate an Sms/Mms message.
+ *
+ * @param phoneNumber must not be null.
+ * @throws NullPointerException when the given argument is null.
*/
public static void initiateSms(Context context, CharSequence phoneNumber) {
Intent intent = new Intent(Intent.ACTION_SENDTO,
diff --git a/src/com/android/contacts/PhoneDisambigDialog.java b/src/com/android/contacts/PhoneDisambigDialog.java
index b727c77..e0295e3 100644
--- a/src/com/android/contacts/PhoneDisambigDialog.java
+++ b/src/com/android/contacts/PhoneDisambigDialog.java
@@ -136,11 +136,11 @@
private class PhoneItem implements Collapsible<PhoneItem> {
- String phoneNumber;
- long id;
+ final String phoneNumber;
+ final long id;
public PhoneItem(String newPhoneNumber, long newId) {
- phoneNumber = newPhoneNumber;
+ phoneNumber = (newPhoneNumber != null ? newPhoneNumber : "");
id = newId;
}
@@ -160,6 +160,7 @@
return false;
}
+ @Override
public String toString() {
return phoneNumber;
}