package android.support.v4.app;

import android.content.Context;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;

/* JADX INFO: compiled from: FragmentState.java */
/* JADX INFO: loaded from: classes.dex */
final class n implements Parcelable {
    public static final Parcelable.Creator<n> CREATOR = new a();

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    final String f584b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    final int f585c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    final boolean f586d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    final int f587e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    final int f588f;
    final String g;
    final boolean h;
    final boolean i;
    final Bundle j;
    final boolean k;
    Bundle l;
    e m;

    /* JADX INFO: compiled from: FragmentState.java */
    static class a implements Parcelable.Creator<n> {
        a() {
        }

        @Override // android.os.Parcelable.Creator
        /* JADX INFO: renamed from: a, reason: merged with bridge method [inline-methods] */
        public n createFromParcel(Parcel parcel) {
            return new n(parcel);
        }

        @Override // android.os.Parcelable.Creator
        /* JADX INFO: renamed from: b, reason: merged with bridge method [inline-methods] */
        public n[] newArray(int i) {
            return new n[i];
        }
    }

    n(e eVar) {
        this.f584b = eVar.getClass().getName();
        this.f585c = eVar.f518f;
        this.f586d = eVar.n;
        this.f587e = eVar.y;
        this.f588f = eVar.z;
        this.g = eVar.A;
        this.h = eVar.D;
        this.i = eVar.C;
        this.j = eVar.h;
        this.k = eVar.B;
    }

    public e a(i iVar, g gVar, e eVar, l lVar, android.arch.lifecycle.p pVar) {
        if (this.m == null) {
            Context contextE = iVar.e();
            Bundle bundle = this.j;
            if (bundle != null) {
                bundle.setClassLoader(contextE.getClassLoader());
            }
            if (gVar != null) {
                this.m = gVar.a(contextE, this.f584b, this.j);
            } else {
                this.m = e.E(contextE, this.f584b, this.j);
            }
            Bundle bundle2 = this.l;
            if (bundle2 != null) {
                bundle2.setClassLoader(contextE.getClassLoader());
                this.m.f515c = this.l;
            }
            this.m.V0(this.f585c, eVar);
            e eVar2 = this.m;
            eVar2.n = this.f586d;
            eVar2.p = true;
            eVar2.y = this.f587e;
            eVar2.z = this.f588f;
            eVar2.A = this.g;
            eVar2.D = this.h;
            eVar2.C = this.i;
            eVar2.B = this.k;
            eVar2.s = iVar.f541d;
            if (k.F) {
                Log.v("FragmentManager", "Instantiated fragment " + this.m);
            }
        }
        e eVar3 = this.m;
        eVar3.v = lVar;
        eVar3.w = pVar;
        return eVar3;
    }

    @Override // android.os.Parcelable
    public int describeContents() {
        return 0;
    }

    @Override // android.os.Parcelable
    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeString(this.f584b);
        parcel.writeInt(this.f585c);
        parcel.writeInt(this.f586d ? 1 : 0);
        parcel.writeInt(this.f587e);
        parcel.writeInt(this.f588f);
        parcel.writeString(this.g);
        parcel.writeInt(this.h ? 1 : 0);
        parcel.writeInt(this.i ? 1 : 0);
        parcel.writeBundle(this.j);
        parcel.writeInt(this.k ? 1 : 0);
        parcel.writeBundle(this.l);
    }

    n(Parcel parcel) {
        this.f584b = parcel.readString();
        this.f585c = parcel.readInt();
        this.f586d = parcel.readInt() != 0;
        this.f587e = parcel.readInt();
        this.f588f = parcel.readInt();
        this.g = parcel.readString();
        this.h = parcel.readInt() != 0;
        this.i = parcel.readInt() != 0;
        this.j = parcel.readBundle();
        this.k = parcel.readInt() != 0;
        this.l = parcel.readBundle();
    }
}
