Cherry-pick Fix a Dead Loop issue in RecipientEditTextView

From AOSP: I01183680289919105dadc28ffd40c8e60dfd6b7e

The old code logic will cause dead loop when pasting phone number
to recipient.

Change-Id: I608f1bf2a5d5651f51be419f7b6125358f2389e2
Author: Jianping Li <jianpingx.li@intel.com>
Signed-off-by: Jianping Li <jianpingx.li@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 58793
diff --git a/chips/src/com/android/ex/chips/RecipientEditTextView.java b/chips/src/com/android/ex/chips/RecipientEditTextView.java
index 67f5147..4347202 100644
--- a/chips/src/com/android/ex/chips/RecipientEditTextView.java
+++ b/chips/src/com/android/ex/chips/RecipientEditTextView.java
@@ -2347,12 +2347,12 @@
         int originalTokenStart = mTokenizer.findTokenStart(text, getSelectionEnd());
         String lastAddress = text.substring(originalTokenStart);
         int tokenStart = originalTokenStart;
-        int prevTokenStart = tokenStart;
+        int prevTokenStart = 0;
         DrawableRecipientChip findChip = null;
         ArrayList<DrawableRecipientChip> created = new ArrayList<DrawableRecipientChip>();
         if (tokenStart != 0) {
             // There are things before this!
-            while (tokenStart != 0 && findChip == null) {
+            while (tokenStart != 0 && findChip == null && tokenStart != prevTokenStart) {
                 prevTokenStart = tokenStart;
                 tokenStart = mTokenizer.findTokenStart(text, tokenStart);
                 findChip = findChip(tokenStart);