package com.google.android.gms.ads;

import android.app.Activity;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.RemoteException;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.gms.common.annotation.KeepForSdk;
import com.google.android.gms.internal.ads.py;
import k8.b;
import n7.x;
import q7.j;

/* JADX INFO: loaded from: classes2.dex */
@KeepForSdk
public final class AdActivity extends Activity {

    @Nullable
    private py zza;

    @Override // android.app.Activity
    public final void onActivityResult(int i10, int i11, Intent intent) {
        try {
            py pyVar = this.zza;
            if (pyVar != null) {
                pyVar.y0(i10, i11, intent);
            }
        } catch (Exception e10) {
            j.zzl("#007 Could not call remote method.", e10);
        }
        super.onActivityResult(i10, i11, intent);
    }

    @Override // android.app.Activity
    public final void onBackPressed() {
        try {
            py pyVar = this.zza;
            if (pyVar != null) {
                if (!pyVar.zzg()) {
                    return;
                }
            }
        } catch (RemoteException e10) {
            j.zzl("#007 Could not call remote method.", e10);
        }
        super.onBackPressed();
        try {
            py pyVar2 = this.zza;
            if (pyVar2 != null) {
                pyVar2.zze();
            }
        } catch (RemoteException e11) {
            j.zzl("#007 Could not call remote method.", e11);
        }
    }

    @Override // android.app.Activity, android.content.ComponentCallbacks
    public final void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
        try {
            py pyVar = this.zza;
            if (pyVar != null) {
                pyVar.p(new b(configuration));
            }
        } catch (RemoteException e10) {
            j.zzl("#007 Could not call remote method.", e10);
        }
    }

    @Override // android.app.Activity
    public final void onCreate(@Nullable Bundle bundle) {
        super.onCreate(bundle);
        j.a("AdActivity onCreate");
        py pyVarZzh = x.f31085g.f31087b.zzh(this);
        this.zza = pyVarZzh;
        if (pyVarZzh == null) {
            j.zzl("#007 Could not call remote method.", null);
            finish();
            return;
        }
        try {
            pyVarZzh.zzh(bundle);
        } catch (RemoteException e10) {
            j.zzl("#007 Could not call remote method.", e10);
            finish();
        }
    }

    @Override // android.app.Activity
    public final void onDestroy() {
        j.a("AdActivity onDestroy");
        try {
            py pyVar = this.zza;
            if (pyVar != null) {
                pyVar.g();
            }
        } catch (RemoteException e10) {
            j.zzl("#007 Could not call remote method.", e10);
        }
        super.onDestroy();
    }

    @Override // android.app.Activity
    public final void onPause() {
        j.a("AdActivity onPause");
        try {
            py pyVar = this.zza;
            if (pyVar != null) {
                pyVar.zzl();
            }
        } catch (RemoteException e10) {
            j.zzl("#007 Could not call remote method.", e10);
            finish();
        }
        super.onPause();
    }

    @Override // android.app.Activity
    public final void onRequestPermissionsResult(int i10, String[] strArr, int[] iArr) {
        try {
            py pyVar = this.zza;
            if (pyVar != null) {
                pyVar.o0(i10, strArr, iArr);
            }
        } catch (RemoteException e10) {
            j.zzl("#007 Could not call remote method.", e10);
        }
    }

    @Override // android.app.Activity
    public final void onRestart() {
        super.onRestart();
        j.a("AdActivity onRestart");
        try {
            py pyVar = this.zza;
            if (pyVar != null) {
                pyVar.zzi();
            }
        } catch (RemoteException e10) {
            j.zzl("#007 Could not call remote method.", e10);
            finish();
        }
    }

    @Override // android.app.Activity
    public final void onResume() {
        j.a("AdActivity onResume");
        super.onResume();
        try {
            py pyVar = this.zza;
            if (pyVar != null) {
                pyVar.zzk();
            }
        } catch (RemoteException e10) {
            j.zzl("#007 Could not call remote method.", e10);
            finish();
        }
    }

    @Override // android.app.Activity
    public final void onSaveInstanceState(Bundle bundle) {
        try {
            py pyVar = this.zza;
            if (pyVar != null) {
                pyVar.u0(bundle);
            }
        } catch (RemoteException e10) {
            j.zzl("#007 Could not call remote method.", e10);
            finish();
        }
        super.onSaveInstanceState(bundle);
    }

    @Override // android.app.Activity
    public final void onStart() {
        super.onStart();
        j.a("AdActivity onStart");
        try {
            py pyVar = this.zza;
            if (pyVar != null) {
                pyVar.zzj();
            }
        } catch (RemoteException e10) {
            j.zzl("#007 Could not call remote method.", e10);
            finish();
        }
    }

    @Override // android.app.Activity
    public final void onStop() {
        j.a("AdActivity onStop");
        try {
            py pyVar = this.zza;
            if (pyVar != null) {
                pyVar.zzp();
            }
        } catch (RemoteException e10) {
            j.zzl("#007 Could not call remote method.", e10);
            finish();
        }
        super.onStop();
    }

    @Override // android.app.Activity
    public final void onUserLeaveHint() {
        super.onUserLeaveHint();
        try {
            py pyVar = this.zza;
            if (pyVar != null) {
                pyVar.zzf();
            }
        } catch (RemoteException e10) {
            j.zzl("#007 Could not call remote method.", e10);
        }
    }

    @Override // android.app.Activity
    public final void setContentView(int i10) {
        super.setContentView(i10);
        py pyVar = this.zza;
        if (pyVar != null) {
            try {
                pyVar.zzs();
            } catch (RemoteException e10) {
                j.zzl("#007 Could not call remote method.", e10);
            }
        }
    }

    @Override // android.app.Activity
    public final void setContentView(@NonNull View view) {
        super.setContentView(view);
        py pyVar = this.zza;
        if (pyVar != null) {
            try {
                pyVar.zzs();
            } catch (RemoteException e10) {
                j.zzl("#007 Could not call remote method.", e10);
            }
        }
    }

    @Override // android.app.Activity
    public final void setContentView(View view, ViewGroup.LayoutParams layoutParams) {
        super.setContentView(view, layoutParams);
        py pyVar = this.zza;
        if (pyVar != null) {
            try {
                pyVar.zzs();
            } catch (RemoteException e10) {
                j.zzl("#007 Could not call remote method.", e10);
            }
        }
    }
}
