Add "Extras" to PhoneAccount.

- Add extras to PhoneAccount, and associated builder.

Bug: 22806380
Change-Id: I90f4c1a9b022eef7e6d2829d82851ac307ceafdf
This commit is contained in:
Tyler Gunn
2015-10-05 14:14:38 -07:00
parent 3da3ca609e
commit 25ed2d7aec
3 changed files with 41 additions and 0 deletions

View File

@@ -30475,6 +30475,7 @@ package android.telecom {
method public android.telecom.PhoneAccountHandle getAccountHandle();
method public android.net.Uri getAddress();
method public int getCapabilities();
method public android.os.Bundle getExtras();
method public int getHighlightColor();
method public android.graphics.drawable.Icon getIcon();
method public java.lang.CharSequence getLabel();
@@ -30507,6 +30508,7 @@ package android.telecom {
method public android.telecom.PhoneAccount build();
method public android.telecom.PhoneAccount.Builder setAddress(android.net.Uri);
method public android.telecom.PhoneAccount.Builder setCapabilities(int);
method public android.telecom.PhoneAccount.Builder setExtras(android.os.Bundle);
method public android.telecom.PhoneAccount.Builder setHighlightColor(int);
method public android.telecom.PhoneAccount.Builder setIcon(android.graphics.drawable.Icon);
method public android.telecom.PhoneAccount.Builder setShortDescription(java.lang.CharSequence);

View File

@@ -32674,6 +32674,7 @@ package android.telecom {
method public android.telecom.PhoneAccountHandle getAccountHandle();
method public android.net.Uri getAddress();
method public int getCapabilities();
method public android.os.Bundle getExtras();
method public int getHighlightColor();
method public android.graphics.drawable.Icon getIcon();
method public java.lang.CharSequence getLabel();
@@ -32707,6 +32708,7 @@ package android.telecom {
method public android.telecom.PhoneAccount build();
method public android.telecom.PhoneAccount.Builder setAddress(android.net.Uri);
method public android.telecom.PhoneAccount.Builder setCapabilities(int);
method public android.telecom.PhoneAccount.Builder setExtras(android.os.Bundle);
method public android.telecom.PhoneAccount.Builder setHighlightColor(int);
method public android.telecom.PhoneAccount.Builder setIcon(android.graphics.drawable.Icon);
method public android.telecom.PhoneAccount.Builder setShortDescription(java.lang.CharSequence);

View File

@@ -28,6 +28,7 @@ import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
import android.net.Uri;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
@@ -160,6 +161,7 @@ public final class PhoneAccount implements Parcelable {
private final CharSequence mShortDescription;
private final List<String> mSupportedUriSchemes;
private final Icon mIcon;
private final Bundle mExtras;
private boolean mIsEnabled;
/**
@@ -175,6 +177,7 @@ public final class PhoneAccount implements Parcelable {
private CharSequence mShortDescription;
private List<String> mSupportedUriSchemes = new ArrayList<String>();
private Icon mIcon;
private Bundle mExtras;
private boolean mIsEnabled = false;
/**
@@ -299,6 +302,20 @@ public final class PhoneAccount implements Parcelable {
return this;
}
/**
* Specifies the extras associated with the {@link PhoneAccount}.
* <p>
* {@code PhoneAccount}s only support extra values of type: {@link String}, {@link Integer},
* and {@link Boolean}. Extras which are not of these types are ignored.
*
* @param extras
* @return
*/
public Builder setExtras(Bundle extras) {
mExtras = extras;
return this;
}
/**
* Sets the enabled state of the phone account.
*
@@ -332,6 +349,7 @@ public final class PhoneAccount implements Parcelable {
mLabel,
mShortDescription,
mSupportedUriSchemes,
mExtras,
mIsEnabled);
}
}
@@ -346,6 +364,7 @@ public final class PhoneAccount implements Parcelable {
CharSequence label,
CharSequence shortDescription,
List<String> supportedUriSchemes,
Bundle extras,
boolean isEnabled) {
mAccountHandle = account;
mAddress = address;
@@ -356,6 +375,7 @@ public final class PhoneAccount implements Parcelable {
mLabel = label;
mShortDescription = shortDescription;
mSupportedUriSchemes = Collections.unmodifiableList(supportedUriSchemes);
mExtras = extras;
mIsEnabled = isEnabled;
}
@@ -454,6 +474,18 @@ public final class PhoneAccount implements Parcelable {
return mSupportedUriSchemes;
}
/**
* The extras associated with this {@code PhoneAccount}.
* <p>
* A {@link ConnectionService} may provide implementation specific information about the
* {@link PhoneAccount} via the extras.
*
* @return The extras.
*/
public Bundle getExtras() {
return mExtras;
}
/**
* The icon to represent this {@code PhoneAccount}.
*
@@ -552,6 +584,8 @@ public final class PhoneAccount implements Parcelable {
out.writeInt(1);
mIcon.writeToParcel(out, flags);
}
out.writeBundle(mExtras);
out.writeByte((byte) (mIsEnabled ? 1 : 0));
}
@@ -594,6 +628,7 @@ public final class PhoneAccount implements Parcelable {
} else {
mIcon = null;
}
mExtras = in.readBundle();
mIsEnabled = in.readByte() == 1;
}
@@ -610,6 +645,8 @@ public final class PhoneAccount implements Parcelable {
sb.append(scheme)
.append(" ");
}
sb.append(" Extras : ");
sb.append(mExtras);
sb.append("]");
return sb.toString();
}