diff options
author | Sarmad Hashmi <mhashmi@google.com> | 2016-02-10 17:41:12 -0800 |
---|---|---|
committer | Sarmad Hashmi <mhashmi@google.com> | 2016-02-24 21:45:50 +0000 |
commit | 6d8399afae309207237456c27b336d948ed912ff (patch) | |
tree | 196e2ddcbefb4d2427f0888d6eebec8b5ca28e88 /src/com/android/dialer/calllog | |
parent | 5d9fdc591a5e8b5b8b0cbb1d9060f10fc2816325 (diff) |
Fix bug where 00:00 duration is shown for voicemails without a duration.
Instead of showing a 00:00 duration, nothing is displayed. When the
content is loaded, the duration field for the call log entry associated
with the voicemail is updated with the duration fetched from the
mediaplayer. The proper duration is then displayed in MM:SS format.
BUG=24175525
Change-Id: I1cafebae4fcbc749f573accfcf8833b598675f0b
(cherry picked from commit 6f3016d9065564bf09a5759f16563a05abbe105d)
Diffstat (limited to 'src/com/android/dialer/calllog')
-rw-r--r-- | src/com/android/dialer/calllog/CallLogAsyncTaskUtil.java | 28 | ||||
-rw-r--r-- | src/com/android/dialer/calllog/PhoneCallDetailsHelper.java | 2 |
2 files changed, 29 insertions, 1 deletions
diff --git a/src/com/android/dialer/calllog/CallLogAsyncTaskUtil.java b/src/com/android/dialer/calllog/CallLogAsyncTaskUtil.java index bb7bdbd0a..df6dc7de4 100644 --- a/src/com/android/dialer/calllog/CallLogAsyncTaskUtil.java +++ b/src/com/android/dialer/calllog/CallLogAsyncTaskUtil.java @@ -52,6 +52,7 @@ public class CallLogAsyncTaskUtil { DELETE_BLOCKED_CALL, MARK_VOICEMAIL_READ, GET_CALL_DETAILS, + UPDATE_DURATION } private static final class CallDetailQuery { @@ -379,6 +380,33 @@ public class CallLogAsyncTaskUtil { }); } + + /** + * Updates the duration of a voicemail call log entry. + */ + public static void updateVoicemailDuration( + final Context context, + final Uri voicemailUri, + final int duration) { + if (!PermissionsUtil.hasPhonePermissions(context)) { + return; + } + + if (sAsyncTaskExecutor == null) { + initTaskExecutor(); + } + + sAsyncTaskExecutor.submit(Tasks.UPDATE_DURATION, new AsyncTask<Void, Void, Void>() { + @Override + public Void doInBackground(Void... params) { + ContentValues values = new ContentValues(1); + values.put(CallLog.Calls.DURATION, duration); + context.getContentResolver().update(voicemailUri, values, null, null); + return null; + } + }); + } + @VisibleForTesting public static void resetForTest() { sAsyncTaskExecutor = null; diff --git a/src/com/android/dialer/calllog/PhoneCallDetailsHelper.java b/src/com/android/dialer/calllog/PhoneCallDetailsHelper.java index be02e4c1b..7b149e24e 100644 --- a/src/com/android/dialer/calllog/PhoneCallDetailsHelper.java +++ b/src/com/android/dialer/calllog/PhoneCallDetailsHelper.java @@ -326,7 +326,7 @@ public class PhoneCallDetailsHelper { text = dateText; } - if (details.callTypes[0] == Calls.VOICEMAIL_TYPE) { + if (details.callTypes[0] == Calls.VOICEMAIL_TYPE && details.duration > 0) { views.callLocationAndDate.setText(mResources.getString( R.string.voicemailCallLogDateTimeFormatWithDuration, text, getVoicemailDuration(details))); |