package d.b.c;

import android.R;
import android.app.Activity;
import android.app.Dialog;
import android.app.UiModeManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.location.Location;
import android.location.LocationManager;
import android.os.Build;
import android.os.Bundle;
import android.os.LocaleList;
import android.os.PowerManager;
import android.os.Process;
import android.text.TextUtils;
import android.util.AndroidRuntimeException;
import android.util.AttributeSet;
import android.util.Log;
import android.util.TypedValue;
import android.view.ActionMode;
import android.view.ContextThemeWrapper;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.KeyboardShortcutGroup;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.PopupWindow;
import android.widget.TextView;
import androidx.appcompat.widget.ActionBarContextView;
import androidx.appcompat.widget.ContentFrameLayout;
import androidx.appcompat.widget.Toolbar;
import d.b.c.r;
import d.b.f.a;
import d.b.f.e;
import d.b.f.i.g;
import d.b.f.i.m;
import d.b.g.d1;
import d.b.g.e0;
import d.b.g.p0;
import d.b.g.z0;
import d.h.c.a;
import d.h.j.d0;
import d.h.j.f0;
import d.h.j.h0;
import d.h.j.y;
import java.lang.ref.WeakReference;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Calendar;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;

/* JADX INFO: loaded from: classes.dex */
public class i extends d.b.c.h implements g.a, LayoutInflater.Factory2 {

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public static final d.e.h<String, Integer> f1561n = new d.e.h<>();

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public static final int[] f1562o = {R.attr.windowBackground};

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    public static final boolean f1563p = !"robolectric".equals(Build.FINGERPRINT);

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public static final boolean f1564q = true;
    public c A;
    public k B;
    public d.b.f.a C;
    public ActionBarContextView D;
    public PopupWindow E;
    public Runnable F;
    public boolean H;
    public ViewGroup I;
    public TextView J;
    public View K;
    public boolean L;
    public boolean M;
    public boolean N;
    public boolean O;
    public boolean P;
    public boolean Q;
    public boolean R;
    public boolean S;
    public j[] T;
    public j U;
    public boolean V;
    public boolean W;
    public boolean X;
    public boolean Y;
    public boolean Z;

    /* JADX INFO: renamed from: a0, reason: collision with root package name */
    public int f1565a0;

    /* JADX INFO: renamed from: b0, reason: collision with root package name */
    public int f1566b0;

    /* JADX INFO: renamed from: c0, reason: collision with root package name */
    public boolean f1567c0;

    /* JADX INFO: renamed from: d0, reason: collision with root package name */
    public boolean f1568d0;
    public g e0;
    public g f0;
    public boolean g0;
    public int h0;
    public boolean j0;
    public Rect k0;
    public Rect l0;
    public o m0;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public final Object f1569r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public final Context f1570s;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public Window f1571t;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public e f1572u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public final d.b.c.g f1573v;

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public d.b.c.a f1574w;

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public MenuInflater f1575x;

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public CharSequence f1576y;

    /* JADX INFO: renamed from: z, reason: collision with root package name */
    public e0 f1577z;
    public d0 G = null;
    public final Runnable i0 = new a();

    public class a implements Runnable {
        public a() {
        }

        @Override // java.lang.Runnable
        public void run() {
            i iVar = i.this;
            if ((iVar.h0 & 1) != 0) {
                iVar.K(0);
            }
            i iVar2 = i.this;
            if ((iVar2.h0 & 4096) != 0) {
                iVar2.K(108);
            }
            i iVar3 = i.this;
            iVar3.g0 = false;
            iVar3.h0 = 0;
        }
    }

    public class b implements d.b.c.b {
        public b(i iVar) {
        }
    }

    public final class c implements m.a {
        public c() {
        }

        @Override // d.b.f.i.m.a
        public void b(d.b.f.i.g gVar, boolean z2) {
            i.this.G(gVar);
        }

        @Override // d.b.f.i.m.a
        public boolean c(d.b.f.i.g gVar) {
            Window.Callback callbackR = i.this.R();
            if (callbackR == null) {
                return true;
            }
            callbackR.onMenuOpened(108, gVar);
            return true;
        }
    }

    public class d implements a.InterfaceC0019a {
        public a.InterfaceC0019a a;

        public class a extends f0 {
            public a() {
            }

            @Override // d.h.j.e0
            public void b(View view) {
                i.this.D.setVisibility(8);
                i iVar = i.this;
                PopupWindow popupWindow = iVar.E;
                if (popupWindow != null) {
                    popupWindow.dismiss();
                } else if (iVar.D.getParent() instanceof View) {
                    View view2 = (View) i.this.D.getParent();
                    AtomicInteger atomicInteger = y.a;
                    y.g.c(view2);
                }
                i.this.D.h();
                i.this.G.d(null);
                i iVar2 = i.this;
                iVar2.G = null;
                ViewGroup viewGroup = iVar2.I;
                AtomicInteger atomicInteger2 = y.a;
                y.g.c(viewGroup);
            }
        }

        public d(a.InterfaceC0019a interfaceC0019a) {
            this.a = interfaceC0019a;
        }

        @Override // d.b.f.a.InterfaceC0019a
        public void a(d.b.f.a aVar) {
            this.a.a(aVar);
            i iVar = i.this;
            if (iVar.E != null) {
                iVar.f1571t.getDecorView().removeCallbacks(i.this.F);
            }
            i iVar2 = i.this;
            if (iVar2.D != null) {
                iVar2.L();
                i iVar3 = i.this;
                d0 d0VarB = y.b(iVar3.D);
                d0VarB.a(0.0f);
                iVar3.G = d0VarB;
                d0 d0Var = i.this.G;
                a aVar2 = new a();
                View view = d0Var.a.get();
                if (view != null) {
                    d0Var.e(view, aVar2);
                }
            }
            i iVar4 = i.this;
            d.b.c.g gVar = iVar4.f1573v;
            if (gVar != null) {
                gVar.onSupportActionModeFinished(iVar4.C);
            }
            i iVar5 = i.this;
            iVar5.C = null;
            ViewGroup viewGroup = iVar5.I;
            AtomicInteger atomicInteger = y.a;
            y.g.c(viewGroup);
        }

        @Override // d.b.f.a.InterfaceC0019a
        public boolean b(d.b.f.a aVar, Menu menu) {
            return this.a.b(aVar, menu);
        }

        @Override // d.b.f.a.InterfaceC0019a
        public boolean c(d.b.f.a aVar, Menu menu) {
            ViewGroup viewGroup = i.this.I;
            AtomicInteger atomicInteger = y.a;
            y.g.c(viewGroup);
            return this.a.c(aVar, menu);
        }

        @Override // d.b.f.a.InterfaceC0019a
        public boolean d(d.b.f.a aVar, MenuItem menuItem) {
            return this.a.d(aVar, menuItem);
        }
    }

    public class e extends d.b.f.h {
        public e(Window.Callback callback) {
            super(callback);
        }

        public final ActionMode a(ActionMode.Callback callback) {
            e.a aVar = new e.a(i.this.f1570s, callback);
            d.b.f.a aVarB = i.this.B(aVar);
            if (aVarB != null) {
                return aVar.e(aVarB);
            }
            return null;
        }

        @Override // d.b.f.h, android.view.Window.Callback
        public boolean dispatchKeyEvent(KeyEvent keyEvent) {
            return i.this.J(keyEvent) || this.f1724f.dispatchKeyEvent(keyEvent);
        }

