From 435257973bcc472a1b9d2f9852ac1fa26cf74e06 Mon Sep 17 00:00:00 2001 From: uabdullah Date: Wed, 25 Oct 2017 11:12:30 -0700 Subject: Add support for voicemailURI to annotated call log for new voicemail tab VoicemailUri is required to play voicemail audio files. We need it to be able to play the voicemails in the voicemail tab. A follow up CL will be using the uri to play the audio, but via a media player. Bug: 64882313 Test: Unit tests PiperOrigin-RevId: 173422683 Change-Id: Ib438e3020c83e11a2c54c3e941c93e83dba9bc90 --- .../dialer/binary/aosp/testing/TestActivity.java | 25 ---------------------- .../database/AnnotatedCallLogDatabaseHelper.java | 5 +++-- .../contract/AnnotatedCallLogContract.java | 7 ++++++ .../systemcalllog/SystemCallLogDataSource.java | 4 ++++ .../voicemail/listui/VoicemailCursorLoader.java | 5 ++++- .../dialer/voicemail/model/VoicemailEntry.java | 5 +++++ 6 files changed, 23 insertions(+), 28 deletions(-) delete mode 100644 java/com/android/dialer/binary/aosp/testing/TestActivity.java (limited to 'java') diff --git a/java/com/android/dialer/binary/aosp/testing/TestActivity.java b/java/com/android/dialer/binary/aosp/testing/TestActivity.java deleted file mode 100644 index 9cb26dab7..000000000 --- a/java/com/android/dialer/binary/aosp/testing/TestActivity.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License - */ - -package com.android.dialer.binary.aosp.testing; - -import android.app.Activity; - -/** - * An empty Activity to use in tests. This can be useful when UI needs to be tested outside an - * Activity, either as a background or to keep the test framework running. - */ -public class TestActivity extends Activity {} diff --git a/java/com/android/dialer/calllog/database/AnnotatedCallLogDatabaseHelper.java b/java/com/android/dialer/calllog/database/AnnotatedCallLogDatabaseHelper.java index a3180a0b9..a6a646655 100644 --- a/java/com/android/dialer/calllog/database/AnnotatedCallLogDatabaseHelper.java +++ b/java/com/android/dialer/calllog/database/AnnotatedCallLogDatabaseHelper.java @@ -32,6 +32,7 @@ class AnnotatedCallLogDatabaseHelper extends SQLiteOpenHelper { this.maxRows = maxRows; } + // TODO(uabdullah): Use concatenation to avoid klippy warnings private static final String CREATE_TABLE_SQL = new StringBuilder() .append("create table if not exists " + AnnotatedCallLog.TABLE + " (") @@ -57,8 +58,8 @@ class AnnotatedCallLogDatabaseHelper extends SQLiteOpenHelper { .append(AnnotatedCallLog.IS_BUSINESS + " integer, ") .append(AnnotatedCallLog.IS_VOICEMAIL + " integer, ") .append(AnnotatedCallLog.TRANSCRIPTION + " integer, ") - .append(AnnotatedCallLog.CALL_TYPE) - .append(" integer") + .append(AnnotatedCallLog.VOICEMAIL_URI + " string, ") + .append(AnnotatedCallLog.CALL_TYPE + " integer") .append(");") .toString(); diff --git a/java/com/android/dialer/calllog/database/contract/AnnotatedCallLogContract.java b/java/com/android/dialer/calllog/database/contract/AnnotatedCallLogContract.java index 832a9c2c0..4f26f0cc9 100644 --- a/java/com/android/dialer/calllog/database/contract/AnnotatedCallLogContract.java +++ b/java/com/android/dialer/calllog/database/contract/AnnotatedCallLogContract.java @@ -232,6 +232,13 @@ public class AnnotatedCallLogContract { *

