package androidx.activity.result;

import android.content.Intent;
import android.os.Parcel;
import android.os.Parcelable;
import com.bytedance.covode.number.Covode;

public final class ActivityResult implements Parcelable {
    public static final Parcelable.Creator<ActivityResult> CREATOR = new Parcelable.Creator<ActivityResult>() {
        static {
            Covode.recordClassIndex(238);
        }

        public final /* bridge */ /* synthetic */ Object[] newArray(int i) {
            return new ActivityResult[i];
        }

        public final /* synthetic */ Object createFromParcel(Parcel parcel) {
            return new ActivityResult(parcel);
        }
    };
    public final int LIZ;
    public final Intent LIZIZ;

    public final int describeContents() {
        return 0;
    }

    static {
        Covode.recordClassIndex(237);
    }

    public final String toString() {
        String str;
        StringBuilder sb = new StringBuilder("ActivityResult{resultCode=");
        int i = this.LIZ;
        if (i == -1) {
            str = "RESULT_OK";
        } else if (i != 0) {
            str = String.valueOf(i);
        } else {
            str = "RESULT_CANCELED";
        }
        sb.append(str);
        sb.append(", data=");
        sb.append(this.LIZIZ);
        sb.append('}');
        return sb.toString();
    }

    public ActivityResult(Parcel parcel) {
        Intent intent;
        this.LIZ = parcel.readInt();
        if (parcel.readInt() == 0) {
            intent = null;
        } else {
            intent = (Intent) Intent.CREATOR.createFromParcel(parcel);
        }
        this.LIZIZ = intent;
    }

    public ActivityResult(int i, Intent intent) {
        this.LIZ = i;
        this.LIZIZ = intent;
    }

    public final void writeToParcel(Parcel parcel, int i) {
        int i2;
        parcel.writeInt(this.LIZ);
        if (this.LIZIZ == null) {
            i2 = 0;
        } else {
            i2 = 1;
        }
        parcel.writeInt(i2);
        Intent intent = this.LIZIZ;
        if (intent != null) {
            intent.writeToParcel(parcel, i);
        }
    }
}
