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

import X.0CB;
import X.0CH;
import X.0CN;
import X.6Is;
import X.C2449RyP;
import X.S60;
import android.app.Activity;
import android.os.Bundle;
import com.bytedance.covode.number.Covode;

public abstract class BasePasswordService implements 6Is, S60 {
    public boolean mKeepCallback;
    public 0CH mLifeOwner;
    public C2449RyP mResult;

    static {
        Covode.recordClassIndex(105023);
    }

    public S60 keepCallback() {
        this.mKeepCallback = true;
        return this;
    }

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

    public void setPasswordForMT(Activity activity, String str, String str2, String str3, Bundle bundle, C2449RyP ryP) {
    }

    @0CN(LIZ = 0CB.ON_DESTROY)
    public void onDestroy() {
        0CH r0 = this.mLifeOwner;
        if (r0 != null) {
            r0.getLifecycle().LIZIZ(this);
        }
        this.mResult = null;
        this.mLifeOwner = null;
    }

    public void returnResult(int i, int i2, Object obj) {
        C2449RyP ryP = this.mResult;
        if (ryP != null) {
            ryP.onResult(i, i2, obj);
            this.mResult = null;
        }
    }

    public void setPassword(Activity activity, Bundle bundle, C2449RyP ryP) {
        this.mResult = ryP;
        if (!this.mKeepCallback && (activity instanceof 0CH)) {
            0CH r2 = (0CH) activity;
            this.mLifeOwner = r2;
            r2.getLifecycle().LIZ(this);
        }
        this.mKeepCallback = false;
    }

    public void verifyPassword(Activity activity, String str, Bundle bundle, C2449RyP ryP) {
        this.mResult = ryP;
        if (!this.mKeepCallback && (activity instanceof 0CH)) {
            0CH r2 = (0CH) activity;
            this.mLifeOwner = r2;
            r2.getLifecycle().LIZ(this);
        }
        this.mKeepCallback = false;
    }

    public void changePassword(Activity activity, String str, String str2, Bundle bundle, C2449RyP ryP) {
        this.mResult = ryP;
        if (!this.mKeepCallback && (activity instanceof 0CH)) {
            0CH r2 = (0CH) activity;
            this.mLifeOwner = r2;
            r2.getLifecycle().LIZ(this);
        }
        this.mKeepCallback = false;
    }
}