TYPE: TEXT */ public static final String TRANSCRIPTION = "transcription"; + + /** + * See {@link android.provider.CallLog.Calls#VOICEMAIL_URI}. + * + *

TYPE: TEXT + */ + public static final String VOICEMAIL_URI = "voicemail_uri"; } /** diff --git a/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java b/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java index 5c73933a9..1fe3507e0 100644 --- a/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java +++ b/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java @@ -218,6 +218,7 @@ public class SystemCallLogDataSource implements CallLogDataSource { Calls.CACHED_NUMBER_LABEL, Calls.DURATION, Calls.TRANSCRIPTION, + Calls.VOICEMAIL_URI, Calls.IS_READ, Calls.NEW, Calls.GEOCODED_LOCATION, @@ -256,6 +257,7 @@ public class SystemCallLogDataSource implements CallLogDataSource { int cachedNumberLabelColumn = cursor.getColumnIndexOrThrow(Calls.CACHED_NUMBER_LABEL); int durationsColumn = cursor.getColumnIndexOrThrow(Calls.DURATION); int transcriptionColumn = cursor.getColumnIndexOrThrow(Calls.TRANSCRIPTION); + int voicemailUriColumn = cursor.getColumnIndexOrThrow(Calls.VOICEMAIL_URI); int isReadColumn = cursor.getColumnIndexOrThrow(Calls.IS_READ); int newColumn = cursor.getColumnIndexOrThrow(Calls.NEW); int geocodedLocationColumn = cursor.getColumnIndexOrThrow(Calls.GEOCODED_LOCATION); @@ -282,6 +284,7 @@ public class SystemCallLogDataSource implements CallLogDataSource { String cachedNumberLabel = cursor.getString(cachedNumberLabelColumn); int duration = cursor.getInt(durationsColumn); String transcription = cursor.getString(transcriptionColumn); + String voicemailUri = cursor.getString(voicemailUriColumn); int isRead = cursor.getInt(isReadColumn); int isNew = cursor.getInt(newColumn); String geocodedLocation = cursor.getString(geocodedLocationColumn); @@ -329,6 +332,7 @@ public class SystemCallLogDataSource implements CallLogDataSource { contentValues.put(AnnotatedCallLog.FEATURES, features); contentValues.put(AnnotatedCallLog.DURATION, duration); contentValues.put(AnnotatedCallLog.TRANSCRIPTION, transcription); + contentValues.put(AnnotatedCallLog.VOICEMAIL_URI, voicemailUri); if (existingAnnotatedCallLogIds.contains(id)) { mutations.update(id, contentValues); diff --git a/java/com/android/dialer/voicemail/listui/VoicemailCursorLoader.java b/java/com/android/dialer/voicemail/listui/VoicemailCursorLoader.java index e371e5ebf..3112d95ac 100644 --- a/java/com/android/dialer/voicemail/listui/VoicemailCursorLoader.java +++ b/java/com/android/dialer/voicemail/listui/VoicemailCursorLoader.java @@ -42,7 +42,8 @@ final class VoicemailCursorLoader extends CursorLoader { AnnotatedCallLog.DURATION, AnnotatedCallLog.GEOCODED_LOCATION, AnnotatedCallLog.CALL_TYPE, - AnnotatedCallLog.TRANSCRIPTION + AnnotatedCallLog.TRANSCRIPTION, + AnnotatedCallLog.VOICEMAIL_URI }; // Indexes for VOICEMAIL_COLUMNS @@ -58,6 +59,7 @@ final class VoicemailCursorLoader extends CursorLoader { private static final int GEOCODED_LOCATION = 9; private static final int CALL_TYPE = 10; private static final int TRANSCRIPTION = 11; + private static final int VOICEMAIL_URI = 12; // TODO(zachh): Optimize indexes VoicemailCursorLoader(Context context) { @@ -90,6 +92,7 @@ final class VoicemailCursorLoader extends CursorLoader { .setLookupUri(cursor.getString(LOOKUP_URI)) .setDuration(cursor.getLong(DURATION)) .setTranscription(cursor.getString(TRANSCRIPTION)) + .setVoicemailUri(cursor.getString(VOICEMAIL_URI)) .setGeocodedLocation(cursor.getString(GEOCODED_LOCATION)) .setCallType(cursor.getInt(CALL_TYPE)) .build(); diff --git a/java/com/android/dialer/voicemail/model/VoicemailEntry.java b/java/com/android/dialer/voicemail/model/VoicemailEntry.java index fc548f18c..df30dee9c 100644 --- a/java/com/android/dialer/voicemail/model/VoicemailEntry.java +++ b/java/com/android/dialer/voicemail/model/VoicemailEntry.java @@ -64,6 +64,9 @@ public abstract class VoicemailEntry { @Nullable public abstract String transcription(); + @Nullable + public abstract String voicemailUri(); + public abstract int callType(); /** Builder for {@link VoicemailEntry}. */ @@ -90,6 +93,8 @@ public abstract class VoicemailEntry { public abstract Builder setTranscription(@Nullable String transcription); + public abstract Builder setVoicemailUri(@Nullable String voicemailUri); + public abstract Builder setGeocodedLocation(@Nullable String geocodedLocation); public abstract Builder setCallType(int callType); -- cgit v1.2.3