Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 77e7c968 authored by Tyler Gunn's avatar Tyler Gunn Committed by Android (Google) Code Review
Browse files

Merge "Add "Extras" to PhoneAccount."

parents 818eac2e 25ed2d7a
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -30480,6 +30480,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();
@@ -30512,6 +30513,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);
+2 −0
Original line number Diff line number Diff line
@@ -32679,6 +32679,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();
@@ -32712,6 +32713,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);
+37 −0
Original line number Diff line number Diff line
@@ -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();
    }