diff options
author | Eric Erfanian <erfanian@google.com> | 2017-04-06 23:16:42 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-04-06 23:16:42 +0000 |
commit | 28188020060d1ad3304dfa0367486ff5bb35da62 (patch) | |
tree | 8d08d4f2292aa84dc435d455891e7ab633d95a25 /java/com/android/voicemail/impl/VoicemailClientImpl.java | |
parent | 34e183cfd77f68e0ade42d2080c76f54a319430d (diff) | |
parent | 01a86435499d66b267765f89b7dd9c83c158ddfe (diff) |
Update AOSP Dialer source from internal google3 repository at cl/152373142. am: d8046e520a
am: 01a8643549
Change-Id: Ib92542e6b88bc8d8906982280244661ed7dbca8f
Diffstat (limited to 'java/com/android/voicemail/impl/VoicemailClientImpl.java')
-rw-r--r-- | java/com/android/voicemail/impl/VoicemailClientImpl.java | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/java/com/android/voicemail/impl/VoicemailClientImpl.java b/java/com/android/voicemail/impl/VoicemailClientImpl.java index b1c301a0a..31a12791c 100644 --- a/java/com/android/voicemail/impl/VoicemailClientImpl.java +++ b/java/com/android/voicemail/impl/VoicemailClientImpl.java @@ -15,6 +15,7 @@ package com.android.voicemail.impl; import android.annotation.TargetApi; import android.content.Context; +import android.content.Intent; import android.os.Build.VERSION_CODES; import android.provider.VoicemailContract.Status; import android.provider.VoicemailContract.Voicemails; @@ -23,9 +24,12 @@ import android.support.v4.os.BuildCompat; import android.telecom.PhoneAccountHandle; import android.telephony.TelephonyManager; import com.android.dialer.common.Assert; +import com.android.dialer.common.ConfigProviderBindings; +import com.android.dialer.common.LogUtil; import com.android.voicemail.VisualVoicemailTypeExtensions; import com.android.voicemail.VoicemailClient; import com.android.voicemail.impl.settings.VisualVoicemailSettingsUtil; +import com.android.voicemail.impl.settings.VoicemailChangePinActivity; import com.android.voicemail.impl.settings.VoicemailSettingsFragment; import java.util.List; import javax.inject.Inject; @@ -44,6 +48,9 @@ public class VoicemailClientImpl implements VoicemailClient { */ private static final String[] OMTP_VOICEMAIL_BLACKLIST = {"com.android.phone"}; + // Flag name used for configuration + private static final String ALLOW_VOICEMAIL_ARCHIVE = "allow_voicemail_archive"; + private static final String[] OMTP_VOICEMAIL_TYPE = { TelephonyManager.VVM_TYPE_OMTP, TelephonyManager.VVM_TYPE_CVVM, @@ -72,11 +79,36 @@ public class VoicemailClientImpl implements VoicemailClient { } @Override + public boolean isVoicemailArchiveAvailable(Context context) { + if (!BuildCompat.isAtLeastO()) { + LogUtil.i("VoicemailClientImpl.isVoicemailArchiveAllowed", "not running on O or later"); + return false; + } + + if (!ConfigProviderBindings.get(context).getBoolean(ALLOW_VOICEMAIL_ARCHIVE, true)) { + LogUtil.i( + "VoicemailClientImpl.isVoicemailArchiveAllowed", + "feature disabled by config: %s", + ALLOW_VOICEMAIL_ARCHIVE); + return false; + } + + return true; + } + + @Override public void setVoicemailArchiveEnabled( Context context, PhoneAccountHandle phoneAccountHandle, boolean value) { VisualVoicemailSettingsUtil.setArchiveEnabled(context, phoneAccountHandle, value); } + @Override + public Intent getSetPinIntent(Context context, PhoneAccountHandle phoneAccountHandle) { + Intent intent = new Intent(context, VoicemailChangePinActivity.class); + intent.putExtra(VoicemailChangePinActivity.EXTRA_PHONE_ACCOUNT_HANDLE, phoneAccountHandle); + return intent; + } + @TargetApi(VERSION_CODES.O) @Override public void appendOmtpVoicemailSelectionClause( @@ -134,7 +166,7 @@ public class VoicemailClientImpl implements VoicemailClient { } where.append(" ("); { - where.append(Status.SOURCE_TYPE).append(" == ?"); + where.append(Status.SOURCE_TYPE).append(" IS ?"); selectionArgs.add(OMTP_VOICEMAIL_TYPE[i]); where.append(")"); } |