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

Commit d9e1fe3c authored by Santos Cordon's avatar Santos Cordon Committed by Android (Google) Code Review
Browse files

Merge "[1/4] Use new Icon class in PhoneAccount." into mnc-dev

parents ad0bfe3a cad84a20
Loading
Loading
Loading
Loading
+2 −11
Original line number Original line Diff line number Diff line
@@ -30315,16 +30315,12 @@ package android.telecom {
  public final class PhoneAccount implements android.os.Parcelable {
  public final class PhoneAccount implements android.os.Parcelable {
    method public static android.telecom.PhoneAccount.Builder builder(android.telecom.PhoneAccountHandle, java.lang.CharSequence);
    method public static android.telecom.PhoneAccount.Builder builder(android.telecom.PhoneAccountHandle, java.lang.CharSequence);
    method public android.graphics.drawable.Drawable createIconDrawable(android.content.Context);
    method public int describeContents();
    method public int describeContents();
    method public android.telecom.PhoneAccountHandle getAccountHandle();
    method public android.telecom.PhoneAccountHandle getAccountHandle();
    method public android.net.Uri getAddress();
    method public android.net.Uri getAddress();
    method public int getCapabilities();
    method public int getCapabilities();
    method public int getHighlightColor();
    method public int getHighlightColor();
    method public android.graphics.Bitmap getIconBitmap();
    method public android.graphics.drawable.Icon getIcon();
    method public java.lang.String getIconPackageName();
    method public int getIconResId();
    method public int getIconTint();
    method public java.lang.CharSequence getLabel();
    method public java.lang.CharSequence getLabel();
    method public java.lang.CharSequence getShortDescription();
    method public java.lang.CharSequence getShortDescription();
    method public android.net.Uri getSubscriptionAddress();
    method public android.net.Uri getSubscriptionAddress();
@@ -30340,7 +30336,6 @@ package android.telecom {
    field public static final int CAPABILITY_VIDEO_CALLING = 8; // 0x8
    field public static final int CAPABILITY_VIDEO_CALLING = 8; // 0x8
    field public static final android.os.Parcelable.Creator<android.telecom.PhoneAccount> CREATOR;
    field public static final android.os.Parcelable.Creator<android.telecom.PhoneAccount> CREATOR;
    field public static final int NO_HIGHLIGHT_COLOR = 0; // 0x0
    field public static final int NO_HIGHLIGHT_COLOR = 0; // 0x0
    field public static final int NO_ICON_TINT = 0; // 0x0
    field public static final int NO_RESOURCE_ID = -1; // 0xffffffff
    field public static final int NO_RESOURCE_ID = -1; // 0xffffffff
    field public static final java.lang.String SCHEME_SIP = "sip";
    field public static final java.lang.String SCHEME_SIP = "sip";
    field public static final java.lang.String SCHEME_TEL = "tel";
    field public static final java.lang.String SCHEME_TEL = "tel";
@@ -30355,11 +30350,7 @@ package android.telecom {
    method public android.telecom.PhoneAccount.Builder setAddress(android.net.Uri);
    method public android.telecom.PhoneAccount.Builder setAddress(android.net.Uri);
    method public android.telecom.PhoneAccount.Builder setCapabilities(int);
    method public android.telecom.PhoneAccount.Builder setCapabilities(int);
    method public android.telecom.PhoneAccount.Builder setHighlightColor(int);
    method public android.telecom.PhoneAccount.Builder setHighlightColor(int);
    method public android.telecom.PhoneAccount.Builder setIcon(android.content.Context, int);
    method public android.telecom.PhoneAccount.Builder setIcon(android.graphics.drawable.Icon);
    method public android.telecom.PhoneAccount.Builder setIcon(java.lang.String, int);
    method public android.telecom.PhoneAccount.Builder setIcon(android.content.Context, int, int);
    method public android.telecom.PhoneAccount.Builder setIcon(java.lang.String, int, int);
    method public android.telecom.PhoneAccount.Builder setIcon(android.graphics.Bitmap);
    method public android.telecom.PhoneAccount.Builder setShortDescription(java.lang.CharSequence);
    method public android.telecom.PhoneAccount.Builder setShortDescription(java.lang.CharSequence);
    method public android.telecom.PhoneAccount.Builder setSubscriptionAddress(android.net.Uri);
    method public android.telecom.PhoneAccount.Builder setSubscriptionAddress(android.net.Uri);
    method public android.telecom.PhoneAccount.Builder setSupportedUriSchemes(java.util.List<java.lang.String>);
    method public android.telecom.PhoneAccount.Builder setSupportedUriSchemes(java.util.List<java.lang.String>);
+2 −11
Original line number Original line Diff line number Diff line
@@ -32499,16 +32499,12 @@ package android.telecom {
  public final class PhoneAccount implements android.os.Parcelable {
  public final class PhoneAccount implements android.os.Parcelable {
    method public static android.telecom.PhoneAccount.Builder builder(android.telecom.PhoneAccountHandle, java.lang.CharSequence);
    method public static android.telecom.PhoneAccount.Builder builder(android.telecom.PhoneAccountHandle, java.lang.CharSequence);
    method public android.graphics.drawable.Drawable createIconDrawable(android.content.Context);
    method public int describeContents();
    method public int describeContents();
    method public android.telecom.PhoneAccountHandle getAccountHandle();
    method public android.telecom.PhoneAccountHandle getAccountHandle();
    method public android.net.Uri getAddress();
    method public android.net.Uri getAddress();
    method public int getCapabilities();
    method public int getCapabilities();
    method public int getHighlightColor();
    method public int getHighlightColor();
    method public android.graphics.Bitmap getIconBitmap();
    method public android.graphics.drawable.Icon getIcon();
    method public java.lang.String getIconPackageName();
    method public int getIconResId();
    method public int getIconTint();
    method public java.lang.CharSequence getLabel();
    method public java.lang.CharSequence getLabel();
    method public java.lang.CharSequence getShortDescription();
    method public java.lang.CharSequence getShortDescription();
    method public android.net.Uri getSubscriptionAddress();
    method public android.net.Uri getSubscriptionAddress();
@@ -32525,7 +32521,6 @@ package android.telecom {
    field public static final int CAPABILITY_VIDEO_CALLING = 8; // 0x8
    field public static final int CAPABILITY_VIDEO_CALLING = 8; // 0x8
    field public static final android.os.Parcelable.Creator<android.telecom.PhoneAccount> CREATOR;
    field public static final android.os.Parcelable.Creator<android.telecom.PhoneAccount> CREATOR;
    field public static final int NO_HIGHLIGHT_COLOR = 0; // 0x0
    field public static final int NO_HIGHLIGHT_COLOR = 0; // 0x0
    field public static final int NO_ICON_TINT = 0; // 0x0
    field public static final int NO_RESOURCE_ID = -1; // 0xffffffff
    field public static final int NO_RESOURCE_ID = -1; // 0xffffffff
    field public static final java.lang.String SCHEME_SIP = "sip";
    field public static final java.lang.String SCHEME_SIP = "sip";
    field public static final java.lang.String SCHEME_TEL = "tel";
    field public static final java.lang.String SCHEME_TEL = "tel";
@@ -32540,11 +32535,7 @@ package android.telecom {
    method public android.telecom.PhoneAccount.Builder setAddress(android.net.Uri);
    method public android.telecom.PhoneAccount.Builder setAddress(android.net.Uri);
    method public android.telecom.PhoneAccount.Builder setCapabilities(int);
    method public android.telecom.PhoneAccount.Builder setCapabilities(int);
    method public android.telecom.PhoneAccount.Builder setHighlightColor(int);
    method public android.telecom.PhoneAccount.Builder setHighlightColor(int);
    method public android.telecom.PhoneAccount.Builder setIcon(android.content.Context, int);
    method public android.telecom.PhoneAccount.Builder setIcon(android.graphics.drawable.Icon);
    method public android.telecom.PhoneAccount.Builder setIcon(java.lang.String, int);
    method public android.telecom.PhoneAccount.Builder setIcon(android.content.Context, int, int);
    method public android.telecom.PhoneAccount.Builder setIcon(java.lang.String, int, int);
    method public android.telecom.PhoneAccount.Builder setIcon(android.graphics.Bitmap);
    method public android.telecom.PhoneAccount.Builder setShortDescription(java.lang.CharSequence);
    method public android.telecom.PhoneAccount.Builder setShortDescription(java.lang.CharSequence);
    method public android.telecom.PhoneAccount.Builder setSubscriptionAddress(android.net.Uri);
    method public android.telecom.PhoneAccount.Builder setSubscriptionAddress(android.net.Uri);
    method public android.telecom.PhoneAccount.Builder setSupportedUriSchemes(java.util.List<java.lang.String>);
    method public android.telecom.PhoneAccount.Builder setSupportedUriSchemes(java.util.List<java.lang.String>);
+90 −4
Original line number Original line Diff line number Diff line
@@ -18,9 +18,9 @@ package android.graphics.drawable;


import android.annotation.DrawableRes;
import android.annotation.DrawableRes;
import android.content.ContentResolver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.content.res.Resources;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.net.Uri;
@@ -29,15 +29,16 @@ import android.os.Handler;
import android.os.Message;
import android.os.Message;
import android.os.Parcel;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable;
import android.os.UserHandle;
import android.util.Log;
import android.util.Log;


import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStream;
import java.lang.IllegalArgumentException;
import java.io.OutputStream;
import java.lang.Override;


/**
/**
 * An umbrella container for several serializable graphics representations, including Bitmaps,
 * An umbrella container for several serializable graphics representations, including Bitmaps,
@@ -57,6 +58,8 @@ public final class Icon implements Parcelable {
    private static final int TYPE_DATA     = 3;
    private static final int TYPE_DATA     = 3;
    private static final int TYPE_URI      = 4;
    private static final int TYPE_URI      = 4;


    private static final int VERSION_STREAM_SERIALIZER = 1;

    private final int mType;
    private final int mType;


    // To avoid adding unnecessary overhead, we have a few basic objects that get repurposed
    // To avoid adding unnecessary overhead, we have a few basic objects that get repurposed
@@ -281,16 +284,81 @@ public final class Icon implements Parcelable {
        return loadDrawable(context);
        return loadDrawable(context);
    }
    }


    /**
     * Writes a serialized version of an Icon to the specified stream.
     *
     * @param stream The stream on which to serialize the Icon.
     * @hide
     */
    public void writeToStream(OutputStream stream) throws IOException {
        DataOutputStream dataStream = new DataOutputStream(stream);

        dataStream.writeInt(VERSION_STREAM_SERIALIZER);
        dataStream.writeByte(mType);

        switch (mType) {
            case TYPE_BITMAP:
                getBitmap().compress(Bitmap.CompressFormat.PNG, 100, dataStream);
                break;
            case TYPE_DATA:
                dataStream.writeInt(getDataLength());
                dataStream.write(getDataBytes(), getDataOffset(), getDataLength());
                break;
            case TYPE_RESOURCE:
                dataStream.writeUTF(getResPackage());
                dataStream.writeInt(getResId());
                break;
            case TYPE_URI:
                dataStream.writeUTF(getUriString());
                break;
        }
    }

    private Icon(int mType) {
    private Icon(int mType) {
        this.mType = mType;
        this.mType = mType;
    }
    }


    /**
     * Create an Icon from the specified stream.
     *
     * @param stream The input stream from which to reconstruct the Icon.
     * @hide
     */
    public static Icon createFromStream(InputStream stream) throws IOException {
        DataInputStream inputStream = new DataInputStream(stream);

        final int version = inputStream.readInt();
        if (version >= VERSION_STREAM_SERIALIZER) {
            final int type = inputStream.readByte();
            switch (type) {
                case TYPE_BITMAP:
                    return createWithBitmap(BitmapFactory.decodeStream(inputStream));
                case TYPE_DATA:
                    final int length = inputStream.readInt();
                    final byte[] data = new byte[length];
                    inputStream.read(data, 0 /* offset */, length);
                    return createWithData(data, 0 /* offset */, length);
                case TYPE_RESOURCE:
                    final String packageName = inputStream.readUTF();
                    final int resId = inputStream.readInt();
                    return createWithResource(packageName, resId);
                case TYPE_URI:
                    final String uriOrPath = inputStream.readUTF();
                    return createWithContentUri(uriOrPath);
            }
        }
        return null;
    }

    /**
    /**
     * Create an Icon pointing to a drawable resource.
     * Create an Icon pointing to a drawable resource.
     * @param res Resources for a package containing the resource in question
     * @param res Resources for a package containing the resource in question
     * @param resId ID of the drawable resource
     * @param resId ID of the drawable resource
     */
     */
    public static Icon createWithResource(Resources res, @DrawableRes int resId) {
    public static Icon createWithResource(Resources res, @DrawableRes int resId) {
        if (res == null) {
            throw new IllegalArgumentException("Resource must not be null.");
        }
        final Icon rep = new Icon(TYPE_RESOURCE);
        final Icon rep = new Icon(TYPE_RESOURCE);
        rep.mObj1 = res;
        rep.mObj1 = res;
        rep.mInt1 = resId;
        rep.mInt1 = resId;
@@ -304,6 +372,9 @@ public final class Icon implements Parcelable {
     * @param resId ID of the drawable resource
     * @param resId ID of the drawable resource
     */
     */
    public static Icon createWithResource(String resPackage, @DrawableRes int resId) {
    public static Icon createWithResource(String resPackage, @DrawableRes int resId) {
        if (resPackage == null) {
            throw new IllegalArgumentException("Resource package name must not be null.");
        }
        final Icon rep = new Icon(TYPE_RESOURCE);
        final Icon rep = new Icon(TYPE_RESOURCE);
        rep.mInt1 = resId;
        rep.mInt1 = resId;
        rep.mString1 = resPackage;
        rep.mString1 = resPackage;
@@ -315,6 +386,9 @@ public final class Icon implements Parcelable {
     * @param bits A valid {@link android.graphics.Bitmap} object
     * @param bits A valid {@link android.graphics.Bitmap} object
     */
     */
    public static Icon createWithBitmap(Bitmap bits) {
    public static Icon createWithBitmap(Bitmap bits) {
        if (bits == null) {
            throw new IllegalArgumentException("Bitmap must not be null.");
        }
        final Icon rep = new Icon(TYPE_BITMAP);
        final Icon rep = new Icon(TYPE_BITMAP);
        rep.mObj1 = bits;
        rep.mObj1 = bits;
        return rep;
        return rep;
@@ -329,6 +403,9 @@ public final class Icon implements Parcelable {
     * @param length Length of the bitmap data
     * @param length Length of the bitmap data
     */
     */
    public static Icon createWithData(byte[] data, int offset, int length) {
    public static Icon createWithData(byte[] data, int offset, int length) {
        if (data == null) {
            throw new IllegalArgumentException("Data must not be null.");
        }
        final Icon rep = new Icon(TYPE_DATA);
        final Icon rep = new Icon(TYPE_DATA);
        rep.mObj1 = data;
        rep.mObj1 = data;
        rep.mInt1 = length;
        rep.mInt1 = length;
@@ -342,6 +419,9 @@ public final class Icon implements Parcelable {
     * @param uri A uri referring to local content:// or file:// image data.
     * @param uri A uri referring to local content:// or file:// image data.
     */
     */
    public static Icon createWithContentUri(String uri) {
    public static Icon createWithContentUri(String uri) {
        if (uri == null) {
            throw new IllegalArgumentException("Uri must not be null.");
        }
        final Icon rep = new Icon(TYPE_URI);
        final Icon rep = new Icon(TYPE_URI);
        rep.mString1 = uri;
        rep.mString1 = uri;
        return rep;
        return rep;
@@ -353,6 +433,9 @@ public final class Icon implements Parcelable {
     * @param uri A uri referring to local content:// or file:// image data.
     * @param uri A uri referring to local content:// or file:// image data.
     */
     */
    public static Icon createWithContentUri(Uri uri) {
    public static Icon createWithContentUri(Uri uri) {
        if (uri == null) {
            throw new IllegalArgumentException("Uri must not be null.");
        }
        final Icon rep = new Icon(TYPE_URI);
        final Icon rep = new Icon(TYPE_URI);
        rep.mString1 = uri.toString();
        rep.mString1 = uri.toString();
        return rep;
        return rep;
@@ -365,6 +448,9 @@ public final class Icon implements Parcelable {
     *           a type that {@link android.graphics.BitmapFactory} can decode.
     *           a type that {@link android.graphics.BitmapFactory} can decode.
     */
     */
    public static Icon createWithFilePath(String path) {
    public static Icon createWithFilePath(String path) {
        if (path == null) {
            throw new IllegalArgumentException("Path must not be null.");
        }
        final Icon rep = new Icon(TYPE_URI);
        final Icon rep = new Icon(TYPE_URI);
        rep.mString1 = path;
        rep.mString1 = path;
        return rep;
        return rep;
+32 −186
Original line number Original line Diff line number Diff line
@@ -26,6 +26,7 @@ import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
import android.net.Uri;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable;
@@ -127,6 +128,7 @@ public final class PhoneAccount implements Parcelable {


    /**
    /**
     * Indicating no icon tint is set.
     * Indicating no icon tint is set.
     * @hide
     */
     */
    public static final int NO_ICON_TINT = 0;
    public static final int NO_ICON_TINT = 0;


@@ -144,14 +146,11 @@ public final class PhoneAccount implements Parcelable {
    private final Uri mAddress;
    private final Uri mAddress;
    private final Uri mSubscriptionAddress;
    private final Uri mSubscriptionAddress;
    private final int mCapabilities;
    private final int mCapabilities;
    private final int mIconResId;
    private final String mIconPackageName;
    private final Bitmap mIconBitmap;
    private final int mIconTint;
    private final int mHighlightColor;
    private final int mHighlightColor;
    private final CharSequence mLabel;
    private final CharSequence mLabel;
    private final CharSequence mShortDescription;
    private final CharSequence mShortDescription;
    private final List<String> mSupportedUriSchemes;
    private final List<String> mSupportedUriSchemes;
    private final Icon mIcon;


    /**
    /**
     * Helper class for creating a {@link PhoneAccount}.
     * Helper class for creating a {@link PhoneAccount}.
@@ -161,14 +160,11 @@ public final class PhoneAccount implements Parcelable {
        private Uri mAddress;
        private Uri mAddress;
        private Uri mSubscriptionAddress;
        private Uri mSubscriptionAddress;
        private int mCapabilities;
        private int mCapabilities;
        private int mIconResId;
        private String mIconPackageName;
        private Bitmap mIconBitmap;
        private int mIconTint = NO_ICON_TINT;
        private int mHighlightColor = NO_HIGHLIGHT_COLOR;
        private int mHighlightColor = NO_HIGHLIGHT_COLOR;
        private CharSequence mLabel;
        private CharSequence mLabel;
        private CharSequence mShortDescription;
        private CharSequence mShortDescription;
        private List<String> mSupportedUriSchemes = new ArrayList<String>();
        private List<String> mSupportedUriSchemes = new ArrayList<String>();
        private Icon mIcon;


        /**
        /**
         * Creates a builder with the specified {@link PhoneAccountHandle} and label.
         * Creates a builder with the specified {@link PhoneAccountHandle} and label.
@@ -189,14 +185,11 @@ public final class PhoneAccount implements Parcelable {
            mAddress = phoneAccount.getAddress();
            mAddress = phoneAccount.getAddress();
            mSubscriptionAddress = phoneAccount.getSubscriptionAddress();
            mSubscriptionAddress = phoneAccount.getSubscriptionAddress();
            mCapabilities = phoneAccount.getCapabilities();
            mCapabilities = phoneAccount.getCapabilities();
            mIconResId = phoneAccount.getIconResId();
            mIconPackageName = phoneAccount.getIconPackageName();
            mIconBitmap = phoneAccount.getIconBitmap();
            mIconTint = phoneAccount.getIconTint();
            mHighlightColor = phoneAccount.getHighlightColor();
            mHighlightColor = phoneAccount.getHighlightColor();
            mLabel = phoneAccount.getLabel();
            mLabel = phoneAccount.getLabel();
            mShortDescription = phoneAccount.getShortDescription();
            mShortDescription = phoneAccount.getShortDescription();
            mSupportedUriSchemes.addAll(phoneAccount.getSupportedUriSchemes());
            mSupportedUriSchemes.addAll(phoneAccount.getSupportedUriSchemes());
            mIcon = phoneAccount.getIcon();
        }
        }


        /**
        /**
@@ -233,65 +226,12 @@ public final class PhoneAccount implements Parcelable {
        }
        }


        /**
        /**
         * Sets the icon. See {@link PhoneAccount#createIconDrawable}.
         * Sets the icon. See {@link PhoneAccount#getIcon}.
         *
         * @param packageContext The package from which to load an icon.
         * @param iconResId The resource in {@code iconPackageName} representing the icon.
         * @return The builder.
         */
        public Builder setIcon(Context packageContext, int iconResId) {
            return setIcon(packageContext.getPackageName(), iconResId);
        }

        /**
         * Sets the icon. See {@link PhoneAccount#createIconDrawable}.
         *
         * @param iconPackageName The package from which to load an icon.
         * @param iconResId The resource in {@code iconPackageName} representing the icon.
         * @return The builder.
         */
        public Builder setIcon(String iconPackageName, int iconResId) {
            return setIcon(iconPackageName, iconResId, NO_ICON_TINT);
        }

        /**
         * Sets the icon. See {@link PhoneAccount#createIconDrawable}.
         *
         *
         * @param packageContext The package from which to load an icon.
         * @param icon The icon to set.
         * @param iconResId The resource in {@code iconPackageName} representing the icon.
         * @param iconTint A color with which to tint this icon.
         * @return The builder.
         */
         */
        public Builder setIcon(Context packageContext, int iconResId, int iconTint) {
        public Builder setIcon(Icon icon) {
            return setIcon(packageContext.getPackageName(), iconResId, iconTint);
            mIcon = icon;
        }

        /**
         * Sets the icon. See {@link PhoneAccount#createIconDrawable}.
         *
         * @param iconPackageName The package from which to load an icon.
         * @param iconResId The resource in {@code iconPackageName} representing the icon.
         * @param iconTint A color with which to tint this icon.
         * @return The builder.
         */
        public Builder setIcon(String iconPackageName, int iconResId, int iconTint) {
            this.mIconPackageName = iconPackageName;
            this.mIconResId = iconResId;
            this.mIconTint = iconTint;
            return this;
        }

        /**
         * Sets the icon. See {@link PhoneAccount#createIconDrawable}.
         *
         * @param iconBitmap The icon bitmap.
         * @return The builder.
         */
        public Builder setIcon(Bitmap iconBitmap) {
            this.mIconBitmap = iconBitmap;
            this.mIconPackageName = null;
            this.mIconResId = NO_RESOURCE_ID;
            this.mIconTint = NO_ICON_TINT;
            return this;
            return this;
        }
        }


@@ -363,10 +303,7 @@ public final class PhoneAccount implements Parcelable {
                    mAddress,
                    mAddress,
                    mSubscriptionAddress,
                    mSubscriptionAddress,
                    mCapabilities,
                    mCapabilities,
                    mIconResId,
                    mIcon,
                    mIconPackageName,
                    mIconBitmap,
                    mIconTint,
                    mHighlightColor,
                    mHighlightColor,
                    mLabel,
                    mLabel,
                    mShortDescription,
                    mShortDescription,
@@ -379,10 +316,7 @@ public final class PhoneAccount implements Parcelable {
            Uri address,
            Uri address,
            Uri subscriptionAddress,
            Uri subscriptionAddress,
            int capabilities,
            int capabilities,
            int iconResId,
            Icon icon,
            String iconPackageName,
            Bitmap iconBitmap,
            int iconTint,
            int highlightColor,
            int highlightColor,
            CharSequence label,
            CharSequence label,
            CharSequence shortDescription,
            CharSequence shortDescription,
@@ -391,10 +325,7 @@ public final class PhoneAccount implements Parcelable {
        mAddress = address;
        mAddress = address;
        mSubscriptionAddress = subscriptionAddress;
        mSubscriptionAddress = subscriptionAddress;
        mCapabilities = capabilities;
        mCapabilities = capabilities;
        mIconResId = iconResId;
        mIcon = icon;
        mIconPackageName = iconPackageName;
        mIconBitmap = iconBitmap;
        mIconTint = iconTint;
        mHighlightColor = highlightColor;
        mHighlightColor = highlightColor;
        mLabel = label;
        mLabel = label;
        mShortDescription = shortDescription;
        mShortDescription = shortDescription;
@@ -496,6 +427,15 @@ public final class PhoneAccount implements Parcelable {
        return mSupportedUriSchemes;
        return mSupportedUriSchemes;
    }
    }


    /**
     * The icon to represent this {@code PhoneAccount}.
     *
     * @return The icon.
     */
    public Icon getIcon() {
        return mIcon;
    }

    /**
    /**
     * Determines if the {@link PhoneAccount} supports calls to/from addresses with a specified URI
     * Determines if the {@link PhoneAccount} supports calls to/from addresses with a specified URI
     * scheme.
     * scheme.
@@ -517,59 +457,6 @@ public final class PhoneAccount implements Parcelable {
        return false;
        return false;
    }
    }


    /**
     * The icon resource ID for the icon of this {@code PhoneAccount}.
     * <p>
     * Creators of a {@code PhoneAccount} who possess the icon in static resources should prefer
     * this method of indicating the icon rather than using {@link #getIconBitmap()}, since it
     * leads to less resource usage.
     * <p>
     * Clients wishing to display a {@code PhoneAccount} should use {@link #createIconDrawable(Context)}.
     *
     * @return A resource ID.
     */
    public int getIconResId() {
        return mIconResId;
    }

    /**
     * The package name from which to load the icon of this {@code PhoneAccount}.
     * <p>
     * If this property is {@code null}, the resource {@link #getIconResId()} will be loaded from
     * the package in the {@link ComponentName} of the {@link #getAccountHandle()}.
     * <p>
     * Clients wishing to display a {@code PhoneAccount} should use {@link #createIconDrawable(Context)}.
     *
     * @return A package name.
     */
    public String getIconPackageName() {
        return mIconPackageName;
    }

    /**
     * A tint to apply to the icon of this {@code PhoneAccount}.
     *
     * @return A hexadecimal color value.
     */
    public int getIconTint() {
        return mIconTint;
    }

    /**
     * A literal icon bitmap to represent this {@code PhoneAccount} in a user interface.
     * <p>
     * If this property is specified, it is to be considered the preferred icon. Otherwise, the
     * resource specified by {@link #getIconResId()} should be used.
     * <p>
     * Clients wishing to display a {@code PhoneAccount} should use
     * {@link #createIconDrawable(Context)}.
     *
     * @return A bitmap.
     */
    public Bitmap getIconBitmap() {
        return mIconBitmap;
    }

    /**
    /**
     * A highlight color to use in displaying information about this {@code PhoneAccount}.
     * A highlight color to use in displaying information about this {@code PhoneAccount}.
     *
     *
@@ -579,41 +466,6 @@ public final class PhoneAccount implements Parcelable {
        return mHighlightColor;
        return mHighlightColor;
    }
    }


    /**
     * Builds and returns an icon {@code Drawable} to represent this {@code PhoneAccount} in a user
     * interface. Uses the properties {@link #getIconResId()}, {@link #getIconPackageName()}, and
     * {@link #getIconBitmap()} as necessary.
     *
     * @param context A {@code Context} to use for loading {@code Drawable}s.
     *
     * @return An icon for this {@code PhoneAccount}.
     */
    public Drawable createIconDrawable(Context context) {
        if (mIconBitmap != null) {
            return new BitmapDrawable(context.getResources(), mIconBitmap);
        }

        if (mIconResId != 0) {
            try {
                Context packageContext = context.createPackageContext(mIconPackageName, 0);
                try {
                    Drawable iconDrawable = packageContext.getDrawable(mIconResId);
                    if (mIconTint != NO_ICON_TINT) {
                        iconDrawable.setTint(mIconTint);
                    }
                    return iconDrawable;
                } catch (NotFoundException | MissingResourceException e) {
                    Log.e(this, e, "Cannot find icon %d in package %s",
                            mIconResId, mIconPackageName);
                }
            } catch (PackageManager.NameNotFoundException e) {
                Log.w(this, "Cannot find package %s", mIconPackageName);
            }
        }

        return new ColorDrawable(Color.TRANSPARENT);
    }

    //
    //
    // Parcelable implementation
    // Parcelable implementation
    //
    //
@@ -644,19 +496,16 @@ public final class PhoneAccount implements Parcelable {
            mSubscriptionAddress.writeToParcel(out, flags);
            mSubscriptionAddress.writeToParcel(out, flags);
        }
        }
        out.writeInt(mCapabilities);
        out.writeInt(mCapabilities);
        out.writeInt(mIconResId);
        out.writeString(mIconPackageName);
        if (mIconBitmap == null) {
            out.writeInt(0);
        } else {
            out.writeInt(1);
            mIconBitmap.writeToParcel(out, flags);
        }
        out.writeInt(mIconTint);
        out.writeInt(mHighlightColor);
        out.writeInt(mHighlightColor);
        out.writeCharSequence(mLabel);
        out.writeCharSequence(mLabel);
        out.writeCharSequence(mShortDescription);
        out.writeCharSequence(mShortDescription);
        out.writeStringList(mSupportedUriSchemes);
        out.writeStringList(mSupportedUriSchemes);
        if (mIcon == null) {
            out.writeInt(0);
        } else {
            out.writeInt(1);
            mIcon.writeToParcel(out, flags);
        }
    }
    }


    public static final Creator<PhoneAccount> CREATOR
    public static final Creator<PhoneAccount> CREATOR
@@ -689,18 +538,15 @@ public final class PhoneAccount implements Parcelable {
            mSubscriptionAddress = null;
            mSubscriptionAddress = null;
        }
        }
        mCapabilities = in.readInt();
        mCapabilities = in.readInt();
        mIconResId = in.readInt();
        mIconPackageName = in.readString();
        if (in.readInt() > 0) {
            mIconBitmap = Bitmap.CREATOR.createFromParcel(in);
        } else {
            mIconBitmap = null;
        }
        mIconTint = in.readInt();
        mHighlightColor = in.readInt();
        mHighlightColor = in.readInt();
        mLabel = in.readCharSequence();
        mLabel = in.readCharSequence();
        mShortDescription = in.readCharSequence();
        mShortDescription = in.readCharSequence();
        mSupportedUriSchemes = Collections.unmodifiableList(in.createStringArrayList());
        mSupportedUriSchemes = Collections.unmodifiableList(in.createStringArrayList());
        if (in.readInt() > 0) {
            mIcon = Icon.CREATOR.createFromParcel(in);
        } else {
            mIcon = null;
        }
    }
    }


    @Override
    @Override