        /* JADX WARN: Removed duplicated region for block: B:25:? A[RETURN, SYNTHETIC] */
        @Override // d.b.f.h, android.view.Window.Callback
        /*
            Code decompiled incorrectly, please refer to instructions dump.
            To view partially-correct add '--show-bad-code' argument
        */
        public boolean dispatchKeyShortcutEvent(android.view.KeyEvent r6) {
            /*
                r5 = this;
                android.view.Window$Callback r0 = r5.f1724f
                boolean r0 = r0.dispatchKeyShortcutEvent(r6)
                r1 = 0
                r2 = 1
                if (r0 != 0) goto L4f
                d.b.c.i r0 = d.b.c.i.this
                int r3 = r6.getKeyCode()
                r0.S()
                d.b.c.a r4 = r0.f1574w
                if (r4 == 0) goto L1f
                boolean r3 = r4.i(r3, r6)
                if (r3 == 0) goto L1f
            L1d:
                r6 = r2
                goto L4d
            L1f:
                d.b.c.i$j r3 = r0.U
                if (r3 == 0) goto L34
                int r4 = r6.getKeyCode()
                boolean r3 = r0.W(r3, r4, r6, r2)
                if (r3 == 0) goto L34
                d.b.c.i$j r6 = r0.U
                if (r6 == 0) goto L1d
                r6.f1598l = r2
                goto L1d
            L34:
                d.b.c.i$j r3 = r0.U
                if (r3 != 0) goto L4c
                d.b.c.i$j r3 = r0.Q(r1)
                r0.X(r3, r6)
                int r4 = r6.getKeyCode()
                boolean r6 = r0.W(r3, r4, r6, r2)
                r3.f1597k = r1
                if (r6 == 0) goto L4c
                goto L1d
            L4c:
                r6 = r1
            L4d:
                if (r6 == 0) goto L50
            L4f:
                r1 = r2
            L50:
                return r1
            */
            throw new UnsupportedOperationException("Method not decompiled: d.b.c.i.e.dispatchKeyShortcutEvent(android.view.KeyEvent):boolean");
        }

        @Override // d.b.f.h, android.view.Window.Callback
        public void onContentChanged() {
        }

        @Override // d.b.f.h, android.view.Window.Callback
        public boolean onCreatePanelMenu(int i2, Menu menu) {
            if (i2 != 0 || (menu instanceof d.b.f.i.g)) {
                return this.f1724f.onCreatePanelMenu(i2, menu);
            }
            return false;
        }

        @Override // d.b.f.h, android.view.Window.Callback
        public boolean onMenuOpened(int i2, Menu menu) {
            this.f1724f.onMenuOpened(i2, menu);
            i iVar = i.this;
            Objects.requireNonNull(iVar);
            if (i2 == 108) {
                iVar.S();
                d.b.c.a aVar = iVar.f1574w;
                if (aVar != null) {
                    aVar.c(true);
                }
            }
            return true;
        }

        @Override // d.b.f.h, android.view.Window.Callback
        public void onPanelClosed(int i2, Menu menu) {
            this.f1724f.onPanelClosed(i2, menu);
            i iVar = i.this;
            Objects.requireNonNull(iVar);
            if (i2 == 108) {
                iVar.S();
                d.b.c.a aVar = iVar.f1574w;
                if (aVar != null) {
                    aVar.c(false);
                    return;
                }
                return;
            }
            if (i2 == 0) {
                j jVarQ = iVar.Q(i2);
                if (jVarQ.f1599m) {
                    iVar.H(jVarQ, false);
                }
            }
        }

        @Override // android.view.Window.Callback
        public boolean onPreparePanel(int i2, View view, Menu menu) {
            d.b.f.i.g gVar = menu instanceof d.b.f.i.g ? (d.b.f.i.g) menu : null;
            if (i2 == 0 && gVar == null) {
                return false;
            }
            if (gVar != null) {
                gVar.f1810y = true;
            }
            boolean zOnPreparePanel = this.f1724f.onPreparePanel(i2, view, menu);
            if (gVar != null) {
                gVar.f1810y = false;
            }
            return zOnPreparePanel;
        }

        @Override // d.b.f.h, android.view.Window.Callback
        public void onProvideKeyboardShortcuts(List<KeyboardShortcutGroup> list, Menu menu, int i2) {
            d.b.f.i.g gVar = i.this.Q(0).f1594h;
            if (gVar != null) {
                this.f1724f.onProvideKeyboardShortcuts(list, gVar, i2);
            } else {
                this.f1724f.onProvideKeyboardShortcuts(list, menu, i2);
            }
        }

        @Override // d.b.f.h, android.view.Window.Callback
        public ActionMode onWindowStartingActionMode(ActionMode.Callback callback) {
            return null;
        }

        @Override // d.b.f.h, android.view.Window.Callback
        public ActionMode onWindowStartingActionMode(ActionMode.Callback callback, int i2) {
            Objects.requireNonNull(i.this);
            return i2 != 0 ? this.f1724f.onWindowStartingActionMode(callback, i2) : a(callback);
        }
    }

    public class f extends g {

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        public final PowerManager f1582c;

        public f(Context context) {
            super();
            this.f1582c = (PowerManager) context.getApplicationContext().getSystemService("power");
        }

        @Override // d.b.c.i.g
        public IntentFilter b() {
            IntentFilter intentFilter = new IntentFilter();
            intentFilter.addAction("android.os.action.POWER_SAVE_MODE_CHANGED");
            return intentFilter;
        }

        @Override // d.b.c.i.g
        public int c() {
            return this.f1582c.isPowerSaveMode() ? 2 : 1;
        }

        @Override // d.b.c.i.g
        public void d() {
            i.this.C();
        }
    }

    public abstract class g {
        public BroadcastReceiver a;

        public class a extends BroadcastReceiver {
            public a() {
            }

            @Override // android.content.BroadcastReceiver
            public void onReceive(Context context, Intent intent) {
                g.this.d();
            }
        }

        public g() {
        }

        public void a() {
            BroadcastReceiver broadcastReceiver = this.a;
            if (broadcastReceiver != null) {
                try {
                    i.this.f1570s.unregisterReceiver(broadcastReceiver);
                } catch (IllegalArgumentException unused) {
                }
                this.a = null;
            }
        }

        public abstract IntentFilter b();

        public abstract int c();

        public abstract void d();

        public void e() {
            a();
            IntentFilter intentFilterB = b();
            if (intentFilterB == null || intentFilterB.countActions() == 0) {
                return;
            }
            if (this.a == null) {
                this.a = new a();
            }
            i.this.f1570s.registerReceiver(this.a, intentFilterB);
        }
    }

    public class h extends g {

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        public final r f1585c;

        public h(r rVar) {
            super();
            this.f1585c = rVar;
        }

        @Override // d.b.c.i.g
        public IntentFilter b() {
            IntentFilter intentFilter = new IntentFilter();
            intentFilter.addAction("android.intent.action.TIME_SET");
            intentFilter.addAction("android.intent.action.TIMEZONE_CHANGED");
            intentFilter.addAction("android.intent.action.TIME_TICK");
            return intentFilter;
        }

        @Override // d.b.c.i.g
        public int c() {
            boolean z2;
            long j2;
            r rVar = this.f1585c;
            r.a aVar = rVar.f1634d;
            if (aVar.f1635b > System.currentTimeMillis()) {
                z2 = aVar.a;
            } else {
                Context context = rVar.f1632b;
                Location locationA = d.h.b.h.f(context, "android.permission.ACCESS_COARSE_LOCATION", Process.myPid(), Process.myUid(), context.getPackageName()) == 0 ? rVar.a("network") : null;
                Context context2 = rVar.f1632b;
                Location locationA2 = d.h.b.h.f(context2, "android.permission.ACCESS_FINE_LOCATION", Process.myPid(), Process.myUid(), context2.getPackageName()) == 0 ? rVar.a("gps") : null;
                if (locationA2 == null || locationA == null ? locationA2 != null : locationA2.getTime() > locationA.getTime()) {
                    locationA = locationA2;
                }
                if (locationA != null) {
                    r.a aVar2 = rVar.f1634d;
                    long jCurrentTimeMillis = System.currentTimeMillis();
                    if (q.a == null) {
                        q.a = new q();
                    }
                    q qVar = q.a;
                    qVar.a(jCurrentTimeMillis - 86400000, locationA.getLatitude(), locationA.getLongitude());
                    qVar.a(jCurrentTimeMillis, locationA.getLatitude(), locationA.getLongitude());
                    boolean z3 = qVar.f1631d == 1;
                    long j3 = qVar.f1630c;
                    long j4 = qVar.f1629b;
                    qVar.a(jCurrentTimeMillis + 86400000, locationA.getLatitude(), locationA.getLongitude());
                    long j5 = qVar.f1630c;
                    if (j3 == -1 || j4 == -1) {
                        j2 = jCurrentTimeMillis + 43200000;
                    } else {
                        j2 = (jCurrentTimeMillis > j4 ? j5 + 0 : jCurrentTimeMillis > j3 ? j4 + 0 : j3 + 0) + 60000;
                    }
                    aVar2.a = z3;
                    aVar2.f1635b = j2;
                    z2 = aVar.a;
                } else {
                    Log.i("TwilightManager", "Could not get last known location. This is probably because the app does not have any location permissions. Falling back to hardcoded sunrise/sunset values.");
                    int i2 = Calendar.getInstance().get(11);
                    z2 = i2 < 6 || i2 >= 22;
                }
            }
            return z2 ? 2 : 1;
        }

