summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/app/voicemail
diff options
context:
space:
mode:
authorEric Erfanian <erfanian@google.com>2017-04-06 09:41:50 -0700
committerEric Erfanian <erfanian@google.com>2017-04-06 09:41:50 -0700
commitd8046e520a866b9948ee9ba47cf642b441ca8e23 (patch)
tree8d08d4f2292aa84dc435d455891e7ab633d95a25 /java/com/android/dialer/app/voicemail
parentcdb1edf966a892abebcba425a85b7d4e47758302 (diff)
Update AOSP Dialer source from internal google3 repository at
cl/152373142. Test: make, treehugger This CL updates the AOSP Dialer source with all the changes that have gone into the private google3 repository. This includes all the changes from cl/151342913 (3/27/2017) to cl/152373142 (4/06/2017). This goal of these drops is to keep the AOSP source in sync with the internal google3 repository. Currently these sync are done by hand with very minor modifications to the internal source code. See the Android.mk file for list of modifications. Our current goal is to do frequent drops (daily if possible) and eventually switched to an automated process. Change-Id: I2fbc88cf6867b90ac8b65f75e5e34468988c7217
Diffstat (limited to 'java/com/android/dialer/app/voicemail')
-rw-r--r--java/com/android/dialer/app/voicemail/VoicemailPlaybackLayout.java4
-rw-r--r--java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java172
-rw-r--r--java/com/android/dialer/app/voicemail/error/OmtpVoicemailMessageCreator.java184
-rw-r--r--java/com/android/dialer/app/voicemail/error/VoicemailErrorMessage.java38
-rw-r--r--java/com/android/dialer/app/voicemail/error/Vvm3VoicemailMessageCreator.java2
-rw-r--r--java/com/android/dialer/app/voicemail/error/res/values-de/strings.xml12
6 files changed, 227 insertions, 185 deletions
diff --git a/java/com/android/dialer/app/voicemail/VoicemailPlaybackLayout.java b/java/com/android/dialer/app/voicemail/VoicemailPlaybackLayout.java
index f40ed2794..04fe7f66a 100644
--- a/java/com/android/dialer/app/voicemail/VoicemailPlaybackLayout.java
+++ b/java/com/android/dialer/app/voicemail/VoicemailPlaybackLayout.java
@@ -276,12 +276,12 @@ public class VoicemailPlaybackLayout extends LinearLayout
@Override
public void onSpeakerphoneOn(boolean on) {
if (on) {
- mPlaybackSpeakerphone.setImageResource(R.drawable.ic_volume_up_24dp);
+ mPlaybackSpeakerphone.setImageResource(R.drawable.quantum_ic_volume_up_white_24);
// Speaker is now on, tapping button will turn it off.
mPlaybackSpeakerphone.setContentDescription(
mContext.getString(R.string.voicemail_speaker_off));
} else {
- mPlaybackSpeakerphone.setImageResource(R.drawable.ic_volume_down_24dp);
+ mPlaybackSpeakerphone.setImageResource(R.drawable.quantum_ic_volume_down_white_24);
// Speaker is now off, tapping button will turn it on.
mPlaybackSpeakerphone.setContentDescription(
mContext.getString(R.string.voicemail_speaker_on));
diff --git a/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java b/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java
index 492f2088b..5bfa03e90 100644
--- a/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java
+++ b/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java
@@ -39,6 +39,7 @@ import android.support.annotation.Nullable;
import android.support.annotation.VisibleForTesting;
import android.support.v4.content.FileProvider;
import android.text.TextUtils;
+import android.util.Pair;
import android.view.View;
import android.view.WindowManager.LayoutParams;
import android.webkit.MimeTypeMap;
@@ -50,6 +51,8 @@ import com.android.dialer.common.ConfigProviderBindings;
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.concurrent.AsyncTaskExecutor;
import com.android.dialer.common.concurrent.AsyncTaskExecutors;
+import com.android.dialer.common.concurrent.DialerExecutor;
+import com.android.dialer.common.concurrent.DialerExecutors;
import com.android.dialer.constants.Constants;
import com.android.dialer.logging.Logger;
import com.android.dialer.logging.nano.DialerImpression;
@@ -146,6 +149,8 @@ public class VoicemailPlaybackPresenter
private OnVoicemailDeletedListener mOnVoicemailDeletedListener;
private View shareVoicemailButtonView;
+ private DialerExecutor<Pair<Context, Uri>> shareVoicemailExecutor;
+
/** Initialize variables which are activity-independent and state-independent. */
protected VoicemailPlaybackPresenter(Activity activity) {
Context context = activity.getApplicationContext();
@@ -213,6 +218,23 @@ public class VoicemailPlaybackPresenter
} else {
mActivity.getWindow().clearFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
}
+ shareVoicemailExecutor =
+ DialerExecutors.createUiTaskBuilder(
+ mActivity.getFragmentManager(), "test", new ShareVoicemailWorker())
+ .onSuccess(
+ output -> {
+ if (output == null) {
+ LogUtil.e("VoicemailAsyncTaskUtil.shareVoicemail", "failed to get voicemail");
+ return;
+ }
+ mContext.startActivity(
+ Intent.createChooser(
+ getShareIntent(mContext, output.first, output.second),
+ mContext
+ .getResources()
+ .getText(R.string.call_log_action_share_voicemail)));
+ })
+ .build();
}
}
@@ -838,78 +860,65 @@ public class VoicemailPlaybackPresenter
return ConfigProviderBindings.get(context).getBoolean(CONFIG_SHARE_VOICEMAIL_ALLOWED, true);
}
+ private static class ShareVoicemailWorker
+ implements DialerExecutor.Worker<Pair<Context, Uri>, Pair<Uri, String>> {
+
+ @Nullable
+ @Override
+ public Pair<Uri, String> doInBackground(Pair<Context, Uri> input) {
+ Context context = input.first;
+ Uri voicemailUri = input.second;
+ ContentResolver contentResolver = context.getContentResolver();
+ try (Cursor callLogInfo = getCallLogInfoCursor(contentResolver, voicemailUri);
+ Cursor contentInfo = getContentInfoCursor(contentResolver, voicemailUri)) {
+
+ if (hasContent(callLogInfo) && hasContent(contentInfo)) {
+ String cachedName = callLogInfo.getString(CallLogQuery.CACHED_NAME);
+ String number = contentInfo.getString(contentInfo.getColumnIndex(Voicemails.NUMBER));
+ long date = contentInfo.getLong(contentInfo.getColumnIndex(Voicemails.DATE));
+ String mimeType = contentInfo.getString(contentInfo.getColumnIndex(Voicemails.MIME_TYPE));
+ String transcription =
+ contentInfo.getString(contentInfo.getColumnIndex(Voicemails.TRANSCRIPTION));
+
+ // Copy voicemail content to a new file.
+ // Please see reference in third_party/java_src/android_app/dialer/java/com/android/
+ // dialer/app/res/xml/file_paths.xml for correct cache directory name.
+ File parentDir = new File(context.getCacheDir(), "my_cache");
+ if (!parentDir.exists()) {
+ parentDir.mkdirs();
+ }
+ File temporaryVoicemailFile =
+ new File(parentDir, getFileName(cachedName, number, mimeType, date));
+
+ try (InputStream inputStream = contentResolver.openInputStream(voicemailUri);
+ OutputStream outputStream =
+ contentResolver.openOutputStream(Uri.fromFile(temporaryVoicemailFile))) {
+ if (inputStream != null && outputStream != null) {
+ ByteStreams.copy(inputStream, outputStream);
+ return new Pair<>(
+ FileProvider.getUriForFile(
+ context, Constants.get().getFileProviderAuthority(), temporaryVoicemailFile),
+ transcription);
+ }
+ } catch (IOException e) {
+ LogUtil.e(
+ "VoicemailAsyncTaskUtil.shareVoicemail",
+ "failed to copy voicemail content to new file: ",
+ e);
+ }
+ return null;
+ }
+ }
+ return null;
+ }
+ }
+
/**
* Share voicemail to be opened by user selected apps. This method will collect information, copy
* voicemail to a temporary file in background and launch a chooser intent to share it.
*/
- @TargetApi(VERSION_CODES.M)
public void shareVoicemail() {
- mAsyncTaskExecutor.submit(
- Tasks.SHARE_VOICEMAIL,
- new AsyncTask<Void, Void, Uri>() {
- @Nullable
- @Override
- protected Uri doInBackground(Void... params) {
- ContentResolver contentResolver = mContext.getContentResolver();
- try (Cursor callLogInfo = getCallLogInfoCursor(contentResolver, mVoicemailUri);
- Cursor contentInfo = getContentInfoCursor(contentResolver, mVoicemailUri)) {
-
- if (hasContent(callLogInfo) && hasContent(contentInfo)) {
- String cachedName = callLogInfo.getString(CallLogQuery.CACHED_NAME);
- String number =
- contentInfo.getString(
- contentInfo.getColumnIndex(VoicemailContract.Voicemails.NUMBER));
- long date =
- contentInfo.getLong(
- contentInfo.getColumnIndex(VoicemailContract.Voicemails.DATE));
- String mimeType =
- contentInfo.getString(
- contentInfo.getColumnIndex(VoicemailContract.Voicemails.MIME_TYPE));
-
- // Copy voicemail content to a new file.
- // Please see reference in third_party/java_src/android_app/dialer/java/com/android/
- // dialer/app/res/xml/file_paths.xml for correct cache directory name.
- File parentDir = new File(mContext.getCacheDir(), "my_cache");
- if (!parentDir.exists()) {
- parentDir.mkdirs();
- }
- File temporaryVoicemailFile =
- new File(parentDir, getFileName(cachedName, number, mimeType, date));
-
- try (InputStream inputStream = contentResolver.openInputStream(mVoicemailUri);
- OutputStream outputStream =
- contentResolver.openOutputStream(Uri.fromFile(temporaryVoicemailFile))) {
- if (inputStream != null && outputStream != null) {
- ByteStreams.copy(inputStream, outputStream);
- return FileProvider.getUriForFile(
- mContext,
- Constants.get().getFileProviderAuthority(),
- temporaryVoicemailFile);
- }
- } catch (IOException e) {
- LogUtil.e(
- "VoicemailAsyncTaskUtil.shareVoicemail",
- "failed to copy voicemail content to new file: ",
- e);
- }
- return null;
- }
- }
- return null;
- }
-
- @Override
- protected void onPostExecute(Uri uri) {
- if (uri == null) {
- LogUtil.e("VoicemailAsyncTaskUtil.shareVoicemail", "failed to get voicemail");
- } else {
- mContext.startActivity(
- Intent.createChooser(
- getShareIntent(mContext, uri),
- mContext.getResources().getText(R.string.call_log_action_share_voicemail)));
- }
- }
- });
+ shareVoicemailExecutor.executeParallel(new Pair<>(mContext, mVoicemailUri));
}
private static String getFileName(String cachedName, String number, String mimeType, long date) {
@@ -925,12 +934,22 @@ public class VoicemailPlaybackPresenter
+ (TextUtils.isEmpty(fileExtension) ? "" : "." + fileExtension);
}
- private static Intent getShareIntent(Context context, Uri voicemailFileUri) {
+ private static Intent getShareIntent(
+ Context context, Uri voicemailFileUri, String transcription) {
Intent shareIntent = new Intent();
- shareIntent.setAction(Intent.ACTION_SEND);
- shareIntent.putExtra(Intent.EXTRA_STREAM, voicemailFileUri);
- shareIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
- shareIntent.setType(context.getContentResolver().getType(voicemailFileUri));
+ if (TextUtils.isEmpty(transcription)) {
+ shareIntent.setAction(Intent.ACTION_SEND);
+ shareIntent.putExtra(Intent.EXTRA_STREAM, voicemailFileUri);
+ shareIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
+ shareIntent.setType(context.getContentResolver().getType(voicemailFileUri));
+ } else {
+ shareIntent.setAction(Intent.ACTION_SEND);
+ shareIntent.putExtra(Intent.EXTRA_STREAM, voicemailFileUri);
+ shareIntent.putExtra(Intent.EXTRA_TEXT, transcription);
+ shareIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
+ shareIntent.setType("*/*");
+ }
+
return shareIntent;
}
@@ -954,10 +973,11 @@ public class VoicemailPlaybackPresenter
return contentResolver.query(
voicemailUri,
new String[] {
- VoicemailContract.Voicemails._ID,
- VoicemailContract.Voicemails.NUMBER,
- VoicemailContract.Voicemails.DATE,
- VoicemailContract.Voicemails.MIME_TYPE,
+ Voicemails._ID,
+ Voicemails.NUMBER,
+ Voicemails.DATE,
+ Voicemails.MIME_TYPE,
+ Voicemails.TRANSCRIPTION,
},
null,
null,
diff --git a/java/com/android/dialer/app/voicemail/error/OmtpVoicemailMessageCreator.java b/java/com/android/dialer/app/voicemail/error/OmtpVoicemailMessageCreator.java
index b56d568b7..2b19bd7bb 100644
--- a/java/com/android/dialer/app/voicemail/error/OmtpVoicemailMessageCreator.java
+++ b/java/com/android/dialer/app/voicemail/error/OmtpVoicemailMessageCreator.java
@@ -22,7 +22,6 @@ import android.provider.VoicemailContract.Status;
import android.support.annotation.Nullable;
import android.telecom.PhoneAccountHandle;
import com.android.dialer.app.voicemail.error.VoicemailErrorMessage.Action;
-import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.PerAccountSharedPreferences;
import com.android.dialer.logging.Logger;
@@ -136,92 +135,122 @@ public class OmtpVoicemailMessageCreator {
Context context, VoicemailStatus status, VoicemailStatusReader statusReader) {
if (status.quotaOccupied != Status.QUOTA_UNAVAILABLE
&& status.quotaTotal != Status.QUOTA_UNAVAILABLE) {
+ return createInboxErrorMessage(context, status, statusReader);
+ }
+ Logger.get(context).logImpression(DialerImpression.Type.VVM_QUOTA_CHECK_UNAVAILABLE);
+ return null;
+ }
- PhoneAccountHandle phoneAccountHandle = status.getPhoneAccountHandle();
+ @Nullable
+ private static VoicemailErrorMessage createInboxErrorMessage(
+ Context context, VoicemailStatus status, VoicemailStatusReader statusReader) {
- VoicemailClient voicemailClient = VoicemailComponent.get(context).getVoicemailClient();
+ float voicemailOccupiedFraction = (float) status.quotaOccupied / (float) status.quotaTotal;
- PerAccountSharedPreferences sharedPreferenceForAccount =
- new PerAccountSharedPreferences(
- context, phoneAccountHandle, PreferenceManager.getDefaultSharedPreferences(context));
+ if (voicemailOccupiedFraction < QUOTA_NEAR_FULL_THRESHOLD) {
+ return null;
+ }
- boolean isVoicemailArchiveEnabled =
- VoicemailComponent.get(context)
- .getVoicemailClient()
- .isVoicemailArchiveEnabled(context, phoneAccountHandle);
+ boolean isFull = voicemailOccupiedFraction >= QUOTA_FULL_THRESHOLD;
- if ((float) status.quotaOccupied / (float) status.quotaTotal >= QUOTA_FULL_THRESHOLD) {
- return createInboxErrorMessage(
- context,
- status,
- status.getPhoneAccountHandle(),
- statusReader,
- sharedPreferenceForAccount,
- voicemailClient,
- isVoicemailArchiveEnabled,
- context.getString(R.string.voicemail_error_inbox_full_turn_archive_on_title),
- context.getText(R.string.voicemail_error_inbox_full_turn_archive_on_message),
- context.getString(R.string.voicemail_error_inbox_full_title),
- context.getString(R.string.voicemail_error_inbox_full_message),
- VOICEMAIL_PROMO_DISMISSED_KEY);
- }
+ PhoneAccountHandle phoneAccountHandle = status.getPhoneAccountHandle();
- if ((float) status.quotaOccupied / (float) status.quotaTotal >= QUOTA_NEAR_FULL_THRESHOLD) {
- return createInboxErrorMessage(
- context,
- status,
- status.getPhoneAccountHandle(),
- statusReader,
- sharedPreferenceForAccount,
- voicemailClient,
- isVoicemailArchiveEnabled,
- context.getString(R.string.voicemail_error_inbox_almost_full_turn_archive_on_title),
- context.getText(R.string.voicemail_error_inbox_almost_full_turn_archive_on_message),
+ PerAccountSharedPreferences sharedPreferenceForAccount =
+ new PerAccountSharedPreferences(
+ context, phoneAccountHandle, PreferenceManager.getDefaultSharedPreferences(context));
+
+ VoicemailClient voicemailClient = VoicemailComponent.get(context).getVoicemailClient();
+
+ boolean shouldShowPromoForArchive =
+ !isPromoForArchiveDismissed(sharedPreferenceForAccount, isFull)
+ && !voicemailClient.isVoicemailArchiveEnabled(context, phoneAccountHandle)
+ && voicemailClient.isVoicemailArchiveAvailable(context);
+
+ if (!shouldShowPromoForArchive) {
+ if (isFull) {
+ Logger.get(context)
+ .logImpression(DialerImpression.Type.VVM_USER_SHOWN_VM_FULL_ERROR_MESSAGE);
+ return new VoicemailErrorMessage(
+ context.getString(R.string.voicemail_error_inbox_full_title),
+ context.getString(R.string.voicemail_error_inbox_full_message));
+ } else {
+ Logger.get(context)
+ .logImpression(DialerImpression.Type.VVM_USER_SHOWN_VM_ALMOST_FULL_ERROR_MESSAGE);
+ return new VoicemailErrorMessage(
context.getString(R.string.voicemail_error_inbox_near_full_title),
- context.getString(R.string.voicemail_error_inbox_near_full_message),
- VOICEMAIL_PROMO_ALMOST_FULL_DISMISSED_KEY);
+ context.getString(R.string.voicemail_error_inbox_near_full_message));
}
}
- return null;
+
+ String title;
+ CharSequence message;
+ int enabledImpression;
+ int dismissedImpression;
+ String dismissedKey;
+
+ if (isFull) {
+ Logger.get(context).logImpression(DialerImpression.Type.VVM_USER_SHOWN_VM_FULL_PROMO);
+ title = context.getString(R.string.voicemail_error_inbox_full_turn_archive_on_title);
+ message = context.getText(R.string.voicemail_error_inbox_full_turn_archive_on_message);
+ enabledImpression = DialerImpression.Type.VVM_USER_ENABLED_ARCHIVE_FROM_VM_FULL_PROMO;
+ dismissedImpression = DialerImpression.Type.VVM_USER_DISMISSED_VM_FULL_PROMO;
+ dismissedKey = VOICEMAIL_PROMO_DISMISSED_KEY;
+ } else {
+ Logger.get(context).logImpression(DialerImpression.Type.VVM_USER_SHOWN_VM_ALMOST_FULL_PROMO);
+ title = context.getString(R.string.voicemail_error_inbox_almost_full_turn_archive_on_title);
+ message = context.getText(R.string.voicemail_error_inbox_almost_full_turn_archive_on_message);
+ enabledImpression = DialerImpression.Type.VVM_USER_ENABLED_ARCHIVE_FROM_VM_ALMOST_FULL_PROMO;
+ dismissedImpression = DialerImpression.Type.VVM_USER_DISMISSED_VM_ALMOST_FULL_PROMO;
+ dismissedKey = VOICEMAIL_PROMO_ALMOST_FULL_DISMISSED_KEY;
+ }
+
+ return createVMQuotaPromo(
+ context,
+ phoneAccountHandle,
+ status,
+ statusReader,
+ voicemailClient,
+ sharedPreferenceForAccount,
+ title,
+ message,
+ enabledImpression,
+ dismissedImpression,
+ dismissedKey);
}
- private static VoicemailErrorMessage createInboxErrorMessage(
+ private static boolean isPromoForArchiveDismissed(
+ PerAccountSharedPreferences sharedPreferenceForAccount, boolean isFull) {
+ if (isFull) {
+ return sharedPreferenceForAccount.getBoolean(VOICEMAIL_PROMO_DISMISSED_KEY, false);
+ } else {
+ return sharedPreferenceForAccount.getBoolean(
+ VOICEMAIL_PROMO_ALMOST_FULL_DISMISSED_KEY, false);
+ }
+ }
+
+ private static VoicemailErrorMessage createVMQuotaPromo(
Context context,
- VoicemailStatus status,
PhoneAccountHandle phoneAccountHandle,
+ VoicemailStatus status,
VoicemailStatusReader statusReader,
- PerAccountSharedPreferences sharedPreferenceForAccount,
VoicemailClient voicemailClient,
- boolean isVoicemailArchiveEnabled,
- String promoTitle,
- CharSequence promoMessage,
- String nonPromoTitle,
- String nonPromoMessage,
- String preferenceKey) {
-
- boolean wasPromoDismissed = sharedPreferenceForAccount.getBoolean(preferenceKey, false);
-
- if (!wasPromoDismissed && !isVoicemailArchiveEnabled) {
- logArchiveImpression(
- context,
- preferenceKey,
- DialerImpression.Type.VVM_USER_SHOWN_VM_ALMOST_FULL_PROMO,
- DialerImpression.Type.VVM_USER_SHOWN_VM_FULL_PROMO);
- return new VoicemailErrorMessage(
- promoTitle,
- promoMessage,
- VoicemailErrorMessage.createDismissTurnArchiveOnAction(
- context, statusReader, sharedPreferenceForAccount, preferenceKey),
- VoicemailErrorMessage.createTurnArchiveOnAction(
- context, status, voicemailClient, phoneAccountHandle, preferenceKey));
- } else {
- logArchiveImpression(
- context,
- preferenceKey,
- DialerImpression.Type.VVM_USER_SHOWN_VM_ALMOST_FULL_ERROR_MESSAGE,
- DialerImpression.Type.VVM_USER_SHOWN_VM_FULL_ERROR_MESSAGE);
- return new VoicemailErrorMessage(nonPromoTitle, nonPromoMessage);
- }
+ PerAccountSharedPreferences sharedPreferenceForAccount,
+ String title,
+ CharSequence message,
+ int impressionToLogOnEnable,
+ int impressionToLogOnDismiss,
+ String preferenceKeyToUpdate) {
+ return new VoicemailErrorMessage(
+ title,
+ message,
+ VoicemailErrorMessage.createDismissTurnArchiveOnAction(
+ context,
+ impressionToLogOnDismiss,
+ statusReader,
+ sharedPreferenceForAccount,
+ preferenceKeyToUpdate),
+ VoicemailErrorMessage.createTurnArchiveOnAction(
+ context, impressionToLogOnEnable, status, voicemailClient, phoneAccountHandle));
}
@Nullable
@@ -260,15 +289,4 @@ public class OmtpVoicemailMessageCreator {
}
return new VoicemailErrorMessage(title, description, actions);
}
-
- protected static void logArchiveImpression(
- Context context, String preference, int vmAlmostFullImpression, int vmFullImpression) {
- if (preference.equals(VOICEMAIL_PROMO_DISMISSED_KEY)) {
- Logger.get(context).logImpression(vmAlmostFullImpression);
- } else if (preference.equals(VOICEMAIL_PROMO_ALMOST_FULL_DISMISSED_KEY)) {
- Logger.get(context).logImpression(vmFullImpression);
- } else {
- throw Assert.createAssertionFailException("Invalid preference key " + preference);
- }
- }
}
diff --git a/java/com/android/dialer/app/voicemail/error/VoicemailErrorMessage.java b/java/com/android/dialer/app/voicemail/error/VoicemailErrorMessage.java
index 4addcb996..1ef80288b 100644
--- a/java/com/android/dialer/app/voicemail/error/VoicemailErrorMessage.java
+++ b/java/com/android/dialer/app/voicemail/error/VoicemailErrorMessage.java
@@ -23,14 +23,15 @@ import android.provider.VoicemailContract;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.telecom.PhoneAccountHandle;
-import android.telephony.TelephonyManager;
import android.view.View;
import android.view.View.OnClickListener;
+import com.android.dialer.common.Assert;
import com.android.dialer.common.PerAccountSharedPreferences;
import com.android.dialer.logging.Logger;
import com.android.dialer.logging.nano.DialerImpression;
import com.android.dialer.util.CallUtil;
import com.android.voicemail.VoicemailClient;
+import com.android.voicemail.VoicemailComponent;
import java.util.Arrays;
import java.util.List;
@@ -126,7 +127,8 @@ public class VoicemailErrorMessage {
}
@NonNull
- public static Action createSetPinAction(final Context context) {
+ public static Action createSetPinAction(
+ final Context context, PhoneAccountHandle phoneAccountHandle) {
return new Action(
context.getString(R.string.voicemail_action_set_pin),
new OnClickListener() {
@@ -134,8 +136,10 @@ public class VoicemailErrorMessage {
public void onClick(View v) {
Logger.get(context)
.logImpression(DialerImpression.Type.VOICEMAIL_ALERT_SET_PIN_CLICKED);
- Intent intent = new Intent(TelephonyManager.ACTION_CONFIGURE_VOICEMAIL);
- context.startActivity(intent);
+ context.startActivity(
+ VoicemailComponent.get(context)
+ .getVoicemailClient()
+ .getSetPinIntent(context, phoneAccountHandle));
}
});
}
@@ -187,21 +191,20 @@ public class VoicemailErrorMessage {
@NonNull
public static Action createTurnArchiveOnAction(
final Context context,
+ int impressionToLog,
final VoicemailStatus status,
VoicemailClient voicemailClient,
- PhoneAccountHandle phoneAccountHandle,
- String preference) {
+ PhoneAccountHandle phoneAccountHandle) {
return new Action(
context.getString(R.string.voicemail_action_turn_archive_on),
new OnClickListener() {
@Override
public void onClick(View v) {
- OmtpVoicemailMessageCreator.logArchiveImpression(
- context,
- preference,
- DialerImpression.Type.VVM_USER_ENABLED_ARCHIVE_FROM_VM_FULL_PROMO,
- DialerImpression.Type.VVM_USER_ENABLED_ARCHIVE_FROM_VM_ALMOST_FULL_PROMO);
-
+ Assert.checkArgument(
+ VoicemailComponent.get(context)
+ .getVoicemailClient()
+ .isVoicemailArchiveAvailable(context));
+ Logger.get(context).logImpression(impressionToLog);
voicemailClient.setVoicemailArchiveEnabled(context, phoneAccountHandle, true);
Intent intent = new Intent(VoicemailContract.ACTION_SYNC_VOICEMAIL);
intent.setPackage(status.sourcePackage);
@@ -213,6 +216,7 @@ public class VoicemailErrorMessage {
@NonNull
public static Action createDismissTurnArchiveOnAction(
final Context context,
+ int impressionToLog,
VoicemailStatusReader statusReader,
PerAccountSharedPreferences sharedPreferenceForAccount,
String preferenceKeyToUpdate) {
@@ -221,11 +225,11 @@ public class VoicemailErrorMessage {
new OnClickListener() {
@Override
public void onClick(View v) {
- OmtpVoicemailMessageCreator.logArchiveImpression(
- context,
- preferenceKeyToUpdate,
- DialerImpression.Type.VVM_USER_DISMISSED_VM_FULL_PROMO,
- DialerImpression.Type.VVM_USER_DISMISSED_VM_ALMOST_FULL_PROMO);
+ Assert.checkArgument(
+ VoicemailComponent.get(context)
+ .getVoicemailClient()
+ .isVoicemailArchiveAvailable(context));
+ Logger.get(context).logImpression(impressionToLog);
sharedPreferenceForAccount.edit().putBoolean(preferenceKeyToUpdate, true).apply();
statusReader.refresh();
}
diff --git a/java/com/android/dialer/app/voicemail/error/Vvm3VoicemailMessageCreator.java b/java/com/android/dialer/app/voicemail/error/Vvm3VoicemailMessageCreator.java
index 8b10ff4a8..d98ac2cd5 100644
--- a/java/com/android/dialer/app/voicemail/error/Vvm3VoicemailMessageCreator.java
+++ b/java/com/android/dialer/app/voicemail/error/Vvm3VoicemailMessageCreator.java
@@ -264,7 +264,7 @@ public class Vvm3VoicemailMessageCreator {
return new VoicemailErrorMessage(
context.getString(R.string.voicemail_error_pin_not_set_title),
getCustomerSupportString(context, R.string.voicemail_error_pin_not_set_message),
- VoicemailErrorMessage.createSetPinAction(context));
+ VoicemailErrorMessage.createSetPinAction(context, status.getPhoneAccountHandle()));
}
return OmtpVoicemailMessageCreator.create(context, status, statusReader);
diff --git a/java/com/android/dialer/app/voicemail/error/res/values-de/strings.xml b/java/com/android/dialer/app/voicemail/error/res/values-de/strings.xml
index 09283d3d6..8939e687e 100644
--- a/java/com/android/dialer/app/voicemail/error/res/values-de/strings.xml
+++ b/java/com/android/dialer/app/voicemail/error/res/values-de/strings.xml
@@ -24,8 +24,8 @@
<string name="voicemail_error_not_activate_no_signal_message" msgid="4511975927252363280">"Vergewissere dich, dass dein Smartphone eine Mobilfunkverbindung hat und versuche es noch einmal."</string>
<string name="voicemail_error_not_activate_no_signal_airplane_mode_message" msgid="2005255281543281215">"Schalte den Flugmodus aus und versuche es noch einmal."</string>
<string name="voicemail_error_no_signal_title" msgid="341954685733680219">"Keine Verbindung"</string>
- <string name="voicemail_error_no_signal_message" msgid="8557509373166292640">"Du wirst nicht über neue Mailbox-Nachrichten informiert. Wenn du eine WLAN-Verbindung hast, kannst du deine Mailbox abrufen, indem du dein Smartphone jetzt synchronisierst."</string>
- <string name="voicemail_error_no_signal_airplane_mode_message" msgid="8553646558282754276">"Du wirst nicht über neue Mailbox-Nachrichten informiert. Schalte den Flugmodus aus, um deine Mailbox zu synchronisieren."</string>
+ <string name="voicemail_error_no_signal_message" msgid="8557509373166292640">"Du wirst nicht über neue Mailboxnachrichten informiert. Wenn du eine WLAN-Verbindung hast, kannst du deine Mailbox abrufen, indem du dein Smartphone jetzt synchronisierst."</string>
+ <string name="voicemail_error_no_signal_airplane_mode_message" msgid="8553646558282754276">"Du wirst nicht über neue Mailboxnachrichten informiert. Schalte den Flugmodus aus, um deine Mailbox zu synchronisieren."</string>
<string name="voicemail_error_no_signal_cellular_required_message" msgid="8461294934887808098">"Dein Smartphone benötigt eine mobile Datenverbindung, um die Mailbox abzurufen."</string>
<string name="voicemail_error_activation_failed_title" msgid="3823477898681399391">"Visuelle Mailbox kann nicht aktiviert werden"</string>
<string name="voicemail_error_activation_failed_message" msgid="2188301459207765442">"Du kannst deine Mailbox immer noch per Anruf abhören."</string>
@@ -42,12 +42,12 @@
<string name="voicemail_error_server_message" msgid="3538157415413084592">"Du kannst deine Mailbox immer noch per Anruf abhören."</string>
<string name="voicemail_error_inbox_near_full_title" msgid="7568681773644454672">"Mailbox fast voll"</string>
<string name="voicemail_error_inbox_near_full_message" msgid="354118612203528244">"Wenn deine Mailbox voll ist, kannst du keine neuen Sprachnachrichten empfangen."</string>
- <string name="voicemail_error_inbox_full_title" msgid="249268068442046872">"Es können keine neuen Mailbox-Nachrichten empfangen werden"</string>
+ <string name="voicemail_error_inbox_full_title" msgid="249268068442046872">"Es können keine neuen Mailboxnachrichten empfangen werden"</string>
<string name="voicemail_error_inbox_full_message" msgid="5788411018158899123">"Deine Mailbox ist voll. Lösche einige Nachrichten, um neue empfangen zu können."</string>
<string name="voicemail_error_inbox_full_turn_archive_on_title" msgid="3083779676549536189">"[Testfunktion] Zusätzlichen Speicher und Sicherung aktivieren"</string>
- <string name="voicemail_error_inbox_full_turn_archive_on_message" msgid="4236256841748725792">"Dein Postfach ist voll. Aktivere zusätzlichen Speicher, um Speicherplatz freizugeben. So kann Google deine Mailbox-Nachrichten verwalten und sichern. "<b><i>"Diese Funktion wird gerade getestet."</i></b>" Hiermit werden möglicherweise Mailbox-Nachrichten von deinem Mailbox-Server gelöscht und es wird nicht garantiert, dass diese Funktion auch in Zukunft unterstützt wird. Wir würden uns aber sehr über Feedback dazu freuen."</string>
+ <string name="voicemail_error_inbox_full_turn_archive_on_message" msgid="4236256841748725792">"Dein Postfach ist voll. Aktivere zusätzlichen Speicher, um Speicherplatz freizugeben. So kann Google deine Mailboxnachrichten verwalten und sichern. "<b><i>"Diese Funktion wird gerade getestet."</i></b>" Hiermit werden möglicherweise Mailboxnachrichten von deinem Mailbox-Server gelöscht und es wird nicht garantiert, dass diese Funktion auch in Zukunft unterstützt wird. Wir würden uns aber sehr über Feedback dazu freuen."</string>
<string name="voicemail_error_inbox_almost_full_turn_archive_on_title" msgid="6118464905488477869">"[Testfunktion] Zusätzlichen Speicher und Sicherung aktivieren"</string>
- <string name="voicemail_error_inbox_almost_full_turn_archive_on_message" msgid="7289015622668426730">"Dein Postfach ist voll. Aktivere zusätzlichen Speicher, um Speicherplatz freizugeben. So kann Google deine Mailbox-Nachrichten verwalten und sichern. "<b><i>"Diese Funktion wird gerade getestet."</i></b>" Hiermit werden möglicherweise Mailbox-Nachrichten von deinem Mailbox-Server gelöscht und es wird nicht garantiert, dass diese Funktion auch in Zukunft unterstützt wird. Wir würden uns aber sehr über Feedback dazu freuen."</string>
+ <string name="voicemail_error_inbox_almost_full_turn_archive_on_message" msgid="7289015622668426730">"Dein Postfach ist voll. Aktivere zusätzlichen Speicher, um Speicherplatz freizugeben. So kann Google deine Mailboxnachrichten verwalten und sichern. "<b><i>"Diese Funktion wird gerade getestet."</i></b>" Hiermit werden möglicherweise Mailboxnachrichten von deinem Mailbox-Server gelöscht und es wird nicht garantiert, dass diese Funktion auch in Zukunft unterstützt wird. Wir würden uns aber sehr über Feedback dazu freuen."</string>
<string name="voicemail_error_pin_not_set_title" msgid="1287168514277948082">"Mailbox-PIN festlegen"</string>
<string name="voicemail_error_pin_not_set_message" msgid="3802375002103184625">"Bei jedem Anruf auf deiner Mailbox benötigst du eine Mailbox-PIN."</string>
<string name="voicemail_error_unknown_title" msgid="7214482611706360680">"Unbekannter Fehler"</string>
@@ -105,6 +105,6 @@
<string name="verizon_terms_and_conditions_message" msgid="271780225159084419">"Du muss den Nutzungsbedingungen von Verizon Wireless zustimmen, um die visuelle Mailbox zu verwenden:\n\n%s"</string>
<string name="verizon_terms_and_conditions_decline_dialog_message" msgid="7852059293806766767">"Die visuelle Mailbox wird deaktiviert, wenn du die Nutzungsbedingungen ablehnst."</string>
<string name="verizon_terms_and_conditions_decline_dialog_downgrade" msgid="8347128304508008823">"Visuelle Mailbox deaktivieren"</string>
- <string name="verizon_terms_and_conditions_decline_set_pin_dialog_message" msgid="2200388197966526000">"Du kannst nur auf Mailbox-Nachrichten zugreifen, indem du *86 anrufst. Lege eine neue Mailbox-PIN fest, um fortzufahren."</string>
+ <string name="verizon_terms_and_conditions_decline_set_pin_dialog_message" msgid="2200388197966526000">"Du kannst nur auf Mailboxnachrichten zugreifen, indem du *86 anrufst. Lege eine neue Mailbox-PIN fest, um fortzufahren."</string>
<string name="verizon_terms_and_conditions_decline_set_pin_dialog_set_pin" msgid="4320664492466296770">"PIN festlegen"</string>
</resources>