android.os.ParcelFormatException Java Examples

The following examples show how to use android.os.ParcelFormatException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KeymasterArgument.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@Override
public KeymasterArgument createFromParcel(Parcel in) {
    final int pos = in.dataPosition();
    final int tag = in.readInt();
    switch (KeymasterDefs.getTagType(tag)) {
        case KeymasterDefs.KM_ENUM:
        case KeymasterDefs.KM_ENUM_REP:
        case KeymasterDefs.KM_UINT:
        case KeymasterDefs.KM_UINT_REP:
            return new KeymasterIntArgument(tag, in);
        case KeymasterDefs.KM_ULONG:
        case KeymasterDefs.KM_ULONG_REP:
            return new KeymasterLongArgument(tag, in);
        case KeymasterDefs.KM_DATE:
            return new KeymasterDateArgument(tag, in);
        case KeymasterDefs.KM_BYTES:
        case KeymasterDefs.KM_BIGNUM:
            return new KeymasterBlobArgument(tag, in);
        case KeymasterDefs.KM_BOOL:
            return new KeymasterBooleanArgument(tag, in);
        default:
            throw new ParcelFormatException("Bad tag: " + tag + " at " + pos);
    }
}
 
Example #2
Source File: NetworkEvent.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
public NetworkEvent createFromParcel(Parcel in) {
    final int initialPosition = in.dataPosition();
    final int parcelToken = in.readInt();
    // we need to move back to the position from before we read parcelToken
    in.setDataPosition(initialPosition);
    switch (parcelToken) {
        case PARCEL_TOKEN_DNS_EVENT:
            return DnsEvent.CREATOR.createFromParcel(in);
        case PARCEL_TOKEN_CONNECT_EVENT:
            return ConnectEvent.CREATOR.createFromParcel(in);
        default:
            throw new ParcelFormatException("Unexpected NetworkEvent token in parcel: "
                    + parcelToken);
    }
}
 
Example #3
Source File: Entry.java    From StockChart-MPAndroidChart with MIT License 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeFloat(this.x);
    dest.writeFloat(this.getY());
    if (getData() != null) {
        if (getData() instanceof Parcelable) {
            dest.writeInt(1);
            dest.writeParcelable((Parcelable) this.getData(), flags);
        } else {
            throw new ParcelFormatException("Cannot parcel an Entry with non-parcelable data");
        }
    } else {
        dest.writeInt(0);
    }
}
 
Example #4
Source File: Entry.java    From Ticket-Analysis with MIT License 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeFloat(this.x);
    dest.writeFloat(this.getY());
    if (getData() != null) {
        if (getData() instanceof Parcelable) {
            dest.writeInt(1);
            dest.writeParcelable((Parcelable) this.getData(), flags);
        } else {
            throw new ParcelFormatException("Cannot parcel an Entry with non-parcelable data");
        }
    } else {
        dest.writeInt(0);
    }
}
 
Example #5
Source File: Entry.java    From android-kline with Apache License 2.0 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeFloat(this.x);
    dest.writeFloat(this.getY());
    if (getData() != null) {
        if (getData() instanceof Parcelable) {
            dest.writeInt(1);
            dest.writeParcelable((Parcelable) this.getData(), flags);
        } else {
            throw new ParcelFormatException("Cannot parcel an Entry with non-parcelable data");
        }
    } else {
        dest.writeInt(0);
    }
}
 
Example #6
Source File: Entry.java    From Stayfit with Apache License 2.0 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeFloat(this.mVal);
    dest.writeInt(this.mXIndex);
    if (mData != null) {
        if (mData instanceof Parcelable) {
            dest.writeInt(1);
            dest.writeParcelable((Parcelable) this.mData, flags);
        } else {
            throw new ParcelFormatException("Cannot parcel an Entry with non-parcelable data");
        }
    } else {
        dest.writeInt(0);
    }
}
 
Example #7
Source File: Entry.java    From NetKnight with Apache License 2.0 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeFloat(this.mVal);
    dest.writeInt(this.mXIndex);
    if (mData != null) {
        if (mData instanceof Parcelable) {
            dest.writeInt(1);
            dest.writeParcelable((Parcelable) this.mData, flags);
        } else {
            throw new ParcelFormatException("Cannot parcel an Entry with non-parcelable data");
        }
    } else {
        dest.writeInt(0);
    }
}
 
Example #8
Source File: Entry.java    From JNChartDemo with Apache License 2.0 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeFloat(this.mVal);
    dest.writeInt(this.mXIndex);
    if (mData != null) {
        if (mData instanceof Parcelable) {
            dest.writeInt(1);
            dest.writeParcelable((Parcelable) this.mData, flags);
        } else {
            throw new ParcelFormatException("Cannot parcel an Entry with non-parcelable data");
        }
    } else {
        dest.writeInt(0);
    }
}