Merge "First pass for Dialer onboarding flow" into ub-contactsdialer-a-dev
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index b36066a..0a330d8 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -153,5 +153,5 @@
     <dimen name="blocked_number_primary_text_size">16sp</dimen>
     <dimen name="blocked_number_secondary_text_size">12sp</dimen>
     <dimen name="blocked_number_delete_icon_size">32dp</dimen>
-    <dimen name="blocked_number_search_text_size">16sp</dimen>
+    <dimen name="blocked_number_search_text_size">14sp</dimen>
 </resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index b8c4e97..e5d32ea 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -471,7 +471,7 @@
     <string name="dialer_hint_find_contact">Search contacts</string>
 
     <!-- Hint displayed in add blocked number search box when there is no query typed.
-         [CHAR LIMIT=30] -->
+         [CHAR LIMIT=40] -->
     <string name="block_number_search_hint">Add number or search contacts</string>
 
     <!-- String resource for the font-family to use for the call log activity's title
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index 6f8f341..9978bbe 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -1252,15 +1252,14 @@
     }
 
     @Override
-    public void onPickPhoneNumberAction(Uri dataUri, int callInitiationType) {
+    public void onPickDataUri(Uri dataUri, int callInitiationType) {
         mClearSearchOnPause = true;
         PhoneNumberInteraction.startInteractionForPhoneCall(
                 DialtactsActivity.this, dataUri, callInitiationType);
     }
 
     @Override
-    public void onCallNumberDirectly(String phoneNumber, boolean isVideoCall,
-            int callInitiationType) {
+    public void onPickPhoneNumber(String phoneNumber, boolean isVideoCall, int callInitiationType) {
         if (phoneNumber == null) {
             // Invalid phone number, but let the call go through so that InCallUI can show
             // an error message.
diff --git a/src/com/android/dialer/filterednumber/BlockedNumberSearchActivity.java b/src/com/android/dialer/filterednumber/BlockedNumberSearchActivity.java
index 5831ddc..a8cbfb3 100644
--- a/src/com/android/dialer/filterednumber/BlockedNumberSearchActivity.java
+++ b/src/com/android/dialer/filterednumber/BlockedNumberSearchActivity.java
@@ -137,13 +137,12 @@
     }
 
     @Override
-    public void onPickPhoneNumberAction(Uri dataUri, int callInitiationType) {
-        Log.w(TAG, "onPickPhoneNumberAction unsupported, ignoring.");
+    public void onPickDataUri(Uri dataUri, int callInitiationType) {
+        Log.w(TAG, "onPickDataUri unsupported, ignoring.");
     }
 
     @Override
-    public void onCallNumberDirectly(
-            String phoneNumber, boolean isVideoCall, int callInitiationType) {
+    public void onPickPhoneNumber(String phoneNumber, boolean isVideoCall, int callInitiationType) {
         blockNumber(phoneNumber);
     }
 
diff --git a/src/com/android/dialer/list/BlockedListSearchFragment.java b/src/com/android/dialer/list/BlockedListSearchFragment.java
index bd1dd6f..d025772 100644
--- a/src/com/android/dialer/list/BlockedListSearchFragment.java
+++ b/src/com/android/dialer/list/BlockedListSearchFragment.java
@@ -47,12 +47,12 @@
             case DialerPhoneNumberListAdapter.SHORTCUT_INVALID:
                 // Handles click on a search result, either contact or nearby places result.
                 number = adapter.getPhoneNumber(position);
-                listener.onCallNumberDirectly(number, false, getCallInitiationType(false));
+                listener.onPickPhoneNumber(number, false, getCallInitiationType(false));
                 break;
             case DialerPhoneNumberListAdapter.SHORTCUT_BLOCK_NUMBER:
                 // Handles click on 'Block number' shortcut to add the user query as a number.
                 number = adapter.getQueryString();
-                listener.onCallNumberDirectly(number, false, getCallInitiationType(false));
+                listener.onPickPhoneNumber(number, false, getCallInitiationType(false));
                 break;
             default:
                 Log.w(TAG, "Ignoring unsupported shortcut type: " + shortcutType);
diff --git a/src/com/android/dialer/list/SearchFragment.java b/src/com/android/dialer/list/SearchFragment.java
index f75fa0f..1c895d3 100644
--- a/src/com/android/dialer/list/SearchFragment.java
+++ b/src/com/android/dialer/list/SearchFragment.java
@@ -25,13 +25,10 @@
 import android.content.Intent;
 import android.content.res.Configuration;
 import android.content.res.Resources;
-import android.net.Uri;
 import android.os.Bundle;
-import android.provider.ContactsContract;
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.LayoutInflater;
-import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.animation.Interpolator;
@@ -47,13 +44,11 @@
 import com.android.contacts.common.list.PhoneNumberPickerFragment;
 import com.android.contacts.common.util.PermissionsUtil;
 import com.android.contacts.common.util.ViewUtil;
-import com.android.contacts.commonbind.analytics.AnalyticsUtil;
 import com.android.dialer.dialpad.DialpadFragment.ErrorDialogFragment;
 import com.android.dialer.R;
 import com.android.dialer.util.DialerUtils;
 import com.android.dialer.util.IntentUtil;
 import com.android.dialer.widget.EmptyContentView;
-import com.android.incallui.Call.LogState;
 import com.android.phone.common.animation.AnimUtils;
 
 public class SearchFragment extends PhoneNumberPickerFragment {
@@ -253,7 +248,7 @@
                 number = adapter.getQueryString();
                 listener = getOnPhoneNumberPickerListener();
                 if (listener != null && !checkForProhibitedPhoneNumber(number)) {
-                    listener.onCallNumberDirectly(number, false /* isVideoCall */,
+                    listener.onPickPhoneNumber(number, false /* isVideoCall */,
                             getCallInitiationType(false /* isRemoteDirectory */));
                 }
                 break;
@@ -279,7 +274,7 @@
                 number = adapter.getQueryString();
                 listener = getOnPhoneNumberPickerListener();
                 if (listener != null && !checkForProhibitedPhoneNumber(number)) {
-                    listener.onCallNumberDirectly(number, true /* isVideoCall */,
+                    listener.onPickPhoneNumber(number, true /* isVideoCall */,
                             getCallInitiationType(false /* isRemoteDirectory */));
                 }
                 break;
diff --git a/src/com/android/dialer/list/SpeedDialFragment.java b/src/com/android/dialer/list/SpeedDialFragment.java
index 7b72e45..64129cd 100644
--- a/src/com/android/dialer/list/SpeedDialFragment.java
+++ b/src/com/android/dialer/list/SpeedDialFragment.java
@@ -52,7 +52,6 @@
 import com.android.contacts.common.list.OnPhoneNumberPickerActionListener;
 import com.android.contacts.common.util.PermissionsUtil;
 import com.android.dialer.R;
-import com.android.dialer.util.DialerUtils;
 import com.android.dialer.widget.EmptyContentView;
 import com.android.incallui.Call.LogState;
 
@@ -116,7 +115,7 @@
         @Override
         public void onContactSelected(Uri contactUri, Rect targetRect) {
             if (mPhoneNumberPickerActionListener != null) {
-                mPhoneNumberPickerActionListener.onPickPhoneNumberAction(contactUri,
+                mPhoneNumberPickerActionListener.onPickDataUri(contactUri,
                         LogState.INITIATION_SPEED_DIAL);
             }
         }
@@ -124,7 +123,7 @@
         @Override
         public void onCallNumberDirectly(String phoneNumber) {
             if (mPhoneNumberPickerActionListener != null) {
-                mPhoneNumberPickerActionListener.onCallNumberDirectly(phoneNumber,
+                mPhoneNumberPickerActionListener.onPickPhoneNumber(phoneNumber,
                         false /* isVideoCall */, LogState.INITIATION_SPEED_DIAL);
             }
         }
diff --git a/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java b/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java
index aa2d265..e499e55 100644
--- a/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java
+++ b/tests/src/com/android/dialer/tests/calllog/FillCallLogTestActivity.java
@@ -40,6 +40,8 @@
 import android.telecom.PhoneAccount;
 import android.telecom.PhoneAccountHandle;
 import android.telecom.TelecomManager;
+import android.text.Editable;
+import android.text.TextWatcher;
 import android.text.format.DateFormat;
 import android.util.Log;
 import android.view.MotionEvent;
@@ -151,11 +153,21 @@
         mAccount0 = (RadioButton) findViewById(R.id.account0);
         mAccount1 = (RadioButton) findViewById(R.id.account1);
 
-        mCustomCallTypeTextView.setOnTouchListener(new View.OnTouchListener() {
+        mCustomCallTypeTextView.addTextChangedListener(new TextWatcher() {
             @Override
-            public boolean onTouch(View v, MotionEvent event) {
+            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+                // Do nothing.
+            }
+
+            @Override
+            public void onTextChanged(CharSequence s, int start, int before, int count) {
+                // Toggle the custom call type radio button if the text is changed/focused.
                 mCallTypeCustom.toggle();
-                return false;
+            }
+
+            @Override
+            public void afterTextChanged(Editable s) {
+                // Do nothing.
             }
         });
 
diff --git a/tests/src/com/android/dialer/voicemail/VoicemailPlaybackTest.java b/tests/src/com/android/dialer/voicemail/VoicemailPlaybackTest.java
index 420a17c..3a74f73 100644
--- a/tests/src/com/android/dialer/voicemail/VoicemailPlaybackTest.java
+++ b/tests/src/com/android/dialer/voicemail/VoicemailPlaybackTest.java
@@ -111,12 +111,9 @@
             @Override
             public void run() {
                 mPresenter.resumePlayback();
+                assertStateTextContains("Loading voicemail");
             }
         });
-        mFakeAsyncTaskExecutor.runTask(CHECK_FOR_CONTENT);
-        getInstrumentation().waitForIdleSync();
-
-        assertStateTextContains("Loading voicemail");
     }
 
     public void testWhenCheckForContentCompletes() throws Throwable {
@@ -132,8 +129,7 @@
         mFakeAsyncTaskExecutor.runTask(CHECK_FOR_CONTENT);
         getInstrumentation().waitForIdleSync();
 
-        // Since the content is already fetched, don't show the loading message.
-        assertStateTextNotContains("Loading voicemail");
+        assertStateTextContains("Loading voicemail");
     }
 
     public void testInvalidVoicemailShowsErrorMessage() throws Throwable {
@@ -232,12 +228,12 @@
         }
     }
 
-    private void assertStateTextContains(String text) throws Throwable {
+    private void assertStateTextContains(String text) {
         assertNotNull(mLayout);
         assertTrue(mLayout.getStateText().contains(text));
     }
 
-    private void assertStateTextNotContains(String text) throws Throwable {
+    private void assertStateTextNotContains(String text) {
         assertNotNull(mLayout);
         assertFalse(mLayout.getStateText().contains(text));
     }