package com.ss.android.ugc.aweme.base;

import X.0CB;
import X.0CH;
import X.1hT;
import android.os.Handler;
import android.os.Looper;
import com.bytedance.covode.number.Covode;

public class SafeHandler extends Handler implements 1hT {
    public final 0CH LIZ;

    static {
        Covode.recordClassIndex(54113);
    }

    /* renamed from: com.ss.android.ugc.aweme.base.SafeHandler$1  reason: invalid class name */
    public static /* synthetic */ class AnonymousClass1 {
        public static final /* synthetic */ int[] LIZ;

        static {
            Covode.recordClassIndex(54114);
            int[] iArr = new int[0CB.values().length];
            LIZ = iArr;
            try {
                iArr[0CB.ON_DESTROY.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
        }
    }

    public SafeHandler(0CH r2) {
        super(Looper.getMainLooper());
        this.LIZ = r2;
        if (r2 != null) {
            r2.getLifecycle().LIZ(this);
        }
    }

    public void onStateChanged(0CH r3, 0CB r4) {
        if (AnonymousClass1.LIZ[r4.ordinal()] == 1) {
            removeCallbacksAndMessages((Object) null);
            0CH r0 = this.LIZ;
            if (r0 != null) {
                r0.getLifecycle().LIZIZ(this);
            }
        }
    }
}
