@Override
    public void onPreParceling(boolean isStream) {
        mTintModeStr = mTintMode.name();
        switch (mType) {
            case TYPE_UNKNOWN:
                if (isStream) {
                    // We can't determine how to serialize this icon, so throw so the caller knows.
                    throw new IllegalArgumentException("Can't serialize Icon created with "
                            + "IconCompat#createFromIcon");
                } else {
                    mParcelable = (Parcelable) mObj1;
                }
                break;
            case TYPE_ADAPTIVE_BITMAP:
            case TYPE_BITMAP:
                if (isStream) {
                    Bitmap bitmap = (Bitmap) mObj1;
                    ByteArrayOutputStream data = new ByteArrayOutputStream();
                    bitmap.compress(Bitmap.CompressFormat.PNG, 90, data);
                    mData = data.toByteArray();
                } else {
                    mParcelable = (Parcelable) mObj1;
                }
                break;
            case TYPE_URI:
                mData = mObj1.toString().getBytes(Charset.forName("UTF-16"));
                break;
            case TYPE_RESOURCE:
                mData = ((String) mObj1).getBytes(Charset.forName("UTF-16"));
                break;
            case TYPE_DATA:
                mData = (byte[]) mObj1;
                break;
        }
    }
Adds this Icon to a Bundle that can be read back with the same parameters
to {@link #createFromBundle(Bundle)}.
android/android_framework/base/src/main/java/github/tornaco/android/thanos/core/compat/IconCompat.java