package ඓ.ῲ.K.㑃;

import android.annotation.TargetApi;
import android.app.Activity;
import android.app.Fragment;
import android.os.Build;
import android.util.Log;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import ඓ.ῲ.K.ComponentCallbacks2C1161;
import ඓ.ῲ.K.ComponentCallbacks2C1163;

@Deprecated
/* renamed from: ඓ.ῲ.K.㑃.ᕣ  reason: contains not printable characters */
/* compiled from: RequestManagerFragment */
public class FragmentC1173 extends Fragment {

    /* renamed from: ʬ  reason: contains not printable characters */
    public final AbstractC1188 f4702 = new C1174();

    /* renamed from: ඓ  reason: contains not printable characters */
    public ComponentCallbacks2C1163 f4703;

    /* renamed from: ῲ  reason: contains not printable characters */
    public final C1178 f4704;

    /* renamed from: ⁱ  reason: contains not printable characters */
    public Fragment f4705;

    /* renamed from: 㴹  reason: contains not printable characters */
    public FragmentC1173 f4706;

    /* renamed from: 㸾  reason: contains not printable characters */
    public final Set<FragmentC1173> f4707 = new HashSet();

    /* renamed from: ඓ.ῲ.K.㑃.ᕣ$K  reason: contains not printable characters */
    /* compiled from: RequestManagerFragment */
    public class C1174 implements AbstractC1188 {
        public C1174() {
        }

        public String toString() {
            return super.toString() + "{fragment=" + FragmentC1173.this + "}";
        }

        @Override // ඓ.ῲ.K.㑃.AbstractC1188
        /* renamed from: K  reason: contains not printable characters */
        public Set<ComponentCallbacks2C1163> m3140() {
            Set<FragmentC1173> r0 = FragmentC1173.this.m3138();
            HashSet hashSet = new HashSet(r0.size());
            for (FragmentC1173 r2 : r0) {
                ComponentCallbacks2C1163 r22 = r2.f4703;
                if (r22 != null) {
                    hashSet.add(r22);
                }
            }
            return hashSet;
        }
    }

    public FragmentC1173() {
        C1178 k = new C1178();
        this.f4704 = k;
    }

    @Override // android.app.Fragment
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        try {
            m3139(activity);
        } catch (IllegalStateException e) {
            if (Log.isLoggable("RMFragment", 5)) {
                Log.w("RMFragment", "Unable to register fragment with root", e);
            }
        }
    }

    public void onDestroy() {
        super.onDestroy();
        this.f4704.m3149();
        m3136();
    }

    public void onDetach() {
        super.onDetach();
        m3136();
    }

    public void onStart() {
        super.onStart();
        this.f4704.m3147();
    }

    public void onStop() {
        super.onStop();
        this.f4704.m3146();
    }

    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(super.toString());
        sb.append("{parent=");
        int i = Build.VERSION.SDK_INT;
        Fragment parentFragment = getParentFragment();
        if (parentFragment == null) {
            parentFragment = this.f4705;
        }
        sb.append(parentFragment);
        sb.append("}");
        return sb.toString();
    }

    /* renamed from: ʬ  reason: contains not printable characters */
    public final void m3136() {
        FragmentC1173 r0 = this.f4706;
        if (r0 != null) {
            r0.f4707.remove(this);
            this.f4706 = null;
        }
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public C1178 m3137() {
        return this.f4704;
    }

    @TargetApi(17)
    /* renamed from: K  reason: contains not printable characters */
    public Set<FragmentC1173> m3138() {
        boolean z;
        if (equals(this.f4706)) {
            return Collections.unmodifiableSet(this.f4707);
        }
        if (this.f4706 == null) {
            return Collections.emptySet();
        }
        int i = Build.VERSION.SDK_INT;
        HashSet hashSet = new HashSet();
        for (FragmentC1173 r2 : this.f4706.m3138()) {
            Fragment parentFragment = r2.getParentFragment();
            Fragment parentFragment2 = getParentFragment();
            while (true) {
                Fragment parentFragment3 = parentFragment.getParentFragment();
                if (parentFragment3 == null) {
                    z = false;
                    break;
                } else if (parentFragment3.equals(parentFragment2)) {
                    z = true;
                    break;
                } else {
                    parentFragment = parentFragment.getParentFragment();
                }
            }
            if (z) {
                hashSet.add(r2);
            }
        }
        return Collections.unmodifiableSet(hashSet);
    }

    /* renamed from: K  reason: contains not printable characters */
    public final void m3139(Activity activity) {
        m3136();
        this.f4706 = ComponentCallbacks2C1161.m3105(activity).f4671.m3157(activity);
        if (!equals(this.f4706)) {
            this.f4706.f4707.add(this);
        }
    }
}
