package com.android.billingclient.api;

import android.app.Activity;
import android.app.PendingIntent;
import android.content.Intent;
import android.content.IntentSender;
import android.os.Bundle;
import android.os.ResultReceiver;
import p138.p139.p140.p142.C2802;

/* JADX INFO: loaded from: classes.dex */
public class ProxyBillingActivity extends Activity {

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public ResultReceiver f1505;

    @Override // android.app.Activity
    public void onActivityResult(int i, int i2, Intent intent) {
        super.onActivityResult(i, i2, intent);
        if (i == 100) {
            int i3 = C2802.m4856(intent, "ProxyBillingActivity").f8542;
            if (i2 != -1 || i3 != 0) {
                StringBuilder sb = new StringBuilder(85);
                sb.append("Activity finished with resultCode ");
                sb.append(i2);
                sb.append(" and billing's responseCode: ");
                sb.append(i3);
                C2802.m4859("ProxyBillingActivity", sb.toString());
            }
            this.f1505.send(i3, intent == null ? null : intent.getExtras());
        } else {
            StringBuilder sb2 = new StringBuilder(69);
            sb2.append("Got onActivityResult with wrong requestCode: ");
            sb2.append(i);
            sb2.append("; skipping...");
            C2802.m4859("ProxyBillingActivity", sb2.toString());
        }
        finish();
    }

    @Override // android.app.Activity
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        if (bundle != null) {
            C2802.m4857("ProxyBillingActivity", "Launching Play Store billing flow from savedInstanceState");
            this.f1505 = (ResultReceiver) bundle.getParcelable("result_receiver");
            return;
        }
        C2802.m4857("ProxyBillingActivity", "Launching Play Store billing flow");
        this.f1505 = (ResultReceiver) getIntent().getParcelableExtra("result_receiver");
        try {
            startIntentSenderForResult((getIntent().hasExtra("BUY_INTENT") ? (PendingIntent) getIntent().getParcelableExtra("BUY_INTENT") : getIntent().hasExtra("SUBS_MANAGEMENT_INTENT") ? (PendingIntent) getIntent().getParcelableExtra("SUBS_MANAGEMENT_INTENT") : null).getIntentSender(), 100, new Intent(), 0, 0, 0);
        } catch (IntentSender.SendIntentException e) {
            String strValueOf = String.valueOf(e);
            StringBuilder sb = new StringBuilder(strValueOf.length() + 53);
            sb.append("Got exception while trying to start a purchase flow: ");
            sb.append(strValueOf);
            C2802.m4859("ProxyBillingActivity", sb.toString());
            this.f1505.send(6, null);
            finish();
        }
    }

    @Override // android.app.Activity
    public void onSaveInstanceState(Bundle bundle) {
        bundle.putParcelable("result_receiver", this.f1505);
    }
}