        @Override // d.b.c.i.g
        public void d() {
            i.this.C();
        }
    }

    /* JADX INFO: renamed from: d.b.c.i$i, reason: collision with other inner class name */
    public class C0018i extends ContentFrameLayout {
        public C0018i(Context context) {
            super(context, null);
        }

        @Override // android.view.ViewGroup, android.view.View
        public boolean dispatchKeyEvent(KeyEvent keyEvent) {
            return i.this.J(keyEvent) || super.dispatchKeyEvent(keyEvent);
        }

        @Override // android.view.ViewGroup
        public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
            if (motionEvent.getAction() == 0) {
                int x2 = (int) motionEvent.getX();
                int y2 = (int) motionEvent.getY();
                if (x2 < -5 || y2 < -5 || x2 > getWidth() + 5 || y2 > getHeight() + 5) {
                    i iVar = i.this;
                    iVar.H(iVar.Q(0), true);
                    return true;
                }
            }
            return super.onInterceptTouchEvent(motionEvent);
        }

        @Override // android.view.View
        public void setBackgroundResource(int i2) {
            setBackgroundDrawable(d.b.d.a.a.a(getContext(), i2));
        }
    }

    public static final class j {
        public int a;

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        public int f1588b;

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        public int f1589c;

        /* JADX INFO: renamed from: d, reason: collision with root package name */
        public int f1590d;

        /* JADX INFO: renamed from: e, reason: collision with root package name */
        public ViewGroup f1591e;

        /* JADX INFO: renamed from: f, reason: collision with root package name */
        public View f1592f;

        /* JADX INFO: renamed from: g, reason: collision with root package name */
        public View f1593g;

        /* JADX INFO: renamed from: h, reason: collision with root package name */
        public d.b.f.i.g f1594h;

        /* JADX INFO: renamed from: i, reason: collision with root package name */
        public d.b.f.i.e f1595i;

        /* JADX INFO: renamed from: j, reason: collision with root package name */
        public Context f1596j;

        /* JADX INFO: renamed from: k, reason: collision with root package name */
        public boolean f1597k;

        /* JADX INFO: renamed from: l, reason: collision with root package name */
        public boolean f1598l;

        /* JADX INFO: renamed from: m, reason: collision with root package name */
        public boolean f1599m;

        /* JADX INFO: renamed from: n, reason: collision with root package name */
        public boolean f1600n;

        /* JADX INFO: renamed from: o, reason: collision with root package name */
        public boolean f1601o = false;

        /* JADX INFO: renamed from: p, reason: collision with root package name */
        public boolean f1602p;

        /* JADX INFO: renamed from: q, reason: collision with root package name */
        public Bundle f1603q;

        public j(int i2) {
            this.a = i2;
        }

        public void a(d.b.f.i.g gVar) {
            d.b.f.i.e eVar;
            d.b.f.i.g gVar2 = this.f1594h;
            if (gVar == gVar2) {
                return;
            }
            if (gVar2 != null) {
                gVar2.u(this.f1595i);
            }
            this.f1594h = gVar;
            if (gVar == null || (eVar = this.f1595i) == null) {
                return;
            }
            gVar.b(eVar, gVar.f1787b);
        }
    }

    public final class k implements m.a {
        public k() {
        }

        @Override // d.b.f.i.m.a
        public void b(d.b.f.i.g gVar, boolean z2) {
            d.b.f.i.g gVarK = gVar.k();
            boolean z3 = gVarK != gVar;
            i iVar = i.this;
            if (z3) {
                gVar = gVarK;
            }
            j jVarO = iVar.O(gVar);
            if (jVarO != null) {
                if (!z3) {
                    i.this.H(jVarO, z2);
                } else {
                    i.this.F(jVarO.a, jVarO, gVarK);
                    i.this.H(jVarO, true);
                }
            }
        }

        @Override // d.b.f.i.m.a
        public boolean c(d.b.f.i.g gVar) {
            Window.Callback callbackR;
            if (gVar != gVar.k()) {
                return true;
            }
            i iVar = i.this;
            if (!iVar.N || (callbackR = iVar.R()) == null || i.this.Z) {
                return true;
            }
            callbackR.onMenuOpened(108, gVar);
            return true;
        }
    }

    public i(Context context, Window window, d.b.c.g gVar, Object obj) {
        d.e.h<String, Integer> hVar;
        Integer orDefault;
        d.b.c.f fVar;
        this.f1565a0 = -100;
        this.f1570s = context;
        this.f1573v = gVar;
        this.f1569r = obj;
        if (obj instanceof Dialog) {
            while (context != null) {
                if (!(context instanceof d.b.c.f)) {
                    if (!(context instanceof ContextWrapper)) {
                        break;
                    } else {
                        context = ((ContextWrapper) context).getBaseContext();
                    }
                } else {
                    fVar = (d.b.c.f) context;
                    break;
                }
            }
            fVar = null;
            if (fVar != null) {
                this.f1565a0 = fVar.getDelegate().g();
            }
        }
        if (this.f1565a0 == -100 && (orDefault = (hVar = f1561n).getOrDefault(this.f1569r.getClass().getName(), null)) != null) {
            this.f1565a0 = orDefault.intValue();
            hVar.remove(this.f1569r.getClass().getName());
        }
        if (window != null) {
            E(window);
        }
        d.b.g.j.e();
    }

    @Override // d.b.c.h
    public final void A(CharSequence charSequence) {
        this.f1576y = charSequence;
        e0 e0Var = this.f1577z;
        if (e0Var != null) {
            e0Var.setWindowTitle(charSequence);
            return;
        }
        d.b.c.a aVar = this.f1574w;
        if (aVar != null) {
            aVar.n(charSequence);
            return;
        }
        TextView textView = this.J;
        if (textView != null) {
            textView.setText(charSequence);
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:26:0x0043  */
    /* JADX WARN: Removed duplicated region for block: B:27:0x0047  */
    @Override // d.b.c.h
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public d.b.f.a B(d.b.f.a.InterfaceC0019a r8) {
        /*
            Method dump skipped, instruction units count: 438
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: d.b.c.i.B(d.b.f.a$a):d.b.f.a");
    }

    public boolean C() {
        return D(true);
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:50:0x00bd  */
    /* JADX WARN: Removed duplicated region for block: B:68:0x011c  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final boolean D(boolean r12) {
        /*
            Method dump skipped, instruction units count: 351
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: d.b.c.i.D(boolean):boolean");
    }

    public final void E(Window window) {
        if (this.f1571t != null) {
            throw new IllegalStateException("AppCompat has already installed itself into the Window");
        }
        Window.Callback callback = window.getCallback();
        if (callback instanceof e) {
            throw new IllegalStateException("AppCompat has already installed itself into the Window");
        }
        e eVar = new e(callback);
        this.f1572u = eVar;
        window.setCallback(eVar);
        z0 z0VarP = z0.p(this.f1570s, null, f1562o);
        Drawable drawableH = z0VarP.h(0);
        if (drawableH != null) {
            window.setBackgroundDrawable(drawableH);
        }
        z0VarP.f2138b.recycle();
        this.f1571t = window;
    }

    public void F(int i2, j jVar, Menu menu) {
        if (menu == null && jVar != null) {
            menu = jVar.f1594h;
        }
        if ((jVar == null || jVar.f1599m) && !this.Z) {
            this.f1572u.f1724f.onPanelClosed(i2, menu);
        }
    }

    public void G(d.b.f.i.g gVar) {
        if (this.S) {
            return;
        }
        this.S = true;
        this.f1577z.i();
        Window.Callback callbackR = R();
        if (callbackR != null && !this.Z) {
            callbackR.onPanelClosed(108, gVar);
        }
        this.S = false;
    }

    public void H(j jVar, boolean z2) {
        ViewGroup viewGroup;
        e0 e0Var;
        if (z2 && jVar.a == 0 && (e0Var = this.f1577z) != null && e0Var.b()) {
            G(jVar.f1594h);
            return;
        }
        WindowManager windowManager = (WindowManager) this.f1570s.getSystemService("window");
        if (windowManager != null && jVar.f1599m && (viewGroup = jVar.f1591e) != null) {
            windowManager.removeView(viewGroup);
            if (z2) {
                F(jVar.a, jVar, null);
            }
        }
        jVar.f1597k = false;
        jVar.f1598l = false;
        jVar.f1599m = false;
        jVar.f1592f = null;
        jVar.f1601o = true;
        if (this.U == jVar) {
            this.U = null;
        }
    }

    public final Configuration I(Context context, int i2, Configuration configuration) {
        int i3 = i2 != 1 ? i2 != 2 ? context.getApplicationContext().getResources().getConfiguration().uiMode & 48 : 32 : 16;
        Configuration configuration2 = new Configuration();
        configuration2.fontScale = 0.0f;
        if (configuration != null) {
            configuration2.setTo(configuration);
        }
        configuration2.uiMode = i3 | (configuration2.uiMode & (-49));
        return configuration2;
    }

    /* JADX WARN: Removed duplicated region for block: B:69:0x00ca  */
    /* JADX WARN: Removed duplicated region for block: B:99:? A[RETURN, SYNTHETIC] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public boolean J(android.view.KeyEvent r7) {
        /*
            Method dump skipped, instruction units count: 283
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: d.b.c.i.J(android.view.KeyEvent):boolean");
    }

    public void K(int i2) {
        j jVarQ = Q(i2);
        if (jVarQ.f1594h != null) {
            Bundle bundle = new Bundle();
            jVarQ.f1594h.w(bundle);
            if (bundle.size() > 0) {
                jVarQ.f1603q = bundle;
            }
            jVarQ.f1594h.z();
            jVarQ.f1594h.clear();
        }
        jVarQ.f1602p = true;
        jVarQ.f1601o = true;
        if ((i2 == 108 || i2 == 0) && this.f1577z != null) {
            j jVarQ2 = Q(0);
            jVarQ2.f1597k = false;
            X(jVarQ2, null);
        }
    }

    public void L() {
        d0 d0Var = this.G;
        if (d0Var != null) {
            d0Var.b();
        }
    }

    public final void M() {
        ViewGroup viewGroup;
        if (this.H) {
            return;
        }
        TypedArray typedArrayObtainStyledAttributes = this.f1570s.obtainStyledAttributes(d.b.b.f1537j);
        if (!typedArrayObtainStyledAttributes.hasValue(117)) {
            typedArrayObtainStyledAttributes.recycle();
            throw new IllegalStateException("You need to use a Theme.AppCompat theme (or descendant) with this activity.");
        }
        if (typedArrayObtainStyledAttributes.getBoolean(126, false)) {
            u(1);
        } else if (typedArrayObtainStyledAttributes.getBoolean(117, false)) {
            u(108);
        }
        if (typedArrayObtainStyledAttributes.getBoolean(118, false)) {
            u(109);
        }
        if (typedArrayObtainStyledAttributes.getBoolean(119, false)) {
            u(10);
        }
        this.Q = typedArrayObtainStyledAttributes.getBoolean(0, false);
        typedArrayObtainStyledAttributes.recycle();
        N();
        this.f1571t.getDecorView();
        LayoutInflater layoutInflaterFrom = LayoutInflater.from(this.f1570s);
        if (this.R) {
            viewGroup = (ViewGroup) layoutInflaterFrom.inflate(this.P ? com.ifpdos.udi.service.core.pc.R.layout.abc_screen_simple_overlay_action_mode : com.ifpdos.udi.service.core.pc.R.layout.abc_screen_simple, (ViewGroup) null);
        } else if (this.Q) {
            viewGroup = (ViewGroup) layoutInflaterFrom.inflate(com.ifpdos.udi.service.core.pc.R.layout.abc_dialog_title_material, (ViewGroup) null);
            this.O = false;
            this.N = false;
        } else if (this.N) {
            TypedValue typedValue = new TypedValue();
            this.f1570s.getTheme().resolveAttribute(com.ifpdos.udi.service.core.pc.R.attr.actionBarTheme, typedValue, true);
            viewGroup = (ViewGroup) LayoutInflater.from(typedValue.resourceId != 0 ? new d.b.f.c(this.f1570s, typedValue.resourceId) : this.f1570s).inflate(com.ifpdos.udi.service.core.pc.R.layout.abc_screen_toolbar, (ViewGroup) null);
            e0 e0Var = (e0) viewGroup.findViewById(com.ifpdos.udi.service.core.pc.R.id.decor_content_parent);
            this.f1577z = e0Var;
            e0Var.setWindowCallback(R());
            if (this.O) {
                this.f1577z.h(109);
            }
            if (this.L) {
                this.f1577z.h(2);
            }
            if (this.M) {
                this.f1577z.h(5);
            }
        } else {
            viewGroup = null;
        }
        if (viewGroup == null) {
            StringBuilder sbF = g.a.a.a.a.F("AppCompat does not support the current theme features: { windowActionBar: ");
            sbF.append(this.N);
            sbF.append(", windowActionBarOverlay: ");
            sbF.append(this.O);
            sbF.append(", android:windowIsFloating: ");
            sbF.append(this.Q);
            sbF.append(", windowActionModeOverlay: ");
            sbF.append(this.P);
            sbF.append(", windowNoTitle: ");
            sbF.append(this.R);
            sbF.append(" }");
            throw new IllegalArgumentException(sbF.toString());
        }
        d.b.c.j jVar = new d.b.c.j(this);
        AtomicInteger atomicInteger = y.a;
        y.h.u(viewGroup, jVar);
        if (this.f1577z == null) {
            this.J = (TextView) viewGroup.findViewById(com.ifpdos.udi.service.core.pc.R.id.title);
        }
        Method method = d1.a;
        try {
            Method method2 = viewGroup.getClass().getMethod("makeOptionalFitsSystemWindows", new Class[0]);
            if (!method2.isAccessible()) {
                method2.setAccessible(true);
            }
            method2.invoke(viewGroup, new Object[0]);
        } catch (IllegalAccessException e2) {
            e = e2;
            Log.d("ViewUtils", "Could not invoke makeOptionalFitsSystemWindows", e);
        } catch (NoSuchMethodException unused) {
            Log.d("ViewUtils", "Could not find method makeOptionalFitsSystemWindows. Oh well...");
        } catch (InvocationTargetException e3) {
            e = e3;
            Log.d("ViewUtils", "Could not invoke makeOptionalFitsSystemWindows", e);
        }
        ContentFrameLayout contentFrameLayout = (ContentFrameLayout) viewGroup.findViewById(com.ifpdos.udi.service.core.pc.R.id.action_bar_activity_content);
        ViewGroup viewGroup2 = (ViewGroup) this.f1571t.findViewById(R.id.content);
        if (viewGroup2 != null) {
            while (viewGroup2.getChildCount() > 0) {
                View childAt = viewGroup2.getChildAt(0);
                viewGroup2.removeViewAt(0);
                contentFrameLayout.addView(childAt);
            }
            viewGroup2.setId(-1);
            contentFrameLayout.setId(R.id.content);
            if (viewGroup2 instanceof FrameLayout) {
                ((FrameLayout) viewGroup2).setForeground(null);
            }
        }
        this.f1571t.setContentView(viewGroup);
        contentFrameLayout.setAttachListener(new d.b.c.k(this));
        this.I = viewGroup;
        Object obj = this.f1569r;
        CharSequence title = obj instanceof Activity ? ((Activity) obj).getTitle() : this.f1576y;
        if (!TextUtils.isEmpty(title)) {
            e0 e0Var2 = this.f1577z;
            if (e0Var2 != null) {
                e0Var2.setWindowTitle(title);
            } else {
                d.b.c.a aVar = this.f1574w;
                if (aVar != null) {
                    aVar.n(title);
                } else {
                    TextView textView = this.J;
                    if (textView != null) {
                        textView.setText(title);
                    }
                }
            }
        }
        ContentFrameLayout contentFrameLayout2 = (ContentFrameLayout) this.I.findViewById(R.id.content);
        View decorView = this.f1571t.getDecorView();
        contentFrameLayout2.f510r.set(decorView.getPaddingLeft(), decorView.getPaddingTop(), decorView.getPaddingRight(), decorView.getPaddingBottom());
        AtomicInteger atomicInteger2 = y.a;
        if (y.f.c(contentFrameLayout2)) {
            contentFrameLayout2.requestLayout();
        }
        TypedArray typedArrayObtainStyledAttributes2 = this.f1570s.obtainStyledAttributes(d.b.b.f1537j);
        typedArrayObtainStyledAttributes2.getValue(124, contentFrameLayout2.getMinWidthMajor());
        typedArrayObtainStyledAttributes2.getValue(125, contentFrameLayout2.getMinWidthMinor());
        if (typedArrayObtainStyledAttributes2.hasValue(122)) {
            typedArrayObtainStyledAttributes2.getValue(122, contentFrameLayout2.getFixedWidthMajor());
        }
        if (typedArrayObtainStyledAttributes2.hasValue(123)) {
            typedArrayObtainStyledAttributes2.getValue(123, contentFrameLayout2.getFixedWidthMinor());
        }
        if (typedArrayObtainStyledAttributes2.hasValue(120)) {
            typedArrayObtainStyledAttributes2.getValue(120, contentFrameLayout2.getFixedHeightMajor());
        }
        if (typedArrayObtainStyledAttributes2.hasValue(121)) {
            typedArrayObtainStyledAttributes2.getValue(121, contentFrameLayout2.getFixedHeightMinor());
        }
        typedArrayObtainStyledAttributes2.recycle();
        contentFrameLayout2.requestLayout();
        this.H = true;
        j jVarQ = Q(0);
        if (this.Z || jVarQ.f1594h != null) {
            return;
        }
        T(108);
    }

    public final void N() {
        if (this.f1571t == null) {
            Object obj = this.f1569r;
            if (obj instanceof Activity) {
                E(((Activity) obj).getWindow());
            }
        }
        if (this.f1571t == null) {
            throw new IllegalStateException("We have not been given a Window");
        }
    }

    public j O(Menu menu) {
        j[] jVarArr = this.T;
        int length = jVarArr != null ? jVarArr.length : 0;
        for (int i2 = 0; i2 < length; i2++) {
            j jVar = jVarArr[i2];
            if (jVar != null && jVar.f1594h == menu) {
                return jVar;
            }
        }
        return null;
    }

    public final g P(Context context) {
        if (this.e0 == null) {
            if (r.a == null) {
                Context applicationContext = context.getApplicationContext();
                r.a = new r(applicationContext, (LocationManager) applicationContext.getSystemService("location"));
            }
            this.e0 = new h(r.a);
        }
        return this.e0;
    }

    public j Q(int i2) {
        j[] jVarArr = this.T;
        if (jVarArr == null || jVarArr.length <= i2) {
            j[] jVarArr2 = new j[i2 + 1];
            if (jVarArr != null) {
                System.arraycopy(jVarArr, 0, jVarArr2, 0, jVarArr.length);
            }
            this.T = jVarArr2;
            jVarArr = jVarArr2;
        }
        j jVar = jVarArr[i2];
        if (jVar != null) {
            return jVar;
        }
        j jVar2 = new j(i2);
        jVarArr[i2] = jVar2;
        return jVar2;
    }

    public final Window.Callback R() {
        return this.f1571t.getCallback();
    }

    /* JADX WARN: Removed duplicated region for block: B:16:0x0032  */
    /* JADX WARN: Removed duplicated region for block: B:19:? A[RETURN, SYNTHETIC] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void S() {
        /*
            r3 = this;
            r3.M()
            boolean r0 = r3.N
            if (r0 == 0) goto L37
            d.b.c.a r0 = r3.f1574w
            if (r0 == 0) goto Lc
            goto L37
        Lc:
            java.lang.Object r0 = r3.f1569r
            boolean r1 = r0 instanceof android.app.Activity
            if (r1 == 0) goto L20
            d.b.c.s r0 = new d.b.c.s
            java.lang.Object r1 = r3.f1569r
            android.app.Activity r1 = (android.app.Activity) r1
            boolean r2 = r3.O
            r0.<init>(r1, r2)
        L1d:
            r3.f1574w = r0
            goto L2e
        L20:
            boolean r0 = r0 instanceof android.app.Dialog
            if (r0 == 0) goto L2e
            d.b.c.s r0 = new d.b.c.s
            java.lang.Object r1 = r3.f1569r
            android.app.Dialog r1 = (android.app.Dialog) r1
            r0.<init>(r1)
            goto L1d
        L2e:
            d.b.c.a r0 = r3.f1574w
            if (r0 == 0) goto L37
            boolean r1 = r3.j0
            r0.l(r1)
        L37:
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: d.b.c.i.S():void");
    }

    public final void T(int i2) {
        this.h0 = (1 << i2) | this.h0;
        if (this.g0) {
            return;
        }
        View decorView = this.f1571t.getDecorView();
        Runnable runnable = this.i0;
        AtomicInteger atomicInteger = y.a;
        y.c.m(decorView, runnable);
        this.g0 = true;
    }

    public int U(Context context, int i2) {
        g gVarP;
        if (i2 == -100) {
            return -1;
        }
        if (i2 != -1) {
            if (i2 != 0) {
                if (i2 != 1 && i2 != 2) {
                    if (i2 != 3) {
                        throw new IllegalStateException("Unknown value set for night mode. Please use one of the MODE_NIGHT values from AppCompatDelegate.");
                    }
                    if (this.f0 == null) {
                        this.f0 = new f(context);
                    }
                    gVarP = this.f0;
                }
            } else {
                if (((UiModeManager) context.getApplicationContext().getSystemService("uimode")).getNightMode() == 0) {
                    return -1;
                }
                gVarP = P(context);
            }
            return gVarP.c();
        }
        return i2;
    }

    /* JADX WARN: Removed duplicated region for block: B:82:0x015b  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void V(d.b.c.i.j r14, android.view.KeyEvent r15) {
        /*
            Method dump skipped, instruction units count: 470
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: d.b.c.i.V(d.b.c.i$j, android.view.KeyEvent):void");
    }

    public final boolean W(j jVar, int i2, KeyEvent keyEvent, int i3) {
        d.b.f.i.g gVar;
        boolean zPerformShortcut = false;
        if (keyEvent.isSystem()) {
            return false;
        }
        if ((jVar.f1597k || X(jVar, keyEvent)) && (gVar = jVar.f1594h) != null) {
            zPerformShortcut = gVar.performShortcut(i2, keyEvent, i3);
        }
        if (zPerformShortcut && (i3 & 1) == 0 && this.f1577z == null) {
            H(jVar, true);
        }
        return zPerformShortcut;
    }

    public final boolean X(j jVar, KeyEvent keyEvent) {
        e0 e0Var;
        e0 e0Var2;
        Resources.Theme themeNewTheme;
        e0 e0Var3;
        e0 e0Var4;
        if (this.Z) {
            return false;
        }
        if (jVar.f1597k) {
            return true;
        }
        j jVar2 = this.U;
        if (jVar2 != null && jVar2 != jVar) {
            H(jVar2, false);
        }
        Window.Callback callbackR = R();
        if (callbackR != null) {
            jVar.f1593g = callbackR.onCreatePanelView(jVar.a);
        }
        int i2 = jVar.a;
        boolean z2 = i2 == 0 || i2 == 108;
        if (z2 && (e0Var4 = this.f1577z) != null) {
            e0Var4.c();
        }
        if (jVar.f1593g == null && (!z2 || !(this.f1574w instanceof p))) {
            d.b.f.i.g gVar = jVar.f1594h;
            if (gVar == null || jVar.f1602p) {
                if (gVar == null) {
                    Context context = this.f1570s;
                    int i3 = jVar.a;
                    if ((i3 == 0 || i3 == 108) && this.f1577z != null) {
                        TypedValue typedValue = new TypedValue();
                        Resources.Theme theme = context.getTheme();
                        theme.resolveAttribute(com.ifpdos.udi.service.core.pc.R.attr.actionBarTheme, typedValue, true);
                        if (typedValue.resourceId != 0) {
                            themeNewTheme = context.getResources().newTheme();
                            themeNewTheme.setTo(theme);
                            themeNewTheme.applyStyle(typedValue.resourceId, true);
                            themeNewTheme.resolveAttribute(com.ifpdos.udi.service.core.pc.R.attr.actionBarWidgetTheme, typedValue, true);
                        } else {
                            theme.resolveAttribute(com.ifpdos.udi.service.core.pc.R.attr.actionBarWidgetTheme, typedValue, true);
                            themeNewTheme = null;
                        }
                        if (typedValue.resourceId != 0) {
                            if (themeNewTheme == null) {
                                themeNewTheme = context.getResources().newTheme();
                                themeNewTheme.setTo(theme);
                            }
                            themeNewTheme.applyStyle(typedValue.resourceId, true);
                        }
                        if (themeNewTheme != null) {
                            d.b.f.c cVar = new d.b.f.c(context, 0);
                            cVar.getTheme().setTo(themeNewTheme);
                            context = cVar;
                        }
                    }
                    d.b.f.i.g gVar2 = new d.b.f.i.g(context);
                    gVar2.f1791f = this;
                    jVar.a(gVar2);
                    if (jVar.f1594h == null) {
                        return false;
                    }
                }
                if (z2 && (e0Var2 = this.f1577z) != null) {
                    if (this.A == null) {
                        this.A = new c();
                    }
                    e0Var2.a(jVar.f1594h, this.A);
                }
                jVar.f1594h.z();
                if (!callbackR.onCreatePanelMenu(jVar.a, jVar.f1594h)) {
                    jVar.a(null);
                    if (z2 && (e0Var = this.f1577z) != null) {
                        e0Var.a(null, this.A);
                    }
                    return false;
                }
                jVar.f1602p = false;
            }
            jVar.f1594h.z();
            Bundle bundle = jVar.f1603q;
            if (bundle != null) {
                jVar.f1594h.v(bundle);
                jVar.f1603q = null;
            }
            if (!callbackR.onPreparePanel(0, jVar.f1593g, jVar.f1594h)) {
                if (z2 && (e0Var3 = this.f1577z) != null) {
                    e0Var3.a(null, this.A);
                }
                jVar.f1594h.y();
                return false;
            }
            boolean z3 = KeyCharacterMap.load(keyEvent != null ? keyEvent.getDeviceId() : -1).getKeyboardType() != 1;
            jVar.f1600n = z3;
            jVar.f1594h.setQwertyMode(z3);
            jVar.f1594h.y();
        }
        jVar.f1597k = true;
        jVar.f1598l = false;
        this.U = jVar;
        return true;
    }

    public final boolean Y() {
        ViewGroup viewGroup;
        if (this.H && (viewGroup = this.I) != null) {
            AtomicInteger atomicInteger = y.a;
            if (y.f.c(viewGroup)) {
                return true;
            }
        }
        return false;
    }

    public final void Z() {
        if (this.H) {
            throw new AndroidRuntimeException("Window feature must be requested before adding content");
        }
    }

    @Override // d.b.f.i.g.a
    public boolean a(d.b.f.i.g gVar, MenuItem menuItem) {
        j jVarO;
        Window.Callback callbackR = R();
        if (callbackR == null || this.Z || (jVarO = O(gVar.k())) == null) {
            return false;
        }
        return callbackR.onMenuItemSelected(jVarO.a, menuItem);
    }

    public final int a0(h0 h0Var, Rect rect) {
        boolean z2;
        boolean z3;
        Context context;
        int i2;
        int iD = h0Var.d();
        ActionBarContextView actionBarContextView = this.D;
        if (actionBarContextView == null || !(actionBarContextView.getLayoutParams() instanceof ViewGroup.MarginLayoutParams)) {
            z2 = false;
        } else {
            ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) this.D.getLayoutParams();
            if (this.D.isShown()) {
                if (this.k0 == null) {
                    this.k0 = new Rect();
                    this.l0 = new Rect();
                }
                Rect rect2 = this.k0;
                Rect rect3 = this.l0;
                rect2.set(h0Var.b(), h0Var.d(), h0Var.c(), h0Var.a());
                d1.a(this.I, rect2, rect3);
                int i3 = rect2.top;
                int i4 = rect2.left;
                int i5 = rect2.right;
                ViewGroup viewGroup = this.I;
                AtomicInteger atomicInteger = y.a;
                h0 h0VarA = y.i.a(viewGroup);
                int iB = h0VarA == null ? 0 : h0VarA.b();
                int iC = h0VarA == null ? 0 : h0VarA.c();
                if (marginLayoutParams.topMargin == i3 && marginLayoutParams.leftMargin == i4 && marginLayoutParams.rightMargin == i5) {
                    z3 = false;
                } else {
                    marginLayoutParams.topMargin = i3;
                    marginLayoutParams.leftMargin = i4;
                    marginLayoutParams.rightMargin = i5;
                    z3 = true;
                }
                if (i3 <= 0 || this.K != null) {
                    View view = this.K;
                    if (view != null) {
                        ViewGroup.MarginLayoutParams marginLayoutParams2 = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
                        int i6 = marginLayoutParams2.height;
                        int i7 = marginLayoutParams.topMargin;
                        if (i6 != i7 || marginLayoutParams2.leftMargin != iB || marginLayoutParams2.rightMargin != iC) {
                            marginLayoutParams2.height = i7;
                            marginLayoutParams2.leftMargin = iB;
                            marginLayoutParams2.rightMargin = iC;
                            this.K.setLayoutParams(marginLayoutParams2);
                        }
                    }
                } else {
                    View view2 = new View(this.f1570s);
                    this.K = view2;
                    view2.setVisibility(8);
                    FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, marginLayoutParams.topMargin, 51);
                    layoutParams.leftMargin = iB;
                    layoutParams.rightMargin = iC;
                    this.I.addView(this.K, -1, layoutParams);
                }
                View view3 = this.K;
                z2 = view3 != null;
                if (z2 && view3.getVisibility() != 0) {
                    View view4 = this.K;
                    if ((y.c.g(view4) & 8192) != 0) {
                        context = this.f1570s;
                        i2 = com.ifpdos.udi.service.core.pc.R.color.abc_decor_view_status_guard_light;
                    } else {
                        context = this.f1570s;
                        i2 = com.ifpdos.udi.service.core.pc.R.color.abc_decor_view_status_guard;
                    }
                    Object obj = d.h.c.a.a;
                    view4.setBackgroundColor(a.c.a(context, i2));
                }
                if (!this.P && z2) {
                    iD = 0;
                }
                z = z3;
            } else if (marginLayoutParams.topMargin != 0) {
                marginLayoutParams.topMargin = 0;
                z2 = false;
            } else {
                z = false;
                z2 = false;
            }
            if (z) {
                this.D.setLayoutParams(marginLayoutParams);
            }
        }
        View view5 = this.K;
        if (view5 != null) {
            view5.setVisibility(z2 ? 0 : 8);
        }
        return iD;
    }

    @Override // d.b.f.i.g.a
    public void b(d.b.f.i.g gVar) {
        e0 e0Var = this.f1577z;
        if (e0Var == null || !e0Var.d() || (ViewConfiguration.get(this.f1570s).hasPermanentMenuKey() && !this.f1577z.e())) {
            j jVarQ = Q(0);
            jVarQ.f1601o = true;
            H(jVarQ, false);
            V(jVarQ, null);
            return;
        }
        Window.Callback callbackR = R();
        if (this.f1577z.b()) {
            this.f1577z.f();
            if (this.Z) {
                return;
            }
            callbackR.onPanelClosed(108, Q(0).f1594h);
            return;
        }
        if (callbackR == null || this.Z) {
            return;
        }
        if (this.g0 && (1 & this.h0) != 0) {
            this.f1571t.getDecorView().removeCallbacks(this.i0);
            this.i0.run();
        }
        j jVarQ2 = Q(0);
        d.b.f.i.g gVar2 = jVarQ2.f1594h;
        if (gVar2 == null || jVarQ2.f1602p || !callbackR.onPreparePanel(0, jVarQ2.f1593g, gVar2)) {
            return;
        }
        callbackR.onMenuOpened(108, jVarQ2.f1594h);
        this.f1577z.g();
    }

    @Override // d.b.c.h
    public void c(View view, ViewGroup.LayoutParams layoutParams) {
        M();
        ((ViewGroup) this.I.findViewById(R.id.content)).addView(view, layoutParams);
        this.f1572u.f1724f.onContentChanged();
    }

    @Override // d.b.c.h
    public Context d(Context context) {
        Configuration configuration;
        this.W = true;
        int i2 = this.f1565a0;
        if (i2 == -100) {
            i2 = -100;
        }
        int iU = U(context, i2);
        if (f1564q && (context instanceof ContextThemeWrapper)) {
            try {
                ((ContextThemeWrapper) context).applyOverrideConfiguration(I(context, iU, null));
                return context;
            } catch (IllegalStateException unused) {
            }
        }
        if (context instanceof d.b.f.c) {
            try {
                ((d.b.f.c) context).a(I(context, iU, null));
                return context;
            } catch (IllegalStateException unused2) {
            }
        }
        if (!f1563p) {
            return context;
        }
        Configuration configuration2 = new Configuration();
        configuration2.uiMode = -1;
        configuration2.fontScale = 0.0f;
        Configuration configuration3 = context.createConfigurationContext(configuration2).getResources().getConfiguration();
        Configuration configuration4 = context.getResources().getConfiguration();
        configuration3.uiMode = configuration4.uiMode;
        if (configuration3.equals(configuration4)) {
            configuration = null;
        } else {
            configuration = new Configuration();
            configuration.fontScale = 0.0f;
            if (configuration3.diff(configuration4) != 0) {
                float f2 = configuration3.fontScale;
                float f3 = configuration4.fontScale;
                if (f2 != f3) {
                    configuration.fontScale = f3;
                }
                int i3 = configuration3.mcc;
                int i4 = configuration4.mcc;
                if (i3 != i4) {
                    configuration.mcc = i4;
                }
                int i5 = configuration3.mnc;
                int i6 = configuration4.mnc;
                if (i5 != i6) {
                    configuration.mnc = i6;
                }
                LocaleList locales = configuration3.getLocales();
                LocaleList locales2 = configuration4.getLocales();
                if (!locales.equals(locales2)) {
                    configuration.setLocales(locales2);
                    configuration.locale = configuration4.locale;
                }
                int i7 = configuration3.touchscreen;
                int i8 = configuration4.touchscreen;
                if (i7 != i8) {
                    configuration.touchscreen = i8;
                }
                int i9 = configuration3.keyboard;
                int i10 = configuration4.keyboard;
                if (i9 != i10) {
                    configuration.keyboard = i10;
                }
                int i11 = configuration3.keyboardHidden;
                int i12 = configuration4.keyboardHidden;
                if (i11 != i12) {
                    configuration.keyboardHidden = i12;
                }
                int i13 = configuration3.navigation;
                int i14 = configuration4.navigation;
                if (i13 != i14) {
                    configuration.navigation = i14;
                }
                int i15 = configuration3.navigationHidden;
                int i16 = configuration4.navigationHidden;
                if (i15 != i16) {
                    configuration.navigationHidden = i16;
                }
                int i17 = configuration3.orientation;
                int i18 = configuration4.orientation;
                if (i17 != i18) {
                    configuration.orientation = i18;
                }
                int i19 = configuration3.screenLayout & 15;
                int i20 = configuration4.screenLayout & 15;
                if (i19 != i20) {
                    configuration.screenLayout |= i20;
                }
                int i21 = configuration3.screenLayout & 192;
                int i22 = configuration4.screenLayout & 192;
                if (i21 != i22) {
                    configuration.screenLayout |= i22;
                }
                int i23 = configuration3.screenLayout & 48;
                int i24 = configuration4.screenLayout & 48;
                if (i23 != i24) {
                    configuration.screenLayout |= i24;
                }
                int i25 = configuration3.screenLayout & 768;
                int i26 = configuration4.screenLayout & 768;
                if (i25 != i26) {
                    configuration.screenLayout |= i26;
                }
                int i27 = configuration3.colorMode & 3;
                int i28 = configuration4.colorMode & 3;
                if (i27 != i28) {
                    configuration.colorMode |= i28;
                }
                int i29 = configuration3.colorMode & 12;
                int i30 = configuration4.colorMode & 12;
                if (i29 != i30) {
                    configuration.colorMode |= i30;
                }
                int i31 = configuration3.uiMode & 15;
                int i32 = configuration4.uiMode & 15;
                if (i31 != i32) {
                    configuration.uiMode |= i32;
                }
                int i33 = configuration3.uiMode & 48;
                int i34 = configuration4.uiMode & 48;
                if (i33 != i34) {
                    configuration.uiMode |= i34;
                }
                int i35 = configuration3.screenWidthDp;
                int i36 = configuration4.screenWidthDp;
                if (i35 != i36) {
                    configuration.screenWidthDp = i36;
                }
                int i37 = configuration3.screenHeightDp;
                int i38 = configuration4.screenHeightDp;
                if (i37 != i38) {
                    configuration.screenHeightDp = i38;
                }
                int i39 = configuration3.smallestScreenWidthDp;
                int i40 = configuration4.smallestScreenWidthDp;
                if (i39 != i40) {
                    configuration.smallestScreenWidthDp = i40;
                }
                int i41 = configuration3.densityDpi;
                int i42 = configuration4.densityDpi;
                if (i41 != i42) {
                    configuration.densityDpi = i42;
                }
            }
        }
        Configuration configurationI = I(context, iU, configuration);
        d.b.f.c cVar = new d.b.f.c(context, 2131886491);
        cVar.a(configurationI);
        boolean z2 = context.getTheme() != null;
        if (z2) {
            Resources.Theme theme = cVar.getTheme();
            if (Build.VERSION.SDK_INT >= 29) {
                d.h.c.b.j.a(theme);
            } else {
                synchronized (d.h.c.b.i.a) {
                    if (!d.h.c.b.i.f2647c) {
                        try {
                            Method declaredMethod = Resources.Theme.class.getDeclaredMethod("rebase", new Class[0]);
                            d.h.c.b.i.f2646b = declaredMethod;
                            declaredMethod.setAccessible(true);
                        } catch (NoSuchMethodException e2) {
                            Log.i("ResourcesCompat", "Failed to retrieve rebase() method", e2);
                        }
                        d.h.c.b.i.f2647c = true;
                    }
                    Method method = d.h.c.b.i.f2646b;
                    if (method != null) {
                        try {
                            method.invoke(theme, new Object[0]);
                        } catch (IllegalAccessException | InvocationTargetException e3) {
                            Log.i("ResourcesCompat", "Failed to invoke rebase() method via reflection", e3);
                            d.h.c.b.i.f2646b = null;
                        }
                    }
                }
            }
        }
        return cVar;
    }

    @Override // d.b.c.h
    public <T extends View> T e(int i2) {
        M();
        return (T) this.f1571t.findViewById(i2);
    }

    @Override // d.b.c.h
    public final d.b.c.b f() {
        return new b(this);
    }

    @Override // d.b.c.h
    public int g() {
        return this.f1565a0;
    }

    @Override // d.b.c.h
    public MenuInflater h() {
        if (this.f1575x == null) {
            S();
            d.b.c.a aVar = this.f1574w;
            this.f1575x = new d.b.f.f(aVar != null ? aVar.e() : this.f1570s);
        }
        return this.f1575x;
    }

    @Override // d.b.c.h
    public d.b.c.a i() {
        S();
        return this.f1574w;
    }

    @Override // d.b.c.h
    public void j() {
        LayoutInflater layoutInflaterFrom = LayoutInflater.from(this.f1570s);
        if (layoutInflaterFrom.getFactory() == null) {
            layoutInflaterFrom.setFactory2(this);
        } else {
            if (layoutInflaterFrom.getFactory2() instanceof i) {
                return;
            }
            Log.i("AppCompatDelegate", "The Activity's LayoutInflater already has a Factory installed so we can not install AppCompat's");
        }
    }

    @Override // d.b.c.h
    public void k() {
        S();
        d.b.c.a aVar = this.f1574w;
        if (aVar == null || !aVar.f()) {
            T(0);
        }
    }

    @Override // d.b.c.h
    public void l(Configuration configuration) {
        if (this.N && this.H) {
            S();
            d.b.c.a aVar = this.f1574w;
            if (aVar != null) {
                aVar.g(configuration);
            }
        }
        d.b.g.j jVarA = d.b.g.j.a();
        Context context = this.f1570s;
        synchronized (jVarA) {
            p0 p0Var = jVarA.f1982c;
            synchronized (p0Var) {
                d.e.e<WeakReference<Drawable.ConstantState>> eVar = p0Var.f2052g.get(context);
                if (eVar != null) {
                    eVar.b();
                }
            }
        }
        D(false);
    }

    @Override // d.b.c.h
    public void m(Bundle bundle) {
        this.W = true;
        D(false);
        N();
        Object obj = this.f1569r;
        if (obj instanceof Activity) {
            String strP = null;
            try {
                Activity activity = (Activity) obj;
                try {
                    strP = d.h.b.h.p(activity, activity.getComponentName());
                } catch (PackageManager.NameNotFoundException e2) {
                    throw new IllegalArgumentException(e2);
                }
            } catch (IllegalArgumentException unused) {
            }
            if (strP != null) {
                d.b.c.a aVar = this.f1574w;
                if (aVar == null) {
                    this.j0 = true;
                } else {
                    aVar.l(true);
                }
            }
            synchronized (d.b.c.h.f1560m) {
                d.b.c.h.t(this);
                d.b.c.h.f1559f.add(new WeakReference<>(this));
            }
        }
        this.X = true;
    }

    /* JADX WARN: Removed duplicated region for block: B:22:0x0050  */
    @Override // d.b.c.h
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public void n() {
        /*
            r3 = this;
            java.lang.Object r0 = r3.f1569r
            boolean r0 = r0 instanceof android.app.Activity
            if (r0 == 0) goto L11
            java.lang.Object r0 = d.b.c.h.f1560m
            monitor-enter(r0)
            d.b.c.h.t(r3)     // Catch: java.lang.Throwable -> Le
            monitor-exit(r0)     // Catch: java.lang.Throwable -> Le
            goto L11
        Le:
            r1 = move-exception
            monitor-exit(r0)     // Catch: java.lang.Throwable -> Le
            throw r1
        L11:
            boolean r0 = r3.g0
            if (r0 == 0) goto L20
            android.view.Window r0 = r3.f1571t
            android.view.View r0 = r0.getDecorView()
            java.lang.Runnable r1 = r3.i0
            r0.removeCallbacks(r1)
        L20:
            r0 = 0
            r3.Y = r0
            r0 = 1
            r3.Z = r0
            int r0 = r3.f1565a0
            r1 = -100
            if (r0 == r1) goto L50
            java.lang.Object r0 = r3.f1569r
            boolean r1 = r0 instanceof android.app.Activity
            if (r1 == 0) goto L50
            android.app.Activity r0 = (android.app.Activity) r0
            boolean r0 = r0.isChangingConfigurations()
            if (r0 == 0) goto L50
            d.e.h<java.lang.String, java.lang.Integer> r0 = d.b.c.i.f1561n
            java.lang.Object r1 = r3.f1569r
            java.lang.Class r1 = r1.getClass()
            java.lang.String r1 = r1.getName()
            int r2 = r3.f1565a0
            java.lang.Integer r2 = java.lang.Integer.valueOf(r2)
            r0.put(r1, r2)
            goto L5f
        L50:
            d.e.h<java.lang.String, java.lang.Integer> r0 = d.b.c.i.f1561n
            java.lang.Object r1 = r3.f1569r
            java.lang.Class r1 = r1.getClass()
            java.lang.String r1 = r1.getName()
            r0.remove(r1)
        L5f:
            d.b.c.a r0 = r3.f1574w
            if (r0 == 0) goto L66
            r0.h()
        L66:
            d.b.c.i$g r0 = r3.e0
            if (r0 == 0) goto L6d
            r0.a()
        L6d:
            d.b.c.i$g r0 = r3.f0
            if (r0 == 0) goto L74
            r0.a()
        L74:
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: d.b.c.i.n():void");
    }

    @Override // d.b.c.h
    public void o(Bundle bundle) {
        M();
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r7v10, types: [java.lang.Object[]] */
    /* JADX WARN: Type inference failed for: r7v11, types: [java.lang.Object[]] */
    /* JADX WARN: Type inference failed for: r7v12, types: [java.lang.Object[]] */
    /* JADX WARN: Type inference failed for: r7v13, types: [java.lang.Object[]] */
    /* JADX WARN: Type inference failed for: r7v8 */
    /*  JADX ERROR: JadxRuntimeException in pass: RegionMakerVisitor
        jadx.core.utils.exceptions.JadxRuntimeException: Can't find top splitter block for handler:B:118:0x01ec
        	at jadx.core.utils.BlockUtils.getTopSplitterForHandler(BlockUtils.java:1182)
        	at jadx.core.dex.visitors.regions.maker.ExcHandlersRegionMaker.collectHandlerRegions(ExcHandlersRegionMaker.java:53)
        	at jadx.core.dex.visitors.regions.maker.ExcHandlersRegionMaker.process(ExcHandlersRegionMaker.java:38)
        	at jadx.core.dex.visitors.regions.RegionMakerVisitor.visit(RegionMakerVisitor.java:27)
        */
    @Override // android.view.LayoutInflater.Factory2
    public final android.view.View onCreateView(android.view.View r7, java.lang.String r8, android.content.Context r9, android.util.AttributeSet r10) {
        /*
            Method dump skipped, instruction units count: 632
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: d.b.c.i.onCreateView(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet):android.view.View");
    }

    @Override // android.view.LayoutInflater.Factory
    public View onCreateView(String str, Context context, AttributeSet attributeSet) {
        return onCreateView(null, str, context, attributeSet);
    }

    @Override // d.b.c.h
    public void p() {
        S();
        d.b.c.a aVar = this.f1574w;
        if (aVar != null) {
            aVar.m(true);
        }
    }

    @Override // d.b.c.h
    public void q(Bundle bundle) {
    }

    @Override // d.b.c.h
    public void r() {
        this.Y = true;
        C();
    }

    @Override // d.b.c.h
    public void s() {
        this.Y = false;
        S();
        d.b.c.a aVar = this.f1574w;
        if (aVar != null) {
            aVar.m(false);
        }
    }

    @Override // d.b.c.h
    public boolean u(int i2) {
        if (i2 == 8) {
            Log.i("AppCompatDelegate", "You should now use the AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR id when requesting this feature.");
            i2 = 108;
        } else if (i2 == 9) {
            Log.i("AppCompatDelegate", "You should now use the AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR_OVERLAY id when requesting this feature.");
            i2 = 109;
        }
        if (this.R && i2 == 108) {
            return false;
        }
        if (this.N && i2 == 1) {
            this.N = false;
        }
        if (i2 == 1) {
            Z();
            this.R = true;
            return true;
        }
        if (i2 == 2) {
            Z();
            this.L = true;
            return true;
        }
        if (i2 == 5) {
            Z();
            this.M = true;
            return true;
        }
        if (i2 == 10) {
            Z();
            this.P = true;
            return true;
        }
        if (i2 == 108) {
            Z();
            this.N = true;
            return true;
        }
        if (i2 != 109) {
            return this.f1571t.requestFeature(i2);
        }
        Z();
        this.O = true;
        return true;
    }

    @Override // d.b.c.h
    public void v(int i2) {
        M();
        ViewGroup viewGroup = (ViewGroup) this.I.findViewById(R.id.content);
        viewGroup.removeAllViews();
        LayoutInflater.from(this.f1570s).inflate(i2, viewGroup);
        this.f1572u.f1724f.onContentChanged();
    }

    @Override // d.b.c.h
    public void w(View view) {
        M();
        ViewGroup viewGroup = (ViewGroup) this.I.findViewById(R.id.content);
        viewGroup.removeAllViews();
        viewGroup.addView(view);
        this.f1572u.f1724f.onContentChanged();
    }

    @Override // d.b.c.h
    public void x(View view, ViewGroup.LayoutParams layoutParams) {
        M();
        ViewGroup viewGroup = (ViewGroup) this.I.findViewById(R.id.content);
        viewGroup.removeAllViews();
        viewGroup.addView(view, layoutParams);
        this.f1572u.f1724f.onContentChanged();
    }

    @Override // d.b.c.h
    public void y(Toolbar toolbar) {
        Window window;
        Window.Callback callback;
        if (this.f1569r instanceof Activity) {
            S();
            d.b.c.a aVar = this.f1574w;
            if (aVar instanceof s) {
                throw new IllegalStateException("This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead.");
            }
            this.f1575x = null;
            if (aVar != null) {
                aVar.h();
            }
            if (toolbar != null) {
                Object obj = this.f1569r;
                p pVar = new p(toolbar, obj instanceof Activity ? ((Activity) obj).getTitle() : this.f1576y, this.f1572u);
                this.f1574w = pVar;
                window = this.f1571t;
                callback = pVar.f1618c;
            } else {
                this.f1574w = null;
                window = this.f1571t;
                callback = this.f1572u;
            }
            window.setCallback(callback);
            k();
        }
    }

    @Override // d.b.c.h
    public void z(int i2) {
        this.f1566b0 = i2;
    }
}
