summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNancy Chen <nancychen@google.com>2015-05-13 21:54:47 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-05-13 21:54:48 +0000
commit782509076bf4ca155865c465985a458e83d9b577 (patch)
tree9be5b416a43047da5225b71704c1e283af64cc72
parentae649b1af86f0464cea073125103e45d1bd40fc8 (diff)
parent16b84b0ab586309ee4d76301c2e578dbfbd7c7db (diff)
downloadframeworks_base-782509076bf4ca155865c465985a458e83d9b577.zip
frameworks_base-782509076bf4ca155865c465985a458e83d9b577.tar.gz
frameworks_base-782509076bf4ca155865c465985a458e83d9b577.tar.bz2
Merge "Add phone account field for voicemail to distinguish the source." into mnc-dev
-rw-r--r--core/java/android/provider/VoicemailContract.java7
-rw-r--r--telecomm/java/android/telecom/Voicemail.java35
2 files changed, 37 insertions, 5 deletions
diff --git a/core/java/android/provider/VoicemailContract.java b/core/java/android/provider/VoicemailContract.java
index 879f26c..89668c1 100644
--- a/core/java/android/provider/VoicemailContract.java
+++ b/core/java/android/provider/VoicemailContract.java
@@ -306,6 +306,13 @@ public class VoicemailContract {
contentValues.put(Voicemails.SOURCE_PACKAGE, voicemail.getSourcePackage());
contentValues.put(Voicemails.SOURCE_DATA, voicemail.getSourceData());
contentValues.put(Voicemails.IS_READ, voicemail.isRead() ? 1 : 0);
+
+ PhoneAccountHandle phoneAccount = voicemail.getPhoneAccount();
+ if (voicemail.getPhoneAccount() != null) {
+ contentValues.put(Voicemails.PHONE_ACCOUNT_COMPONENT_NAME,
+ phoneAccount.getComponentName().flattenToString());
+ contentValues.put(Voicemails.PHONE_ACCOUNT_ID, phoneAccount.getId());
+ }
return contentValues;
}
}
diff --git a/telecomm/java/android/telecom/Voicemail.java b/telecomm/java/android/telecom/Voicemail.java
index f5b8052..151917e 100644
--- a/telecomm/java/android/telecom/Voicemail.java
+++ b/telecomm/java/android/telecom/Voicemail.java
@@ -28,6 +28,7 @@ import android.os.Parcelable;
public class Voicemail implements Parcelable {
private final Long mTimestamp;
private final String mNumber;
+ private final PhoneAccountHandle mPhoneAccount;
private final Long mId;
private final Long mDuration;
private final String mSource;
@@ -36,10 +37,12 @@ public class Voicemail implements Parcelable {
private final Boolean mIsRead;
private final Boolean mHasContent;
- private Voicemail(Long timestamp, String number, Long id, Long duration, String source,
- String providerData, Uri uri, Boolean isRead, Boolean hasContent) {
+ private Voicemail(Long timestamp, String number, PhoneAccountHandle phoneAccountHandle, Long id,
+ Long duration, String source, String providerData, Uri uri, Boolean isRead,
+ Boolean hasContent) {
mTimestamp = timestamp;
mNumber = number;
+ mPhoneAccount = phoneAccountHandle;
mId = id;
mDuration = duration;
mSource = source;
@@ -77,6 +80,7 @@ public class Voicemail implements Parcelable {
public static class Builder {
private Long mBuilderTimestamp;
private String mBuilderNumber;
+ private PhoneAccountHandle mBuilderPhoneAccount;
private Long mBuilderId;
private Long mBuilderDuration;
private String mBuilderSourcePackage;
@@ -99,6 +103,11 @@ public class Voicemail implements Parcelable {
return this;
}
+ public Builder setPhoneAccount(PhoneAccountHandle phoneAccount) {
+ mBuilderPhoneAccount = phoneAccount;
+ return this;
+ }
+
public Builder setId(long id) {
mBuilderId = id;
return this;
@@ -139,9 +148,9 @@ public class Voicemail implements Parcelable {
mBuilderTimestamp = mBuilderTimestamp == null ? 0 : mBuilderTimestamp;
mBuilderDuration = mBuilderDuration == null ? 0: mBuilderDuration;
mBuilderIsRead = mBuilderIsRead == null ? false : mBuilderIsRead;
- return new Voicemail(mBuilderTimestamp, mBuilderNumber, mBuilderId, mBuilderDuration,
- mBuilderSourcePackage, mBuilderSourceData, mBuilderUri, mBuilderIsRead,
- mBuilderHasContent);
+ return new Voicemail(mBuilderTimestamp, mBuilderNumber, mBuilderPhoneAccount,
+ mBuilderId, mBuilderDuration, mBuilderSourcePackage, mBuilderSourceData,
+ mBuilderUri, mBuilderIsRead, mBuilderHasContent);
}
}
@@ -161,6 +170,11 @@ public class Voicemail implements Parcelable {
return mNumber;
}
+ /** The phone account associated with the voicemail, null if not set. */
+ public PhoneAccountHandle getPhoneAccount() {
+ return mPhoneAccount;
+ }
+
/** The timestamp the voicemail was received, in millis since the epoch, zero if not set. */
public long getTimestampMillis() {
return mTimestamp;
@@ -225,6 +239,12 @@ public class Voicemail implements Parcelable {
public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(mTimestamp);
dest.writeCharSequence(mNumber);
+ if (mPhoneAccount == null) {
+ dest.writeInt(0);
+ } else {
+ dest.writeInt(1);
+ mPhoneAccount.writeToParcel(dest, flags);
+ }
dest.writeLong(mId);
dest.writeLong(mDuration);
dest.writeCharSequence(mSource);
@@ -263,6 +283,11 @@ public class Voicemail implements Parcelable {
private Voicemail(Parcel in) {
mTimestamp = in.readLong();
mNumber = (String) in.readCharSequence();
+ if (in.readInt() > 0) {
+ mPhoneAccount = PhoneAccountHandle.CREATOR.createFromParcel(in);
+ } else {
+ mPhoneAccount = null;
+ }
mId = in.readLong();
mDuration = in.readLong();
mSource = (String) in.readCharSequence();