summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/voicemailstatus
diff options
context:
space:
mode:
authorEric Erfanian <erfanian@google.com>2017-08-03 11:34:42 -0700
committerEric Erfanian <erfanian@google.com>2017-08-11 19:33:20 +0000
commit9a6afa3ae2bfc0074f7f64a7ec3238c26e913c3c (patch)
tree7f98300ff2318f2eefb50d84ca2701a416590fb4 /java/com/android/dialer/voicemailstatus
parentff2ad7ffdba7c74077eae3016b32174f0f2dad30 (diff)
Update oc-dr1-dev to v11.1 RC06
This moves the branch forward from v11 RC17. This release contains fixes for the following bugs: Bug: 63584851 63803282 63917358 64099380 64101648 64105912 64119808 64122858 64125770 64300111 Test: TH, on device Merged-In: I858e3665253139b8aab4e4c063bfc4c419f33cc9 Merged-In: Ifc146f2fec24fd2f8a51cd32feb3699bb1c07136 Change-Id: I48296c56fb1d275a06b7c314f5380266c1195ef2
Diffstat (limited to 'java/com/android/dialer/voicemailstatus')
-rw-r--r--java/com/android/dialer/voicemailstatus/VisualVoicemailEnabledChecker.java4
-rw-r--r--java/com/android/dialer/voicemailstatus/VoicemailStatusHelper.java20
2 files changed, 13 insertions, 11 deletions
diff --git a/java/com/android/dialer/voicemailstatus/VisualVoicemailEnabledChecker.java b/java/com/android/dialer/voicemailstatus/VisualVoicemailEnabledChecker.java
index a1fc29edf..3f519ad82 100644
--- a/java/com/android/dialer/voicemailstatus/VisualVoicemailEnabledChecker.java
+++ b/java/com/android/dialer/voicemailstatus/VisualVoicemailEnabledChecker.java
@@ -45,7 +45,6 @@ public class VisualVoicemailEnabledChecker implements CallLogQueryHandler.Listen
private SharedPreferences mPrefs;
private boolean mHasActiveVoicemailProvider;
private CallLogQueryHandler mCallLogQueryHandler;
- private VoicemailStatusHelper mVoicemailStatusHelper;
private Context mContext;
private Callback mCallback;
@@ -53,7 +52,6 @@ public class VisualVoicemailEnabledChecker implements CallLogQueryHandler.Listen
mContext = context;
mCallback = callback;
mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
- mVoicemailStatusHelper = new VoicemailStatusHelper();
mHasActiveVoicemailProvider = mPrefs.getBoolean(PREF_KEY_HAS_ACTIVE_VOICEMAIL_PROVIDER, false);
}
@@ -77,7 +75,7 @@ public class VisualVoicemailEnabledChecker implements CallLogQueryHandler.Listen
@Override
public void onVoicemailStatusFetched(Cursor statusCursor) {
boolean hasActiveVoicemailProvider =
- mVoicemailStatusHelper.getNumberActivityVoicemailSources(statusCursor) > 0;
+ VoicemailStatusHelper.getNumberActivityVoicemailSources(statusCursor) > 0;
if (hasActiveVoicemailProvider != mHasActiveVoicemailProvider) {
mHasActiveVoicemailProvider = hasActiveVoicemailProvider;
mPrefs
diff --git a/java/com/android/dialer/voicemailstatus/VoicemailStatusHelper.java b/java/com/android/dialer/voicemailstatus/VoicemailStatusHelper.java
index 9df45c211..313fc1be1 100644
--- a/java/com/android/dialer/voicemailstatus/VoicemailStatusHelper.java
+++ b/java/com/android/dialer/voicemailstatus/VoicemailStatusHelper.java
@@ -21,15 +21,17 @@ import android.provider.VoicemailContract.Status;
import com.android.dialer.database.VoicemailStatusQuery;
/**
- * Interface used by the call log UI to determine what user message, if any, related to voicemail
+ * Utility used by the call log UI to determine what user message, if any, related to voicemail
* source status needs to be shown. The messages are returned in the order of importance.
*
- * <p>The implementation of this interface interacts with the voicemail content provider to fetch
- * statuses of all the registered voicemail sources and determines if any status message needs to be
- * shown. The user of this interface must observe/listen to provider changes and invoke this class
- * to check if any message needs to be shown.
+ * <p>This class interacts with the voicemail content provider to fetch statuses of all the
+ * registered voicemail sources and determines if any status message needs to be shown. The user of
+ * this class must observe/listen to provider changes and invoke this class to check if any message
+ * needs to be shown.
*/
-public class VoicemailStatusHelper {
+public final class VoicemailStatusHelper {
+
+ private VoicemailStatusHelper() {}
/**
* Returns the number of active voicemail sources installed.
@@ -39,7 +41,7 @@ public class VoicemailStatusHelper {
* @param cursor The caller is responsible for the life cycle of the cursor and resetting the
* position
*/
- public int getNumberActivityVoicemailSources(Cursor cursor) {
+ public static int getNumberActivityVoicemailSources(Cursor cursor) {
int count = 0;
if (!cursor.moveToFirst()) {
return 0;
@@ -60,8 +62,10 @@ public class VoicemailStatusHelper {
* activation is attempted, it will transition into CONFIGURING then into OK or other error state,
* NOT_CONFIGURED is never set through an error.
*/
- private boolean isVoicemailSourceActive(Cursor cursor) {
+ private static boolean isVoicemailSourceActive(Cursor cursor) {
return cursor.getString(VoicemailStatusQuery.SOURCE_PACKAGE_INDEX) != null
+ // getInt() returns 0 when null
+ && !cursor.isNull(VoicemailStatusQuery.CONFIGURATION_STATE_INDEX)
&& cursor.getInt(VoicemailStatusQuery.CONFIGURATION_STATE_INDEX)
!= Status.CONFIGURATION_STATE_NOT_CONFIGURED;
}