Java Code Examples for android.os.Parcel#readTypedObject()

The following examples show how to use android.os.Parcel#readTypedObject() . These examples are extracted from open source projects. 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 Project: android_9.0.0_r45   File: AdvertiseData.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public AdvertiseData createFromParcel(Parcel in) {
    Builder builder = new Builder();
    ArrayList<ParcelUuid> uuids = in.createTypedArrayList(ParcelUuid.CREATOR);
    for (ParcelUuid uuid : uuids) {
        builder.addServiceUuid(uuid);
    }

    int manufacturerSize = in.readInt();
    for (int i = 0; i < manufacturerSize; ++i) {
        int manufacturerId = in.readInt();
        byte[] manufacturerData = in.createByteArray();
        builder.addManufacturerData(manufacturerId, manufacturerData);
    }
    int serviceDataSize = in.readInt();
    for (int i = 0; i < serviceDataSize; ++i) {
        ParcelUuid serviceDataUuid = in.readTypedObject(ParcelUuid.CREATOR);
        byte[] serviceData = in.createByteArray();
        builder.addServiceData(serviceDataUuid, serviceData);
    }
    builder.setIncludeTxPowerLevel(in.readByte() == 1);
    builder.setIncludeDeviceName(in.readByte() == 1);
    return builder.build();
}
 
Example 2
Source Project: android_9.0.0_r45   File: RemoteViews.java    License: Apache License 2.0 6 votes vote down vote up
public TextViewDrawableAction(Parcel parcel) {
    viewId = parcel.readInt();
    isRelative = (parcel.readInt() != 0);
    useIcons = (parcel.readInt() != 0);
    if (useIcons) {
        i1 = parcel.readTypedObject(Icon.CREATOR);
        i2 = parcel.readTypedObject(Icon.CREATOR);
        i3 = parcel.readTypedObject(Icon.CREATOR);
        i4 = parcel.readTypedObject(Icon.CREATOR);
    } else {
        d1 = parcel.readInt();
        d2 = parcel.readInt();
        d3 = parcel.readInt();
        d4 = parcel.readInt();
    }
}
 
Example 3
/**
 * Unflatten the AppWidgetProviderInfo from a parcel.
 */
@SuppressWarnings("deprecation")
public AppWidgetProviderInfo(Parcel in) {
    this.provider = in.readTypedObject(ComponentName.CREATOR);
    this.minWidth = in.readInt();
    this.minHeight = in.readInt();
    this.minResizeWidth = in.readInt();
    this.minResizeHeight = in.readInt();
    this.updatePeriodMillis = in.readInt();
    this.initialLayout = in.readInt();
    this.initialKeyguardLayout = in.readInt();
    this.configure = in.readTypedObject(ComponentName.CREATOR);
    this.label = in.readString();
    this.icon = in.readInt();
    this.previewImage = in.readInt();
    this.autoAdvanceViewId = in.readInt();
    this.resizeMode = in.readInt();
    this.widgetCategory = in.readInt();
    this.providerInfo = in.readTypedObject(ActivityInfo.CREATOR);
    this.widgetFeatures = in.readInt();
}
 
Example 4
/**
 * @hide
 */
protected KeyChainSnapshot(Parcel in) {
    mSnapshotVersion = in.readInt();
    mKeyChainProtectionParams = in.createTypedArrayList(KeyChainProtectionParams.CREATOR);
    mEncryptedRecoveryKeyBlob = in.createByteArray();
    mEntryRecoveryData = in.createTypedArrayList(WrappedApplicationKey.CREATOR);
    mMaxAttempts = in.readInt();
    mCounterId = in.readLong();
    mServerParams = in.createByteArray();
    mCertPath = in.readTypedObject(RecoveryCertPath.CREATOR);
}
 
Example 5
/**
 * @hide
 */
protected KeyChainProtectionParams(Parcel in) {
    mUserSecretType = in.readInt();
    mLockScreenUiFormat = in.readInt();
    mKeyDerivationParams = in.readTypedObject(KeyDerivationParams.CREATOR);
    mSecret = in.createByteArray();
}
 
Example 6
Source Project: android_9.0.0_r45   File: DisplayCutout.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Reads a DisplayCutout from a {@link Parcel}.
 *
 * @see #writeCutoutToParcel(DisplayCutout, Parcel, int)
 */
public static DisplayCutout readCutoutFromParcel(Parcel in) {
    int variant = in.readInt();
    if (variant == -1) {
        return null;
    }
    if (variant == 0) {
        return NO_CUTOUT;
    }

    Rect safeInsets = in.readTypedObject(Rect.CREATOR);
    Region bounds = in.readTypedObject(Region.CREATOR);

    return new DisplayCutout(safeInsets, bounds, false /* copyArguments */);
}
 
Example 7
public RemoteAnimationDefinition(Parcel in) {
    final int size = in.readInt();
    mTransitionAnimationMap = new SparseArray<>(size);
    for (int i = 0; i < size; i++) {
        final int transition = in.readInt();
        final RemoteAnimationAdapterEntry entry = in.readTypedObject(
                RemoteAnimationAdapterEntry.CREATOR);
        mTransitionAnimationMap.put(transition, entry);
    }
}
 
Example 8
public BluetoothCodecStatus createFromParcel(Parcel in) {
    final BluetoothCodecConfig codecConfig = in.readTypedObject(
            BluetoothCodecConfig.CREATOR);
    final BluetoothCodecConfig[] codecsLocalCapabilities = in.createTypedArray(
            BluetoothCodecConfig.CREATOR);
    final BluetoothCodecConfig[] codecsSelectableCapabilities = in.createTypedArray(
            BluetoothCodecConfig.CREATOR);

    return new BluetoothCodecStatus(codecConfig,
            codecsLocalCapabilities,
            codecsSelectableCapabilities);
}
 
