From 6adbdbe32d0aa6b0d71c2034dda427452c7b0b8b Mon Sep 17 00:00:00 2001 From: twyen Date: Tue, 1 Aug 2017 11:24:45 -0700 Subject: Handle null in voicemail config status The VVM tab is shown when there are more then one "active" voicemail sources in the voicemail status table. A configuration status of 0 is active, and 1 is inactive. If the configuration state is null, getInt() will return 0 which maps to active, and incorrectly showing the VVM tab. In this CL, null is checked first. The helper class is also made static. Bug: 64122858 Test: VoicemailStatusHelperTest PiperOrigin-RevId: 163858350 Change-Id: I3fca52aaca92492f1969092e2d9f443677cb3b8d --- java/com/android/dialer/app/list/ListsFragment.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'java/com/android/dialer/app') diff --git a/java/com/android/dialer/app/list/ListsFragment.java b/java/com/android/dialer/app/list/ListsFragment.java index 3f03db1e8..dbb6c8b5c 100644 --- a/java/com/android/dialer/app/list/ListsFragment.java +++ b/java/com/android/dialer/app/list/ListsFragment.java @@ -75,7 +75,6 @@ public class ListsFragment extends Fragment implements OnPageChangeListener, Lis private SharedPreferences mPrefs; private boolean mHasFetchedVoicemailStatus; private boolean mShowVoicemailTabAfterVoicemailStatusIsFetched; - private VoicemailStatusHelper mVoicemailStatusHelper; private final ArrayList mOnPageChangeListeners = new ArrayList<>(); /** The position of the currently selected tab. */ private int mTabIndex = TAB_INDEX_SPEED_DIAL; @@ -99,7 +98,6 @@ public class ListsFragment extends Fragment implements OnPageChangeListener, Lis LogUtil.d("ListsFragment.onCreate", null); Trace.beginSection(TAG + " onCreate"); super.onCreate(savedInstanceState); - mVoicemailStatusHelper = new VoicemailStatusHelper(); mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); Trace.endSection(); } @@ -294,7 +292,7 @@ public class ListsFragment extends Fragment implements OnPageChangeListener, Lis // Update hasActiveVoicemailProvider, which controls the number of tabs displayed. boolean hasActiveVoicemailProvider = - mVoicemailStatusHelper.getNumberActivityVoicemailSources(statusCursor) > 0; + VoicemailStatusHelper.getNumberActivityVoicemailSources(statusCursor) > 0; if (hasActiveVoicemailProvider != mAdapter.hasActiveVoicemailProvider()) { mAdapter.setHasActiveVoicemailProvider(hasActiveVoicemailProvider); mAdapter.notifyDataSetChanged(); -- cgit v1.2.3