Trim edit fields that don't contain printable values.
When persisting edit changes, trim data rows that have no
printable characters. Also wrote unit tests for new method
and building of IM intents to check Uri escaping.
Fixes http://b/2173811
diff --git a/src/com/android/contacts/ContactsUtils.java b/src/com/android/contacts/ContactsUtils.java
index 5f003de..1e3b8ad 100644
--- a/src/com/android/contacts/ContactsUtils.java
+++ b/src/com/android/contacts/ContactsUtils.java
@@ -416,4 +416,12 @@
Uri.fromParts("sms", phoneNumber.toString(), null));
context.startActivity(intent);
}
+
+ /**
+ * Test if the given {@link CharSequence} contains any graphic characters,
+ * first checking {@link TextUtils#isEmpty(CharSequence)} to handle null.
+ */
+ public static boolean isGraphic(CharSequence str) {
+ return !TextUtils.isEmpty(str) && TextUtils.isGraphic(str);
+ }
}