Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d554f435 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "NUI logging"

parents 43b6a3ff a05ee285
Loading
Loading
Loading
Loading
+11 −2
Original line number Original line Diff line number Diff line
@@ -12,7 +12,7 @@ message DialerImpression {
  // Event enums to be used for Impression Logging in Dialer.
  // Event enums to be used for Impression Logging in Dialer.
  // It's perfectly acceptable for this enum to be large
  // It's perfectly acceptable for this enum to be large
  // Values should be from 1000 to 100000.
  // Values should be from 1000 to 100000.
  // Next Tag: 1346
  // Next Tag: 1352
  enum Type {
  enum Type {
    UNKNOWN_AOSP_EVENT_TYPE = 1000;
    UNKNOWN_AOSP_EVENT_TYPE = 1000;


@@ -658,7 +658,7 @@ message DialerImpression {
    DUO_CALL_LOG_SET_UP_ACTIVATE_SHOWN = 1325;
    DUO_CALL_LOG_SET_UP_ACTIVATE_SHOWN = 1325;
    DUO_CALL_LOG_INVITE_SHOWN = 1326;
    DUO_CALL_LOG_INVITE_SHOWN = 1326;


    // NUI bottom navigation bar
    // NUI bottom navigation bar user actions
    MAIN_SWITCH_TAB_TO_FAVORITE = 1327;
    MAIN_SWITCH_TAB_TO_FAVORITE = 1327;
    MAIN_SWITCH_TAB_TO_CALL_LOG = 1328;
    MAIN_SWITCH_TAB_TO_CALL_LOG = 1328;
    MAIN_SWITCH_TAB_TO_CONTACTS = 1329;
    MAIN_SWITCH_TAB_TO_CONTACTS = 1329;
@@ -686,5 +686,14 @@ message DialerImpression {
    ANNOTATED_CALL_LOG_CHANGES_NEEDED = 1344;
    ANNOTATED_CALL_LOG_CHANGES_NEEDED = 1344;
    // The call log was force refreshed and changes were needed.
    // The call log was force refreshed and changes were needed.
    ANNOTATED_CALL_LOG_FORCE_REFRESH_CHANGES_NEEDED = 1345;
    ANNOTATED_CALL_LOG_FORCE_REFRESH_CHANGES_NEEDED = 1345;

    MAIN_VVM_TAB_VISIBLE = 1346;

    // Main bottom navigation bar non user actions
    MAIN_OPEN_WITH_TAB_FAVORITE = 1347;
    MAIN_OPEN_WITH_TAB_CALL_LOG = 1348;
    MAIN_OPEN_WITH_TAB_CONTACTS = 1349;
    MAIN_OPEN_WITH_TAB_VOICEMAIL = 1350;
    MAIN_OPEN_WITH_DIALPAD = 1351;
  }
  }
}
}
+7 −0
Original line number Original line Diff line number Diff line
@@ -69,5 +69,12 @@ message ScreenEvent {
    BLOCKED_NUMBER_ADD_NUMBER = 19;
    BLOCKED_NUMBER_ADD_NUMBER = 19;


    CALL_DETAILS = 20;
    CALL_DETAILS = 20;

    MAIN_SPEED_DIAL = 21;
    MAIN_CALL_LOG = 22;
    MAIN_CONTACTS = 23;
    MAIN_VOICEMAIL = 24;
    MAIN_DIALPAD = 25;
    MAIN_SEARCH = 26;
  }
  }
}
}
+5 −0
Original line number Original line Diff line number Diff line
@@ -114,6 +114,8 @@ public class MainSearchController implements SearchBarListener {
  private void showDialpad(boolean animate, boolean fromNewIntent) {
  private void showDialpad(boolean animate, boolean fromNewIntent) {
    Assert.checkArgument(!isDialpadVisible());
    Assert.checkArgument(!isDialpadVisible());


    Logger.get(mainActivity).logScreenView(ScreenEvent.Type.MAIN_DIALPAD, mainActivity);

    fab.hide();
    fab.hide();
    toolbar.slideUp(animate);
    toolbar.slideUp(animate);
    toolbar.expand(animate, Optional.absent());
    toolbar.expand(animate, Optional.absent());
@@ -357,6 +359,9 @@ public class MainSearchController implements SearchBarListener {


  private void openSearch(Optional<String> query) {
  private void openSearch(Optional<String> query) {
    LogUtil.enterBlock("MainSearchController.openSearch");
    LogUtil.enterBlock("MainSearchController.openSearch");

    Logger.get(mainActivity).logScreenView(ScreenEvent.Type.MAIN_SEARCH, mainActivity);

    fab.hide();
    fab.hide();
    toolbar.expand(/* animate=*/ true, query);
    toolbar.expand(/* animate=*/ true, query);
    toolbar.showKeyboard();
    toolbar.showKeyboard();
+42 −17
Original line number Original line Diff line number Diff line
@@ -83,6 +83,7 @@ import com.android.dialer.duo.DuoComponent;
import com.android.dialer.interactions.PhoneNumberInteraction;
import com.android.dialer.interactions.PhoneNumberInteraction;
import com.android.dialer.logging.DialerImpression;
import com.android.dialer.logging.DialerImpression;
import com.android.dialer.logging.Logger;
import com.android.dialer.logging.Logger;
import com.android.dialer.logging.ScreenEvent;
import com.android.dialer.main.MainActivityPeer;
import com.android.dialer.main.MainActivityPeer;
import com.android.dialer.main.impl.bottomnav.BottomNavBar;
import com.android.dialer.main.impl.bottomnav.BottomNavBar;
import com.android.dialer.main.impl.bottomnav.BottomNavBar.OnBottomNavTabSelectedListener;
import com.android.dialer.main.impl.bottomnav.BottomNavBar.OnBottomNavTabSelectedListener;
@@ -242,6 +243,7 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen
    onPhoneNumberPickerActionListener = new MainOnPhoneNumberPickerActionListener(mainActivity);
    onPhoneNumberPickerActionListener = new MainOnPhoneNumberPickerActionListener(mainActivity);
    oldSpeedDialFragmentHost =
    oldSpeedDialFragmentHost =
        new MainOldSpeedDialFragmentHost(
        new MainOldSpeedDialFragmentHost(
            mainActivity,
            bottomNav,
            bottomNav,
            mainActivity.findViewById(R.id.contact_tile_drag_shadow_overlay),
            mainActivity.findViewById(R.id.contact_tile_drag_shadow_overlay),
            mainActivity.findViewById(R.id.remove_view),
            mainActivity.findViewById(R.id.remove_view),
@@ -337,31 +339,35 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen
    //     select a tab here.
    //     select a tab here.
    //  2) Don't return early here in case the intent does contain extra data.
    //  2) Don't return early here in case the intent does contain extra data.
    //  3) External intents should take priority over other intents (like Calls.CONTENT_TYPE).
    //  3) External intents should take priority over other intents (like Calls.CONTENT_TYPE).
    @TabIndex int tabToSelect;
    if (Calls.CONTENT_TYPE.equals(intent.getType())) {
    if (Calls.CONTENT_TYPE.equals(intent.getType())) {
      Bundle extras = intent.getExtras();
      Bundle extras = intent.getExtras();
      if (extras != null && extras.getInt(Calls.EXTRA_CALL_TYPE_FILTER) == Calls.VOICEMAIL_TYPE) {
      if (extras != null && extras.getInt(Calls.EXTRA_CALL_TYPE_FILTER) == Calls.VOICEMAIL_TYPE) {
        LogUtil.i("OldMainActivityPeer.onHandleIntent", "Voicemail content type intent");
        LogUtil.i("OldMainActivityPeer.onHandleIntent", "Voicemail content type intent");
        bottomNav.selectTab(TabIndex.VOICEMAIL);
        tabToSelect = TabIndex.VOICEMAIL;
        Logger.get(mainActivity).logImpression(DialerImpression.Type.VVM_NOTIFICATION_CLICKED);
        Logger.get(mainActivity).logImpression(DialerImpression.Type.VVM_NOTIFICATION_CLICKED);
      } else {
      } else {
        LogUtil.i("OldMainActivityPeer.onHandleIntent", "Call log content type intent");
        LogUtil.i("OldMainActivityPeer.onHandleIntent", "Call log content type intent");
        bottomNav.selectTab(TabIndex.CALL_LOG);
        tabToSelect = TabIndex.CALL_LOG;
      }
      }


    } else if (isShowTabIntent(intent)) {
    } else if (isShowTabIntent(intent)) {
      LogUtil.i("OldMainActivityPeer.onHandleIntent", "Show tab intent");
      LogUtil.i("OldMainActivityPeer.onHandleIntent", "Show tab intent");
      bottomNav.selectTab(getTabFromIntent(intent));
      tabToSelect = getTabFromIntent(intent);
    } else if (lastTabController.isEnabled) {
    } else if (lastTabController.isEnabled) {
      LogUtil.i("OldMainActivityPeer.onHandleIntent", "Show last tab");
      LogUtil.i("OldMainActivityPeer.onHandleIntent", "Show last tab");
      lastTabController.selectLastTab();
      tabToSelect = lastTabController.getLastTab();
    } else {
    } else {
      bottomNav.selectTab(TabIndex.SPEED_DIAL);
      tabToSelect = TabIndex.SPEED_DIAL;
    }
    }
    logImpressionForSelectedTab(tabToSelect);
    bottomNav.selectTab(tabToSelect);


    if (isDialOrAddCallIntent(intent)) {
    if (isDialOrAddCallIntent(intent)) {
      LogUtil.i("OldMainActivityPeer.onHandleIntent", "Dial or add call intent");
      LogUtil.i("OldMainActivityPeer.onHandleIntent", "Dial or add call intent");
      // Dialpad will grab the intent and populate the number
      // Dialpad will grab the intent and populate the number
      searchController.showDialpadFromNewIntent();
      searchController.showDialpadFromNewIntent();
      Logger.get(mainActivity).logImpression(DialerImpression.Type.MAIN_OPEN_WITH_DIALPAD);
    }
    }


    if (intent.getBooleanExtra(DialtactsActivity.EXTRA_CLEAR_NEW_VOICEMAILS, false)) {
    if (intent.getBooleanExtra(DialtactsActivity.EXTRA_CLEAR_NEW_VOICEMAILS, false)) {
@@ -370,6 +376,21 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen
    }
    }
  }
  }


  /** Log impression for non user tab selection. */
  private void logImpressionForSelectedTab(@TabIndex int tab) {
    if (tab == TabIndex.SPEED_DIAL) {
      Logger.get(mainActivity).logImpression(DialerImpression.Type.MAIN_OPEN_WITH_TAB_FAVORITE);
    } else if (tab == TabIndex.CALL_LOG) {
      Logger.get(mainActivity).logImpression(DialerImpression.Type.MAIN_OPEN_WITH_TAB_CALL_LOG);
    } else if (tab == TabIndex.CONTACTS) {
      Logger.get(mainActivity).logImpression(DialerImpression.Type.MAIN_OPEN_WITH_TAB_CONTACTS);
    } else if (tab == TabIndex.VOICEMAIL) {
      Logger.get(mainActivity).logImpression(DialerImpression.Type.MAIN_OPEN_WITH_TAB_VOICEMAIL);
    } else {
      throw new IllegalStateException("Invalid tab: " + tab);
    }
  }

  /** Returns true if the given intent is a Dial intent with data or an Add Call intent. */
  /** Returns true if the given intent is a Dial intent with data or an Add Call intent. */
  private boolean isDialOrAddCallIntent(Intent intent) {
  private boolean isDialOrAddCallIntent(Intent intent) {
    if (intent == null) {
    if (intent == null) {
@@ -819,8 +840,7 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen
              numberOfActiveVoicemailSources));
              numberOfActiveVoicemailSources));


      if (hasActiveVoicemailProvider) {
      if (hasActiveVoicemailProvider) {
        // TODO(yueg): Use new logging for VVM_TAB_VISIBLE
        Logger.get(context).logImpression(DialerImpression.Type.MAIN_VVM_TAB_VISIBLE);
        // Logger.get(context).logImpression(DialerImpression.Type.VVM_TAB_VISIBLE);
        bottomNavBar.showVoicemail(true);
        bottomNavBar.showVoicemail(true);
        callLogQueryHandler.fetchVoicemailUnreadCount();
        callLogQueryHandler.fetchVoicemailUnreadCount();
      } else {
      } else {
@@ -994,6 +1014,7 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen
  private static final class MainOldSpeedDialFragmentHost
  private static final class MainOldSpeedDialFragmentHost
      implements OldSpeedDialFragment.HostInterface, OnDragDropListener {
      implements OldSpeedDialFragment.HostInterface, OnDragDropListener {


    private final Context context;
    private final BottomNavBar bottomNavBar;
    private final BottomNavBar bottomNavBar;
    private final ImageView dragShadowOverlay;
    private final ImageView dragShadowOverlay;
    private final RemoveView removeView;
    private final RemoveView removeView;
@@ -1005,11 +1026,13 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen
    private DragDropController dragDropController;
    private DragDropController dragDropController;


    MainOldSpeedDialFragmentHost(
    MainOldSpeedDialFragmentHost(
        Context context,
        BottomNavBar bottomNavBar,
        BottomNavBar bottomNavBar,
        ImageView dragShadowOverlay,
        ImageView dragShadowOverlay,
        RemoveView removeView,
        RemoveView removeView,
        View searchViewContainer,
        View searchViewContainer,
        MainToolbar toolbar) {
        MainToolbar toolbar) {
      this.context = context;
      this.bottomNavBar = bottomNavBar;
      this.bottomNavBar = bottomNavBar;
      this.dragShadowOverlay = dragShadowOverlay;
      this.dragShadowOverlay = dragShadowOverlay;
      this.removeView = removeView;
      this.removeView = removeView;
@@ -1025,6 +1048,7 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen
    @Override
    @Override
    public void showAllContactsTab() {
    public void showAllContactsTab() {
      bottomNavBar.selectTab(TabIndex.CONTACTS);
      bottomNavBar.selectTab(TabIndex.CONTACTS);
      Logger.get(context).logImpression(DialerImpression.Type.MAIN_OPEN_WITH_TAB_CONTACTS);
    }
    }


    @Override
    @Override
@@ -1077,22 +1101,22 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen
    private static final String CONTACTS_TAG = "contacts";
    private static final String CONTACTS_TAG = "contacts";
    private static final String VOICEMAIL_TAG = "voicemail";
    private static final String VOICEMAIL_TAG = "voicemail";


    private final Context context;
    private final MainActivity mainActivity;
    private final FragmentManager fragmentManager;
    private final FragmentManager fragmentManager;
    private final FloatingActionButton fab;
    private final FloatingActionButton fab;


    @TabIndex private int selectedTab = -1;
    @TabIndex private int selectedTab = -1;


    private MainBottomNavBarBottomNavTabListener(
    private MainBottomNavBarBottomNavTabListener(
        Context context, FragmentManager fragmentManager, FloatingActionButton fab) {
        MainActivity mainActivity, FragmentManager fragmentManager, FloatingActionButton fab) {
      this.context = context;
      this.mainActivity = mainActivity;
      this.fragmentManager = fragmentManager;
      this.fragmentManager = fragmentManager;
      this.fab = fab;
      this.fab = fab;
      preloadCallLogFragment();
      preloadCallLogFragment();
    }
    }


    private void preloadCallLogFragment() {
    private void preloadCallLogFragment() {
      if (ConfigProviderBindings.get(context).getBoolean("nui_preload_call_log", true)) {
      if (ConfigProviderBindings.get(mainActivity).getBoolean("nui_preload_call_log", true)) {
        CallLogFragment fragment = new CallLogFragment();
        CallLogFragment fragment = new CallLogFragment();
        fragmentManager
        fragmentManager
            .beginTransaction()
            .beginTransaction()
@@ -1106,7 +1130,7 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen
    public void onSpeedDialSelected() {
    public void onSpeedDialSelected() {
      LogUtil.enterBlock("MainBottomNavBarBottomNavTabListener.onSpeedDialSelected");
      LogUtil.enterBlock("MainBottomNavBarBottomNavTabListener.onSpeedDialSelected");
      if (selectedTab != TabIndex.SPEED_DIAL) {
      if (selectedTab != TabIndex.SPEED_DIAL) {
        Logger.get(context).logImpression(DialerImpression.Type.MAIN_SWITCH_TAB_TO_FAVORITE);
        Logger.get(mainActivity).logScreenView(ScreenEvent.Type.MAIN_SPEED_DIAL, mainActivity);
        selectedTab = TabIndex.SPEED_DIAL;
        selectedTab = TabIndex.SPEED_DIAL;
      }
      }
      hideAllFragments();
      hideAllFragments();
@@ -1126,7 +1150,7 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen
    public void onCallLogSelected() {
    public void onCallLogSelected() {
      LogUtil.enterBlock("MainBottomNavBarBottomNavTabListener.onCallLogSelected");
      LogUtil.enterBlock("MainBottomNavBarBottomNavTabListener.onCallLogSelected");
      if (selectedTab != TabIndex.CALL_LOG) {
      if (selectedTab != TabIndex.CALL_LOG) {
        Logger.get(context).logImpression(DialerImpression.Type.MAIN_SWITCH_TAB_TO_CALL_LOG);
        Logger.get(mainActivity).logScreenView(ScreenEvent.Type.MAIN_CALL_LOG, mainActivity);
        selectedTab = TabIndex.CALL_LOG;
        selectedTab = TabIndex.CALL_LOG;
      }
      }
      hideAllFragments();
      hideAllFragments();
@@ -1146,7 +1170,7 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen
    public void onContactsSelected() {
    public void onContactsSelected() {
      LogUtil.enterBlock("MainBottomNavBarBottomNavTabListener.onContactsSelected");
      LogUtil.enterBlock("MainBottomNavBarBottomNavTabListener.onContactsSelected");
      if (selectedTab != TabIndex.CONTACTS) {
      if (selectedTab != TabIndex.CONTACTS) {
        Logger.get(context).logImpression(DialerImpression.Type.MAIN_SWITCH_TAB_TO_CONTACTS);
        Logger.get(mainActivity).logScreenView(ScreenEvent.Type.MAIN_CONTACTS, mainActivity);
        selectedTab = TabIndex.CONTACTS;
        selectedTab = TabIndex.CONTACTS;
      }
      }
      hideAllFragments();
      hideAllFragments();
@@ -1170,7 +1194,7 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen
    public void onVoicemailSelected() {
    public void onVoicemailSelected() {
      LogUtil.enterBlock("MainBottomNavBarBottomNavTabListener.onVoicemailSelected");
      LogUtil.enterBlock("MainBottomNavBarBottomNavTabListener.onVoicemailSelected");
      if (selectedTab != TabIndex.VOICEMAIL) {
      if (selectedTab != TabIndex.VOICEMAIL) {
        Logger.get(context).logImpression(DialerImpression.Type.MAIN_SWITCH_TAB_TO_VOICEMAIL);
        Logger.get(mainActivity).logScreenView(ScreenEvent.Type.MAIN_VOICEMAIL, mainActivity);
        selectedTab = TabIndex.VOICEMAIL;
        selectedTab = TabIndex.VOICEMAIL;
      }
      }
      hideAllFragments();
      hideAllFragments();
@@ -1228,7 +1252,8 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen
    }
    }


    /** Sets the last tab if the feature is enabled, otherwise defaults to speed dial. */
    /** Sets the last tab if the feature is enabled, otherwise defaults to speed dial. */
    void selectLastTab() {
    @TabIndex
    int getLastTab() {
      @TabIndex int tabIndex = TabIndex.SPEED_DIAL;
      @TabIndex int tabIndex = TabIndex.SPEED_DIAL;
      if (isEnabled) {
      if (isEnabled) {
        tabIndex =
        tabIndex =
@@ -1242,7 +1267,7 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen
        tabIndex = TabIndex.SPEED_DIAL;
        tabIndex = TabIndex.SPEED_DIAL;
      }
      }


      bottomNavBar.selectTab(tabIndex);
      return tabIndex;
    }
    }


    void onActivityStop() {
    void onActivityStop() {
+33 −17
Original line number Original line Diff line number Diff line
@@ -24,6 +24,8 @@ import android.view.View;
import android.widget.LinearLayout;
import android.widget.LinearLayout;
import com.android.dialer.common.Assert;
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.LogUtil;
import com.android.dialer.logging.DialerImpression;
import com.android.dialer.logging.Logger;
import java.lang.annotation.Retention;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.ArrayList;
@@ -74,27 +76,35 @@ public final class BottomNavBar extends LinearLayout {


    speedDial.setOnClickListener(
    speedDial.setOnClickListener(
        v -> {
        v -> {
          selectedTab = TabIndex.SPEED_DIAL;
          if (selectedTab != TabIndex.SPEED_DIAL) {
          setSelected(speedDial);
            Logger.get(getContext())
          updateListeners(selectedTab);
                .logImpression(DialerImpression.Type.MAIN_SWITCH_TAB_TO_FAVORITE);
          }
          selectTab(TabIndex.SPEED_DIAL);
        });
        });
    callLog.setOnClickListener(
    callLog.setOnClickListener(
        v -> {
        v -> {
          selectedTab = TabIndex.CALL_LOG;
          if (selectedTab != TabIndex.CALL_LOG) {
          setSelected(callLog);
            Logger.get(getContext())
          updateListeners(selectedTab);
                .logImpression(DialerImpression.Type.MAIN_SWITCH_TAB_TO_CALL_LOG);
          }
          selectTab(TabIndex.CALL_LOG);
        });
        });
    contacts.setOnClickListener(
    contacts.setOnClickListener(
        v -> {
        v -> {
          selectedTab = TabIndex.CONTACTS;
          if (selectedTab != TabIndex.CONTACTS) {
          setSelected(contacts);
            Logger.get(getContext())
          updateListeners(selectedTab);
                .logImpression(DialerImpression.Type.MAIN_SWITCH_TAB_TO_CONTACTS);
          }
          selectTab(TabIndex.CONTACTS);
        });
        });
    voicemail.setOnClickListener(
    voicemail.setOnClickListener(
        v -> {
        v -> {
          selectedTab = TabIndex.VOICEMAIL;
          if (selectedTab != TabIndex.VOICEMAIL) {
          setSelected(voicemail);
            Logger.get(getContext())
          updateListeners(selectedTab);
                .logImpression(DialerImpression.Type.MAIN_SWITCH_TAB_TO_VOICEMAIL);
          }
          selectTab(TabIndex.VOICEMAIL);
        });
        });
  }
  }


@@ -106,22 +116,28 @@ public final class BottomNavBar extends LinearLayout {
  }
  }


  /**
  /**
   * Calls {@link View#performClick()} on the desired tab.
   * Select tab for uesr and non-user click.
   *
   *
   * @param tab {@link TabIndex}
   * @param tab {@link TabIndex}
   */
   */
  public void selectTab(@TabIndex int tab) {
  public void selectTab(@TabIndex int tab) {
    if (tab == TabIndex.SPEED_DIAL) {
    if (tab == TabIndex.SPEED_DIAL) {
      speedDial.performClick();
      selectedTab = TabIndex.SPEED_DIAL;
      setSelected(speedDial);
    } else if (tab == TabIndex.CALL_LOG) {
    } else if (tab == TabIndex.CALL_LOG) {
      callLog.performClick();
      selectedTab = TabIndex.CALL_LOG;
      setSelected(callLog);
    } else if (tab == TabIndex.CONTACTS) {
    } else if (tab == TabIndex.CONTACTS) {
      contacts.performClick();
      selectedTab = TabIndex.CONTACTS;
      setSelected(contacts);
    } else if (tab == TabIndex.VOICEMAIL) {
    } else if (tab == TabIndex.VOICEMAIL) {
      voicemail.performClick();
      selectedTab = TabIndex.VOICEMAIL;
      setSelected(voicemail);
    } else {
    } else {
      throw new IllegalStateException("Invalid tab: " + tab);
      throw new IllegalStateException("Invalid tab: " + tab);
    }
    }

    updateListeners(selectedTab);
  }
  }


  /**
  /**