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

import X.0CB;
import X.0CH;
import X.0CN;
import X.1hK;
import X.6Is;
import X.M12;
import android.database.ContentObserver;
import android.os.Handler;
import android.view.Window;
import android.view.WindowManager;
import com.bytedance.covode.number.Covode;
import kotlin.h.b.n;

public final class LifecycleContentObserver extends ContentObserver implements 6Is {
    public final 1hK LIZ;
    public boolean LIZIZ;

    static {
        Covode.recordClassIndex(100841);
    }

    public final void onStateChanged(0CH r2, 0CB r3) {
        if (r3 == 0CB.ON_DESTROY) {
            onDestroy();
        }
    }

    @0CN(LIZ = 0CB.ON_DESTROY)
    public final void onDestroy() {
        LIZ();
    }

    private final void LIZ() {
        if (!this.LIZIZ) {
            this.LIZIZ = true;
            this.LIZ.getLifecycle().LIZIZ(this);
            this.LIZ.getContentResolver().unregisterContentObserver(this);
        }
    }

    public final void onChange(boolean z) {
        super.onChange(z);
        Window window = this.LIZ.getWindow();
        n.LIZIZ(window, "");
        Window window2 = this.LIZ.getWindow();
        n.LIZIZ(window2, "");
        WindowManager.LayoutParams attributes = window2.getAttributes();
        attributes.screenBrightness = 2.0f;
        window.setAttributes(attributes);
        LIZ();
    }

    /* JADX INFO: super call moved to the top of the method (can break code semantics) */
    public LifecycleContentObserver(1hK r3, Handler handler) {
        super(handler);
        M12.LIZ((Object) r3, (Object) handler);
        this.LIZ = r3;
        r3.getLifecycle().LIZ(this);
    }
}
