diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-02-22 17:54:05 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-02-22 17:54:05 +0000 |
commit | b3772ecffe9901d9a55c3f3284cc652057b43f8b (patch) | |
tree | 7146a3f81ae20729260191d294e4baca01e8e3ce /java/com/android/dialer/main | |
parent | c54ce2658988ca36ca3dfab00daefca4dcfed3b2 (diff) | |
parent | a9776efc28f13671fe01c7a2ca5513d462e00b3c (diff) |
Merge changes Idbaca1df,Ie7824ce2,Id24b2318,Ib40632fe,I292f23ea, ...
* changes:
Do no preload dialpad fragment when opening search through search bar.
Add logging to NUI.
Implemented hangouts connection into GoogleMainActivity.
Created a "Metrics" interface.
Fix the icon & the label for blocked spam numbers in the new call log.
Move RttChatBot to simulator.
Update RTT call with real name/number and timer.
Include both PHOTO_URI and PHOTO_THUMBNAIL_URI in Cp2Info.
Add simulator RTT call.
Diffstat (limited to 'java/com/android/dialer/main')
4 files changed, 79 insertions, 23 deletions
diff --git a/java/com/android/dialer/main/MainActivityPeer.java b/java/com/android/dialer/main/MainActivityPeer.java index 6457b607b..c1a328a65 100644 --- a/java/com/android/dialer/main/MainActivityPeer.java +++ b/java/com/android/dialer/main/MainActivityPeer.java @@ -28,6 +28,8 @@ public interface MainActivityPeer { void onActivityStop(); + void onActivityDestroyed(); + void onNewIntent(Intent intent); void onActivityResult(int requestCode, int resultCode, Intent data); diff --git a/java/com/android/dialer/main/impl/MainSearchController.java b/java/com/android/dialer/main/impl/MainSearchController.java index 7098f8844..9b734f40c 100644 --- a/java/com/android/dialer/main/impl/MainSearchController.java +++ b/java/com/android/dialer/main/impl/MainSearchController.java @@ -40,6 +40,7 @@ import com.android.dialer.constants.ActivityRequestCodes; import com.android.dialer.dialpadview.DialpadFragment; import com.android.dialer.dialpadview.DialpadFragment.DialpadListener; import com.android.dialer.dialpadview.DialpadFragment.OnDialpadQueryChangedListener; +import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; import com.android.dialer.logging.ScreenEvent; import com.android.dialer.main.impl.bottomnav.BottomNavBar; @@ -204,14 +205,23 @@ public class MainSearchController implements SearchBarListener { public void onSearchListTouch() { if (isDialpadVisible()) { if (TextUtils.isEmpty(getDialpadFragment().getQuery())) { + Logger.get(mainActivity) + .logImpression( + DialerImpression.Type.NUI_TOUCH_DIALPAD_SEARCH_LIST_TO_CLOSE_SEARCH_AND_DIALPAD); closeSearch(true); } else { + Logger.get(mainActivity) + .logImpression(DialerImpression.Type.NUI_TOUCH_DIALPAD_SEARCH_LIST_TO_HIDE_DIALPAD); hideDialpad(/* animate=*/ true, /* bottomNavVisible=*/ false); } } else if (isSearchVisible()) { if (TextUtils.isEmpty(toolbar.getQuery())) { + Logger.get(mainActivity) + .logImpression(DialerImpression.Type.NUI_TOUCH_SEARCH_LIST_TO_CLOSE_SEARCH); closeSearch(true); } else { + Logger.get(mainActivity) + .logImpression(DialerImpression.Type.NUI_TOUCH_SEARCH_LIST_TO_HIDE_KEYBOARD); toolbar.hideKeyboard(); } } @@ -225,10 +235,17 @@ public class MainSearchController implements SearchBarListener { public boolean onBackPressed() { if (isDialpadVisible() && !TextUtils.isEmpty(getDialpadFragment().getQuery())) { LogUtil.i("MainSearchController#onBackPressed", "Dialpad visible with query"); + Logger.get(mainActivity) + .logImpression(DialerImpression.Type.NUI_PRESS_BACK_BUTTON_TO_HIDE_DIALPAD); hideDialpad(/* animate=*/ true, /* bottomNavVisible=*/ false); return true; } else if (isSearchVisible()) { LogUtil.i("MainSearchController#onBackPressed", "Search is visible"); + Logger.get(mainActivity) + .logImpression( + isDialpadVisible() + ? DialerImpression.Type.NUI_PRESS_BACK_BUTTON_TO_CLOSE_SEARCH_AND_DIALPAD + : DialerImpression.Type.NUI_PRESS_BACK_BUTTON_TO_CLOSE_SEARCH); closeSearch(true); return true; } else { @@ -252,16 +269,13 @@ public class MainSearchController implements SearchBarListener { mainActivity.getFragmentManager().beginTransaction().remove(getSearchFragment()).commit(); // Clear the dialpad so the phone number isn't persisted between search sessions. - getDialpadFragment().clearDialpad(); + if (getDialpadFragment() != null) { + getDialpadFragment().clearDialpad(); + } } - /** - * Returns {@link DialpadFragment}. - * - * <p>Unless this method is being called for the first time in {@link #openSearch(Optional)} or - * {@link #showDialpad(boolean)}, it should never return null. - */ - private DialpadFragment getDialpadFragment() { + @Nullable + protected DialpadFragment getDialpadFragment() { return (DialpadFragment) mainActivity.getFragmentManager().findFragmentByTag(DIALPAD_FRAGMENT_TAG); } @@ -297,6 +311,7 @@ public class MainSearchController implements SearchBarListener { */ @Override public void onSearchBarClicked() { + Logger.get(mainActivity).logImpression(DialerImpression.Type.NUI_CLICK_SEARCH_BAR); openSearch(Optional.absent()); } @@ -316,14 +331,6 @@ public class MainSearchController implements SearchBarListener { transaction.show(getSearchFragment()); } - // Add the dialpad fragment but keep it hidden - if (getDialpadFragment() == null) { - DialpadFragment dialpadFragment = new DialpadFragment(); - transaction - .add(R.id.dialpad_fragment_container, dialpadFragment, DIALPAD_FRAGMENT_TAG) - .hide(dialpadFragment); - } - transaction.commit(); } @@ -350,6 +357,7 @@ public class MainSearchController implements SearchBarListener { @Override public void onVoiceButtonClicked(VoiceSearchResultCallback voiceSearchResultCallback) { + Logger.get(mainActivity).logImpression(DialerImpression.Type.NUI_CLICK_SEARCH_BAR_VOICE_BUTTON); try { Intent voiceIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); mainActivity.startActivityForResult(voiceIntent, ActivityRequestCodes.DIALTACTS_VOICE_SEARCH); diff --git a/java/com/android/dialer/main/impl/NewMainActivityPeer.java b/java/com/android/dialer/main/impl/NewMainActivityPeer.java index 0a85667a1..ed67df936 100644 --- a/java/com/android/dialer/main/impl/NewMainActivityPeer.java +++ b/java/com/android/dialer/main/impl/NewMainActivityPeer.java @@ -60,6 +60,9 @@ public class NewMainActivityPeer implements MainActivityPeer { public void onActivityStop() {} @Override + public void onActivityDestroyed() {} + + @Override public void onNewIntent(Intent intent) {} @Override diff --git a/java/com/android/dialer/main/impl/OldMainActivityPeer.java b/java/com/android/dialer/main/impl/OldMainActivityPeer.java index c46e61bd0..07c7185ae 100644 --- a/java/com/android/dialer/main/impl/OldMainActivityPeer.java +++ b/java/com/android/dialer/main/impl/OldMainActivityPeer.java @@ -66,6 +66,8 @@ import com.android.dialer.dialpadview.DialpadFragment.DialpadListener; import com.android.dialer.dialpadview.DialpadFragment.LastOutgoingCallCallback; import com.android.dialer.dialpadview.DialpadFragment.OnDialpadQueryChangedListener; import com.android.dialer.interactions.PhoneNumberInteraction; +import com.android.dialer.logging.DialerImpression; +import com.android.dialer.logging.Logger; import com.android.dialer.main.MainActivityPeer; import com.android.dialer.main.impl.bottomnav.BottomNavBar; import com.android.dialer.main.impl.bottomnav.BottomNavBar.OnBottomNavTabSelectedListener; @@ -154,6 +156,7 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen @Override public void onActivityCreate(Bundle savedInstanceState) { + LogUtil.enterBlock("OldMainActivityPeer.onActivityCreate"); mainActivity.setContentView(R.layout.main_activity); initUiListeners(); initLayout(savedInstanceState); @@ -173,14 +176,19 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen snackbarContainer = mainActivity.findViewById(R.id.coordinator_layout); FloatingActionButton fab = mainActivity.findViewById(R.id.fab); - fab.setOnClickListener(v -> searchController.showDialpad(true)); + fab.setOnClickListener( + v -> { + Logger.get(mainActivity) + .logImpression(DialerImpression.Type.NUI_CLICK_FAB_TO_OPEN_DIALPAD); + searchController.showDialpad(true); + }); MainToolbar toolbar = mainActivity.findViewById(R.id.toolbar); mainActivity.setSupportActionBar(mainActivity.findViewById(R.id.toolbar)); bottomNav = mainActivity.findViewById(R.id.bottom_nav_bar); MainBottomNavBarBottomNavTabListener bottomNavTabListener = - new MainBottomNavBarBottomNavTabListener(mainActivity.getFragmentManager()); + new MainBottomNavBarBottomNavTabListener(mainActivity, mainActivity.getFragmentManager()); bottomNav.addOnTabSelectedListener(bottomNavTabListener); callLogFragmentListener = @@ -191,7 +199,7 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen searchController = getNewMainSearchController(bottomNav, fab, toolbar); toolbar.setSearchBarListener(searchController); - onDialpadQueryChangedListener = new MainOnDialpadQueryChangedListener(searchController); + onDialpadQueryChangedListener = getNewOnDialpadQueryChangedListener(searchController); dialpadListener = new MainDialpadListener(mainActivity, searchController, getLastOutgoingCallListener); searchFragmentListener = new MainSearchFragmentListener(searchController); @@ -222,6 +230,7 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen @Override public void onNewIntent(Intent intent) { + LogUtil.enterBlock("OldMainActivityPeer.onNewIntent"); showTabOnIntent(intent); } @@ -285,6 +294,9 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen mainActivity.getSystemService(KeyguardManager.class).isKeyguardLocked()); } + @Override + public void onActivityDestroyed() {} + private void showPostCallPrompt() { if (TelecomUtil.isInManagedCall(mainActivity)) { // No prompt to show if the user is in a call @@ -309,10 +321,15 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { + LogUtil.i( + "OldMainActivityPeer.onActivityResult", + "requestCode:%d, resultCode:%d", + requestCode, + resultCode); if (requestCode == ActivityRequestCodes.DIALTACTS_VOICE_SEARCH) { searchController.onVoiceResults(resultCode, data); } else { - LogUtil.e("MainActivity.onActivityResult", "Unknown request code: " + requestCode); + LogUtil.e("OldMainActivityPeer.onActivityResult", "Unknown request code: " + requestCode); } } @@ -350,6 +367,8 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen return (T) onPhoneNumberPickerActionListener; } else if (callbackInterface.isInstance(oldSpeedDialFragmentHost)) { return (T) oldSpeedDialFragmentHost; + } else if (callbackInterface.isInstance(searchController)) { + return (T) searchController; } else { return null; } @@ -360,6 +379,11 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen return new MainSearchController(mainActivity, bottomNavBar, fab, mainToolbar); } + public MainOnDialpadQueryChangedListener getNewOnDialpadQueryChangedListener( + MainSearchController mainSearchController) { + return new MainOnDialpadQueryChangedListener(mainSearchController); + } + /** @see OnContactSelectedListener */ private static final class MainOnContactSelectedListener implements OnContactSelectedListener { @@ -378,12 +402,12 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen } /** @see OnDialpadQueryChangedListener */ - private static final class MainOnDialpadQueryChangedListener + protected static class MainOnDialpadQueryChangedListener implements OnDialpadQueryChangedListener { private final MainSearchController searchController; - MainOnDialpadQueryChangedListener(MainSearchController searchController) { + protected MainOnDialpadQueryChangedListener(MainSearchController searchController) { this.searchController = searchController; } @@ -794,13 +818,20 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen private static final String VOICEMAIL_TAG = "voicemail"; private final FragmentManager fragmentManager; + private final Context context; + @TabIndex private int selectedTab = -1; - private MainBottomNavBarBottomNavTabListener(FragmentManager fragmentManager) { + private MainBottomNavBarBottomNavTabListener(Context context, FragmentManager fragmentManager) { this.fragmentManager = fragmentManager; + this.context = context; } @Override public void onSpeedDialSelected() { + if (selectedTab != TabIndex.SPEED_DIAL) { + Logger.get(context).logImpression(DialerImpression.Type.NUI_SWITCH_TAB_TO_FAVORITE); + selectedTab = TabIndex.SPEED_DIAL; + } hideAllFragments(); Fragment fragment = fragmentManager.findFragmentByTag(SPEED_DIAL_TAG); if (fragment == null) { @@ -815,6 +846,10 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen @Override public void onCallLogSelected() { + if (selectedTab != TabIndex.CALL_LOG) { + Logger.get(context).logImpression(DialerImpression.Type.NUI_SWITCH_TAB_TO_CALL_LOG); + selectedTab = TabIndex.CALL_LOG; + } hideAllFragments(); CallLogFragment fragment = (CallLogFragment) fragmentManager.findFragmentByTag(CALL_LOG_TAG); if (fragment == null) { @@ -829,6 +864,10 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen @Override public void onContactsSelected() { + if (selectedTab != TabIndex.CONTACTS) { + Logger.get(context).logImpression(DialerImpression.Type.NUI_SWITCH_TAB_TO_CONTACTS); + selectedTab = TabIndex.CONTACTS; + } hideAllFragments(); ContactsFragment fragment = (ContactsFragment) fragmentManager.findFragmentByTag(CONTACTS_TAG); @@ -847,6 +886,10 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen @Override public void onVoicemailSelected() { + if (selectedTab != TabIndex.VOICEMAIL) { + Logger.get(context).logImpression(DialerImpression.Type.NUI_SWITCH_TAB_TO_VOICEMAIL); + selectedTab = TabIndex.VOICEMAIL; + } hideAllFragments(); VisualVoicemailCallLogFragment fragment = (VisualVoicemailCallLogFragment) fragmentManager.findFragmentByTag(VOICEMAIL_TAG); |