package o; import android.content.DialogInterface; import android.view.KeyEvent; import android.view.View; import android.view.Window; import androidx.appcompat.view.menu.MenuItemImpl; import o.InterfaceC15933jjG; import o.PEg; /* loaded from: classes.dex */ final class mCV implements DialogInterface.OnKeyListener, DialogInterface.OnClickListener, DialogInterface.OnDismissListener, InterfaceC15933jjG.Sts { private InterfaceC15933jjG.Sts a; DialogInterfaceC17187ufv c; NoP d; PEg e; @Override // o.InterfaceC15933jjG.Sts public final boolean d(NoP noP) { return false; } public mCV(NoP noP) { this.d = noP; } @Override // android.content.DialogInterface.OnKeyListener public final boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) { Window window; View decorView; KeyEvent.DispatcherState keyDispatcherState; View decorView2; KeyEvent.DispatcherState keyDispatcherState2; if (i == 82 || i == 4) { if (keyEvent.getAction() == 0 && keyEvent.getRepeatCount() == 0) { Window window2 = this.c.getWindow(); if (window2 != null && (decorView2 = window2.getDecorView()) != null && (keyDispatcherState2 = decorView2.getKeyDispatcherState()) != null) { keyDispatcherState2.startTracking(keyEvent, this); return true; } } else if (keyEvent.getAction() == 1 && !keyEvent.isCanceled() && (window = this.c.getWindow()) != null && (decorView = window.getDecorView()) != null && (keyDispatcherState = decorView.getKeyDispatcherState()) != null && keyDispatcherState.isTracking(keyEvent)) { this.d.b(true); dialogInterface.dismiss(); return true; } } return this.d.performShortcut(i, keyEvent, 0); } @Override // android.content.DialogInterface.OnDismissListener public final void onDismiss(DialogInterface dialogInterface) { this.e.b(this.d, true); } @Override // o.InterfaceC15933jjG.Sts public final void e(NoP noP, boolean z) { DialogInterfaceC17187ufv dialogInterfaceC17187ufv; if ((z || noP == this.d) && (dialogInterfaceC17187ufv = this.c) != null) { dialogInterfaceC17187ufv.dismiss(); } } @Override // android.content.DialogInterface.OnClickListener public final void onClick(DialogInterface dialogInterface, int i) { NoP noP = this.d; PEg pEg = this.e; if (pEg.b == null) { pEg.b = new PEg.RVV(pEg); } noP.eM_((MenuItemImpl) pEg.b.getItem(i), null, 0); } }