Example 9
Source Project: android_9.0.0_r45   File: Slice.java    License: Apache License 2.0 5 votes vote down vote up
protected Slice(Parcel in) {
    mHints = in.readStringArray();
    int n = in.readInt();
    mItems = new SliceItem[n];
    for (int i = 0; i < n; i++) {
        mItems[i] = SliceItem.CREATOR.createFromParcel(in);
    }
    mUri = Uri.CREATOR.createFromParcel(in);
    mSpec = in.readTypedObject(SliceSpec.CREATOR);
}
 
Example 10
private ProgramSelector(Parcel in) {
    mProgramType = in.readInt();
    mPrimaryId = in.readTypedObject(Identifier.CREATOR);
    mSecondaryIds = in.createTypedArray(Identifier.CREATOR);
    if (Stream.of(mSecondaryIds).anyMatch(id -> id == null)) {
        throw new IllegalArgumentException("secondaryIds list must not contain nulls");
    }
    mVendorIds = in.createLongArray();
}
 
Example 11
Source Project: android_9.0.0_r45   File: RadioManager.java    License: Apache License 2.0 5 votes vote down vote up
private ProgramInfo(Parcel in) {
    mSelector = Objects.requireNonNull(in.readTypedObject(ProgramSelector.CREATOR));
    mLogicallyTunedTo = in.readTypedObject(ProgramSelector.Identifier.CREATOR);
    mPhysicallyTunedTo = in.readTypedObject(ProgramSelector.Identifier.CREATOR);
    mRelatedContent = in.createTypedArrayList(ProgramSelector.Identifier.CREATOR);
    mInfoFlags = in.readInt();
    mSignalQuality = in.readInt();
    mMetadata = in.readTypedObject(RadioMetadata.CREATOR);
    mVendorInfo = Utils.readStringMap(in);
}
 
Example 12
private WebViewProviderResponse(Parcel in) {
    packageInfo = in.readTypedObject(PackageInfo.CREATOR);
    status = in.readInt();
}
 
Example 13
/** Read from Parcel. */
private PipModeChangeItem(Parcel in) {
    mIsInPipMode = in.readBoolean();
    mOverrideConfig = in.readTypedObject(Configuration.CREATOR);
}
 
Example 14
/** Read from Parcel. */
private ConfigurationChangeItem(Parcel in) {
    mConfiguration = in.readTypedObject(Configuration.CREATOR);
}
 
Example 15
/** Read from Parcel. */
private ActivityConfigurationChangeItem(Parcel in) {
    mConfiguration = in.readTypedObject(Configuration.CREATOR);
}
 
Example 16
/** Read from Parcel. */
private MoveToDisplayItem(Parcel in) {
    mTargetDisplayId = in.readInt();
    mConfiguration = in.readTypedObject(Configuration.CREATOR);
}
 
Example 17
/** Read from Parcel. */
private MultiWindowModeChangeItem(Parcel in) {
    mIsInMultiWindowMode = in.readBoolean();
    mOverrideConfig = in.readTypedObject(Configuration.CREATOR);
}
 
Example 18
Source Project: android_9.0.0_r45   File: RemoteViews.java    License: Apache License 2.0 4 votes vote down vote up
ReflectionAction(Parcel in) {
    this.viewId = in.readInt();
    this.methodName = in.readString();
    this.type = in.readInt();
    //noinspection ConstantIfStatement
    if (false) {
        Log.d(LOG_TAG, "read viewId=0x" + Integer.toHexString(this.viewId)
                + " methodName=" + this.methodName + " type=" + this.type);
    }

    // For some values that may have been null, we first check a flag to see if they were
    // written to the parcel.
    switch (this.type) {
        case BOOLEAN:
            this.value = in.readBoolean();
            break;
        case BYTE:
            this.value = in.readByte();
            break;
        case SHORT:
            this.value = (short)in.readInt();
            break;
        case INT:
            this.value = in.readInt();
            break;
        case LONG:
            this.value = in.readLong();
            break;
        case FLOAT:
            this.value = in.readFloat();
            break;
        case DOUBLE:
            this.value = in.readDouble();
            break;
        case CHAR:
            this.value = (char)in.readInt();
            break;
        case STRING:
            this.value = in.readString();
            break;
        case CHAR_SEQUENCE:
            this.value = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
            break;
        case URI:
            this.value = in.readTypedObject(Uri.CREATOR);
            break;
        case BITMAP:
            this.value = in.readTypedObject(Bitmap.CREATOR);
            break;
        case BUNDLE:
            this.value = in.readBundle();
            break;
        case INTENT:
            this.value = in.readTypedObject(Intent.CREATOR);
            break;
        case COLOR_STATE_LIST:
            this.value = in.readTypedObject(ColorStateList.CREATOR);
            break;
        case ICON:
            this.value = in.readTypedObject(Icon.CREATOR);
        default:
            break;
    }
}
 
Example 19
Source Project: android_9.0.0_r45   File: Announcement.java    License: Apache License 2.0 4 votes vote down vote up
private Announcement(@NonNull Parcel in) {
    mSelector = in.readTypedObject(ProgramSelector.CREATOR);
    mType = in.readInt();
    mVendorInfo = Utils.readStringMap(in);
}
 
Example 20
Source Project: android_9.0.0_r45   File: RemoteViews.java    License: Apache License 2.0 4 votes vote down vote up
public SetRemoteViewsAdapterIntent(Parcel parcel) {
    viewId = parcel.readInt();
    intent = parcel.readTypedObject(Intent.CREATOR);
}