content: package androidx.appcompat.app;
  
  import android.app.Activity;
  import android.app.Dialog;
  import android.app.UiModeManager;
  import android.content.BroadcastReceiver;
  import android.content.ComponentName;
  import android.content.Context;
  import android.content.ContextWrapper;
  import android.content.Intent;
  import android.content.IntentFilter;
  import android.content.pm.ActivityInfo;
  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.media.AudioManager;
  import android.os.Build;
  import android.os.Bundle;
  import android.os.LocaleList;
  import android.os.Parcel;
  import android.os.Parcelable;
  import android.os.PowerManager;
  import android.text.TextUtils;
  import android.util.AndroidRuntimeException;
  import android.util.AttributeSet;
  import android.util.DisplayMetrics;
  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.ViewParent;
  import android.view.Window;
  import android.view.WindowManager;
  import android.widget.PopupWindow;
  import android.widget.TextView;
  import androidx.appcompat.R;
  import androidx.appcompat.app.ActionBarDrawerToggle;
  import androidx.appcompat.content.res.AppCompatResources;
  import androidx.appcompat.view.ActionMode;
  import androidx.appcompat.view.StandaloneActionMode;
  import androidx.appcompat.view.SupportActionModeWrapper;
  import androidx.appcompat.view.SupportMenuInflater;
  import androidx.appcompat.view.WindowCallbackWrapper;
  import androidx.appcompat.view.menu.ListMenuPresenter;
  import androidx.appcompat.view.menu.MenuBuilder;
  import androidx.appcompat.view.menu.MenuPresenter;
  import androidx.appcompat.view.menu.MenuView;
  import androidx.appcompat.widget.ActionBarContextView;
  import androidx.appcompat.widget.AppCompatDrawableManager;
  import androidx.appcompat.widget.ContentFrameLayout;
  import androidx.appcompat.widget.DecorContentParent;
  import androidx.appcompat.widget.TintTypedArray;
  import androidx.appcompat.widget.Toolbar;
  import androidx.appcompat.widget.VectorEnabledTintResources;
  import androidx.appcompat.widget.ViewStubCompat;
  import androidx.collection.SimpleArrayMap;
  import androidx.core.app.ActivityCompat;
  import androidx.core.app.NavUtils;
  import androidx.core.content.ContextCompat;
  import androidx.core.content.res.ResourcesCompat;
  import androidx.core.util.ObjectsCompat;
  import androidx.core.view.KeyEventDispatcher;
  import androidx.core.view.LayoutInflaterCompat;
  import androidx.core.view.PointerIconCompat;
  import androidx.core.view.ViewCompat;
  import androidx.core.view.ViewPropertyAnimatorCompat;
  import androidx.core.view.ViewPropertyAnimatorListener;
  import androidx.core.view.ViewPropertyAnimatorListenerAdapter;
  import androidx.core.widget.PopupWindowCompat;
  import androidx.lifecycle.Lifecycle;
  import androidx.lifecycle.LifecycleOwner;
  import java.lang.Thread;
  import java.util.List;
  import mt.Log1F380D;
  import org.xmlpull.v1.XmlPullParser;
  
  /* compiled from: 0004 */
  class AppCompatDelegateImpl extends AppCompatDelegate implements MenuBuilder.Callback, LayoutInflater.Factory2 {
      static final String EXCEPTION_HANDLER_MESSAGE_SUFFIX = ". If the resource you are trying to use is a vector resource, you may be referencing it in an unsupported way. See AppCompatDelegate.setCompatVectorFromResourcesEnabled() for more info.";
      private static final boolean IS_PRE_LOLLIPOP;
      private static final boolean sCanApplyOverrideConfiguration;
      private static final boolean sCanReturnDifferentContext = (!"robolectric".equals(Build.FINGERPRINT));
      private static boolean sInstalledExceptionHandler = true;
      private static final SimpleArrayMap<String, Integer> sLocalNightModes = new SimpleArrayMap<>();
      private static final int[] sWindowBackgroundStyleable = {16842836};
      ActionBar mActionBar;
      private ActionMenuPresenterCallback mActionMenuPresenterCallback;
      ActionMode mActionMode;
      PopupWindow mActionModePopup;
      ActionBarContextView mActionModeView;
      private boolean mActivityHandlesUiMode;
      private boolean mActivityHandlesUiModeChecked;
      final AppCompatCallback mAppCompatCallback;
      private AppCompatViewInflater mAppCompatViewInflater;
      private AppCompatWindowCallback mAppCompatWindowCallback;
      private AutoNightModeManager mAutoBatteryNightModeManager;
      private AutoNightModeManager mAutoTimeNightModeManager;
      private boolean mBaseContextAttached;
      private boolean mClosingActionMenu;
      final Context mContext;
      private boolean mCreated;
      private DecorContentParent mDecorContentParent;
      boolean mDestroyed;
      private Configuration mEffectiveConfiguration;
      private boolean mEnableDefaultActionBarUp;
      ViewPropertyAnimatorCompat mFadeAnim;
      private boolean mFeatureIndeterminateProgress;
      private boolean mFeatureProgress;
      private boolean mHandleNativeActionModes;
      boolean mHasActionBar;
      final Object mHost;
      int mInvalidatePanelMenuFeatures;
      boolean mInvalidatePanelMenuPosted;
      private final Runnable mInvalidatePanelMenuRunnable;
      boolean mIsFloating;
      private LayoutIncludeDetector mLayoutIncludeDetector;
      private int mLocalNightMode;
      private boolean mLongPressBackDown;
      MenuInflater mMenuInflater;
      boolean mOverlayActionBar;
      boolean mOverlayActionMode;
      private PanelMenuPresenterCallback mPanelMenuPresenterCallback;
      private PanelFeatureState[] mPanels;
      private PanelFeatureState mPreparedPanel;
      Runnable mShowActionModePopup;
      private View mStatusGuard;
      ViewGroup mSubDecor;
      private boolean mSubDecorInstalled;
      private Rect mTempRect1;
      private Rect mTempRect2;
      private int mThemeResId;
      private CharSequence mTitle;
      private TextView mTitleView;
      Window mWindow;
      boolean mWindowNoTitle;
  
      private class ActionBarDrawableToggleImpl implements ActionBarDrawerToggle.Delegate {
          ActionBarDrawableToggleImpl() {
          }
  
          public Context getActionBarThemedContext() {
              return AppCompatDelegateImpl.this.getActionBarThemedContext();
          }
  
          public Drawable getThemeUpIndicator() {
              TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(getActionBarThemedContext(), (AttributeSet) null, new int[]{R.attr.homeAsUpIndicator});
              Drawable drawable = obtainStyledAttributes.getDrawable(0);
              obtainStyledAttributes.recycle();
              return drawable;
          }
  
          public boolean isNavigationVisible() {
              ActionBar supportActionBar = AppCompatDelegateImpl.this.getSupportActionBar();
              return (supportActionBar == null || (supportActionBar.getDisplayOptions() & 4) == 0) ? false : true;
          }
  
          public void setActionBarDescription(int contentDescRes) {
              ActionBar supportActionBar = AppCompatDelegateImpl.this.getSupportActionBar();
              if (supportActionBar != null) {
                  supportActionBar.setHomeActionContentDescription(contentDescRes);
              }
          }
  
          public void setActionBarUpIndicator(Drawable upDrawable, int contentDescRes) {
              ActionBar supportActionBar = AppCompatDelegateImpl.this.getSupportActionBar();
              if (supportActionBar != null) {
                  supportActionBar.setHomeAsUpIndicator(upDrawable);
                  supportActionBar.setHomeActionContentDescription(contentDescRes);
              }
          }
      }
  
      interface ActionBarMenuCallback {
          View onCreatePanelView(int i);
  
          boolean onPreparePanel(int i);
      }
  
      private final class ActionMenuPresenterCallback implements MenuPresenter.Callback {
          ActionMenuPresenterCallback() {
          }
  
          public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing) {
              AppCompatDelegateImpl.this.checkCloseActionMenu(menu);
          }
  
          public boolean onOpenSubMenu(MenuBuilder subMenu) {
              Window.Callback windowCallback = AppCompatDelegateImpl.this.getWindowCallback();
              if (windowCallback == null) {
                  return true;
              }
              windowCallback.onMenuOpened(AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR, subMenu);
              return true;
          }
      }
  
      class ActionModeCallbackWrapperV9 implements ActionMode.Callback {
          private ActionMode.Callback mWrapped;
  
          public ActionModeCallbackWrapperV9(ActionMode.Callback wrapped) {
              this.mWrapped = wrapped;
          }
  
          public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
              return this.mWrapped.onActionItemClicked(mode, item);
          }
  
          public boolean onCreateActionMode(ActionMode mode, Menu menu) {
              return this.mWrapped.onCreateActionMode(mode, menu);
          }
  
          public void onDestroyActionMode(ActionMode mode) {
              this.mWrapped.onDestroyActionMode(mode);
              if (AppCompatDelegateImpl.this.mActionModePopup != null) {
                  AppCompatDelegateImpl.this.mWindow.getDecorView().removeCallbacks(AppCompatDelegateImpl.this.mShowActionModePopup);
              }
              if (AppCompatDelegateImpl.this.mActionModeView != null) {
                  AppCompatDelegateImpl.this.endOnGoingFadeAnimation();
                  AppCompatDelegateImpl appCompatDelegateImpl = AppCompatDelegateImpl.this;
                  appCompatDelegateImpl.mFadeAnim = ViewCompat.animate(appCompatDelegateImpl.mActionModeView).alpha(0.0f);
                  AppCompatDelegateImpl.this.mFadeAnim.setListener(new ViewPropertyAnimatorListenerAdapter() {
                      public void onAnimationEnd(View view) {
                          AppCompatDelegateImpl.this.mActionModeView.setVisibility(8);
                          if (AppCompatDelegateImpl.this.mActionModePopup != null) {
                              AppCompatDelegateImpl.this.mActionModePopup.dismiss();
                          } else if (AppCompatDelegateImpl.this.mActionModeView.getParent() instanceof View) {
                              ViewCompat.requestApplyInsets((View) AppCompatDelegateImpl.this.mActionModeView.getParent());
                          }
                          AppCompatDelegateImpl.this.mActionModeView.killMode();
                          AppCompatDelegateImpl.this.mFadeAnim.setListener((ViewPropertyAnimatorListener) null);
                          AppCompatDelegateImpl.this.mFadeAnim = null;
                          ViewCompat.requestApplyInsets(AppCompatDelegateImpl.this.mSubDecor);
                      }
                  });
              }
              if (AppCompatDelegateImpl.this.mAppCompatCallback != null) {
                  AppCompatDelegateImpl.this.mAppCompatCallback.onSupportActionModeFinished(AppCompatDelegateImpl.this.mActionMode);
              }
              AppCompatDelegateImpl.this.mActionMode = null;
              ViewCompat.requestApplyInsets(AppCompatDelegateImpl.this.mSubDecor);
          }
  
          public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
              ViewCompat.requestApplyInsets(AppCompatDelegateImpl.this.mSubDecor);
              return this.mWrapped.onPrepareActionMode(mode, menu);
          }
      }
  
      static class Api17Impl {
          private Api17Impl() {
          }
  
          static Context createConfigurationContext(Context context, Configuration overrideConfiguration) {
              return context.createConfigurationContext(overrideConfiguration);
          }
  
          static void generateConfigDelta_densityDpi(Configuration base, Configuration change, Configuration delta) {
              if (base.densityDpi != change.densityDpi) {
                  delta.densityDpi = change.densityDpi;
              }
          }
      }
  
      static class Api21Impl {
          private Api21Impl() {
          }
  
          static boolean isPowerSaveMode(PowerManager powerManager) {
              return powerManager.isPowerSaveMode();
          }
      }
  
      static class Api24Impl {
          private Api24Impl() {
          }
  
          static void generateConfigDelta_locale(Configuration base, Configuration change, Configuration delta) {
              LocaleList locales = base.getLocales();
              LocaleList locales2 = change.getLocales();
              if (!locales.equals(locales2)) {
                  delta.setLocales(locales2);
                  delta.locale = change.locale;
              }
          }
      }
  
      static class Api26Impl {
          private Api26Impl() {
          }
  
          static void generateConfigDelta_colorMode(Configuration base, Configuration change, Configuration delta) {
              if ((base.colorMode & 3) != (change.colorMode & 3)) {
                  delta.colorMode |= change.colorMode & 3;
              }
              if ((base.colorMode & 12) != (change.colorMode & 12)) {
                  delta.colorMode |= change.colorMode & 12;
              }
          }
      }
  
      class AppCompatWindowCallback extends WindowCallbackWrapper {
          private ActionBarMenuCallback mActionBarCallback;
          private boolean mDispatchKeyEventBypassEnabled;
          private boolean mOnContentChangedBypassEnabled;
          private boolean mOnPanelClosedBypassEnabled;
  
          AppCompatWindowCallback(Window.Callback callback) {
              super(callback);
          }
  
          /* JADX INFO: finally extract failed */
          public boolean bypassDispatchKeyEvent(Window.Callback c, KeyEvent e) {
              try {
                  this.mDispatchKeyEventBypassEnabled = true;
                  boolean dispatchKeyEvent = c.dispatchKeyEvent(e);
                  this.mDispatchKeyEventBypassEnabled = false;
                  return dispatchKeyEvent;
              } catch (Throwable th) {
                  this.mDispatchKeyEventBypassEnabled = false;
                  throw th;
              }
          }
  
          /* JADX INFO: finally extract failed */
          public void bypassOnContentChanged(Window.Callback c) {
              try {
                  this.mOnContentChangedBypassEnabled = true;
                  c.onContentChanged();
                  this.mOnContentChangedBypassEnabled = false;
              } catch (Throwable th) {
                  this.mOnContentChangedBypassEnabled = false;
                  throw th;
              }
          }
  
          /* JADX INFO: finally extract failed */
          public void bypassOnPanelClosed(Window.Callback c, int featureId, Menu menu) {
              try {
                  this.mOnPanelClosedBypassEnabled = true;
                  c.onPanelClosed(featureId, menu);
                  this.mOnPanelClosedBypassEnabled = false;
              } catch (Throwable th) {
                  this.mOnPanelClosedBypassEnabled = false;
                  throw th;
              }
          }
  
          public boolean dispatchKeyEvent(KeyEvent event) {
              return this.mDispatchKeyEventBypassEnabled ? getWrapped().dispatchKeyEvent(event) : AppCompatDelegateImpl.this.dispatchKeyEvent(event) || super.dispatchKeyEvent(event);
          }
  
          public boolean dispatchKeyShortcutEvent(KeyEvent event) {
              return super.dispatchKeyShortcutEvent(event) || AppCompatDelegateImpl.this.onKeyShortcut(event.getKeyCode(), event);
          }
  
          public void onContentChanged() {
              if (this.mOnContentChangedBypassEnabled) {
                  getWrapped().onContentChanged();
              }
          }
  
          public boolean onCreatePanelMenu(int featureId, Menu menu) {
              if (featureId != 0 || (menu instanceof MenuBuilder)) {
                  return super.onCreatePanelMenu(featureId, menu);
              }
              return false;
          }
  
          /* JADX WARNING: Code restructure failed: missing block: B:2:0x0004, code lost:
              r0 = r0.onCreatePanelView(r2);
           */
          /* Code decompiled incorrectly, please refer to instructions dump. */
          public android.view.View onCreatePanelView(int r2) {
              /*
                  r1 = this;
                  androidx.appcompat.app.AppCompatDelegateImpl$ActionBarMenuCallback r0 = r1.mActionBarCallback
                  if (r0 == 0) goto L_0x000b
                  android.view.View r0 = r0.onCreatePanelView(r2)
                  if (r0 == 0) goto L_0x000b
                  return r0
              L_0x000b:
                  android.view.View r0 = super.onCreatePanelView(r2)
                  return r0
              */
              throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.app.AppCompatDelegateImpl.AppCompatWindowCallback.onCreatePanelView(int):android.view.View");
          }
  
          public boolean onMenuOpened(int featureId, Menu menu) {
              super.onMenuOpened(featureId, menu);
              AppCompatDelegateImpl.this.onMenuOpened(featureId);
              return true;
          }
  
          public void onPanelClosed(int featureId, Menu menu) {
              if (this.mOnPanelClosedBypassEnabled) {
                  getWrapped().onPanelClosed(featureId, menu);
                  return;
              }
              super.onPanelClosed(featureId, menu);
              AppCompatDelegateImpl.this.onPanelClosed(featureId);
          }
  
          public boolean onPreparePanel(int featureId, View view, Menu menu) {
              MenuBuilder menuBuilder = menu instanceof MenuBuilder ? (MenuBuilder) menu : null;
              if (featureId == 0 && menuBuilder == null) {
                  return false;
              }
              if (menuBuilder != null) {
                  menuBuilder.setOverrideVisibleItems(true);
              }
              boolean z = false;
              ActionBarMenuCallback actionBarMenuCallback = this.mActionBarCallback;
              if (actionBarMenuCallback != null && actionBarMenuCallback.onPreparePanel(featureId)) {
                  z = true;
              }
              if (!z) {
                  z = super.onPreparePanel(featureId, view, menu);
              }
              if (menuBuilder != null) {
                  menuBuilder.setOverrideVisibleItems(false);
              }
              return z;
          }
  
          public void onProvideKeyboardShortcuts(List<KeyboardShortcutGroup> list, Menu menu, int deviceId) {
              PanelFeatureState panelState = AppCompatDelegateImpl.this.getPanelState(0, true);
              if (panelState == null || panelState.menu == null) {
                  super.onProvideKeyboardShortcuts(list, menu, deviceId);
              } else {
                  super.onProvideKeyboardShortcuts(list, panelState.menu, deviceId);
              }
          }
  
          public android.view.ActionMode onWindowStartingActionMode(ActionMode.Callback callback) {
              if (Build.VERSION.SDK_INT >= 23) {
                  return null;
              }
              return AppCompatDelegateImpl.this.isHandleNativeActionModesEnabled() ? startAsSupportActionMode(callback) : super.onWindowStartingActionMode(callback);
          }
  
          public android.view.ActionMode onWindowStartingActionMode(ActionMode.Callback callback, int type) {
              if (AppCompatDelegateImpl.this.isHandleNativeActionModesEnabled()) {
                  switch (type) {
                      case 0:
                          return startAsSupportActionMode(callback);
                  }
              }
              return super.onWindowStartingActionMode(callback, type);
          }
  
          /* access modifiers changed from: package-private */
          public void setActionBarCallback(ActionBarMenuCallback callback) {
              this.mActionBarCallback = callback;
          }
  
          /* access modifiers changed from: package-private */
          public final android.view.ActionMode startAsSupportActionMode(ActionMode.Callback callback) {
              SupportActionModeWrapper.CallbackWrapper callbackWrapper = new SupportActionModeWrapper.CallbackWrapper(AppCompatDelegateImpl.this.mContext, callback);
              androidx.appcompat.view.ActionMode startSupportActionMode = AppCompatDelegateImpl.this.startSupportActionMode(callbackWrapper);
              if (startSupportActionMode != null) {
                  return callbackWrapper.getActionModeWrapper(startSupportActionMode);
              }
              return null;
          }
      }
  
      private class AutoBatteryNightModeManager extends AutoNightModeManager {
          private final PowerManager mPowerManager;
  
          AutoBatteryNightModeManager(Context context) {
              super();
              this.mPowerManager = (PowerManager) context.getApplicationContext().getSystemService("power");
          }
  
          /* access modifiers changed from: package-private */
          public IntentFilter createIntentFilterForBroadcastReceiver() {
              if (Build.VERSION.SDK_INT < 21) {
                  return null;
              }
              IntentFilter intentFilter = new IntentFilter();
              intentFilter.addAction("android.os.action.POWER_SAVE_MODE_CHANGED");
              return intentFilter;
          }
  
          public int getApplyableNightMode() {
              return (Build.VERSION.SDK_INT < 21 || !Api21Impl.isPowerSaveMode(this.mPowerManager)) ? 1 : 2;
          }
  
          public void onChange() {
              AppCompatDelegateImpl.this.applyDayNight();
          }
      }
  
      abstract class AutoNightModeManager {
          private BroadcastReceiver mReceiver;
  
          AutoNightModeManager() {
          }
  
          /* access modifiers changed from: package-private */
          public void cleanup() {
              if (this.mReceiver != null) {
                  try {
                      AppCompatDelegateImpl.this.mContext.unregisterReceiver(this.mReceiver);
                  } catch (IllegalArgumentException e) {
                  }
                  this.mReceiver = null;
              }
          }
  
          /* access modifiers changed from: package-private */
          public abstract IntentFilter createIntentFilterForBroadcastReceiver();
  
          /* access modifiers changed from: package-private */
          public abstract int getApplyableNightMode();
  
          /* access modifiers changed from: package-private */
          public boolean isListening() {
              return this.mReceiver != null;
          }
  
          /* access modifiers changed from: package-private */
          public abstract void onChange();
  
          /* access modifiers changed from: package-private */
          public void setup() {
              cleanup();
              IntentFilter createIntentFilterForBroadcastReceiver = createIntentFilterForBroadcastReceiver();
              if (createIntentFilterForBroadcastReceiver != null && createIntentFilterForBroadcastReceiver.countActions() != 0) {
                  if (this.mReceiver == null) {
                      this.mReceiver = new BroadcastReceiver() {
                          public void onReceive(Context context, Intent intent) {
                              AutoNightModeManager.this.onChange();
                          }
                      };
                  }
                  AppCompatDelegateImpl.this.mContext.registerReceiver(this.mReceiver, createIntentFilterForBroadcastReceiver);
              }
          }
      }
  
      private class AutoTimeNightModeManager extends AutoNightModeManager {
          private final TwilightManager mTwilightManager;
  
          AutoTimeNightModeManager(TwilightManager twilightManager) {
              super();
              this.mTwilightManager = twilightManager;
          }
  
          /* access modifiers changed from: package-private */
          public IntentFilter createIntentFilterForBroadcastReceiver() {
              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;
          }
  
          public int getApplyableNightMode() {
              return this.mTwilightManager.isNight() ? 2 : 1;
          }
  
          public void onChange() {
              AppCompatDelegateImpl.this.applyDayNight();
          }
      }
  
      private static class ContextThemeWrapperCompatApi17Impl {
          private ContextThemeWrapperCompatApi17Impl() {
          }
  
          static void applyOverrideConfiguration(ContextThemeWrapper context, Configuration overrideConfiguration) {
              context.applyOverrideConfiguration(overrideConfiguration);
          }
      }
  
      private class ListMenuDecorView extends ContentFrameLayout {
          public ListMenuDecorView(Context context) {
              super(context);
          }
  
          private boolean isOutOfBounds(int x, int y) {
              return x < -5 || y < -5 || x > getWidth() + 5 || y > getHeight() + 5;
          }
  
          public boolean dispatchKeyEvent(KeyEvent event) {
              return AppCompatDelegateImpl.this.dispatchKeyEvent(event) || super.dispatchKeyEvent(event);
          }
  
          public boolean onInterceptTouchEvent(MotionEvent event) {
              if (event.getAction() != 0 || !isOutOfBounds((int) event.getX(), (int) event.getY())) {
                  return super.onInterceptTouchEvent(event);
              }
              AppCompatDelegateImpl.this.closePanel(0);
              return true;
          }
  
          public void setBackgroundResource(int resid) {
              setBackgroundDrawable(AppCompatResources.getDrawable(getContext(), resid));
          }
      }
  
      protected static final class PanelFeatureState {
          int background;
          View createdPanelView;
          ViewGroup decorView;
          int featureId;
          Bundle frozenActionViewState;
          Bundle frozenMenuState;
          int gravity;
          boolean isHandled;
          boolean isOpen;
          boolean isPrepared;
          ListMenuPresenter listMenuPresenter;
          Context listPresenterContext;
          MenuBuilder menu;
          public boolean qwertyMode;
          boolean refreshDecorView = false;
          boolean refreshMenuContent;
          View shownPanelView;
          boolean wasLastOpen;
          int windowAnimations;
          int x;
          int y;
  
          private static class SavedState implements Parcelable {
              public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.ClassLoaderCreator<SavedState>() {
                  public SavedState createFromParcel(Parcel in) {
                      return SavedState.readFromParcel(in, (ClassLoader) null);
                  }
  
                  public SavedState createFromParcel(Parcel in, ClassLoader loader) {
                      return SavedState.readFromParcel(in, loader);
                  }
  
                  public SavedState[] newArray(int size) {
                      return new SavedState[size];
                  }
              };
              int featureId;
              boolean isOpen;
              Bundle menuState;
  
              SavedState() {
              }
  
              static SavedState readFromParcel(Parcel source, ClassLoader loader) {
                  SavedState savedState = new SavedState();
                  savedState.featureId = source.readInt();
                  boolean z = true;
                  if (source.readInt() != 1) {
                      z = false;
                  }
                  savedState.isOpen = z;
                  if (z) {
                      savedState.menuState = source.readBundle(loader);
                  }
                  return savedState;
              }
  
              public int describeContents() {
                  return 0;
              }
  
              public void writeToParcel(Parcel dest, int flags) {
                  dest.writeInt(this.featureId);
                  dest.writeInt(this.isOpen ? 1 : 0);
                  if (this.isOpen) {
                      dest.writeBundle(this.menuState);
                  }
              }
          }
  
          PanelFeatureState(int featureId2) {
              this.featureId = featureId2;
          }
  
          /* access modifiers changed from: package-private */
          public void applyFrozenState() {
              Bundle bundle;
              MenuBuilder menuBuilder = this.menu;
              if (menuBuilder != null && (bundle = this.frozenMenuState) != null) {
                  menuBuilder.restorePresenterStates(bundle);
                  this.frozenMenuState = null;
              }
          }
  
          public void clearMenuPresenters() {
              MenuBuilder menuBuilder = this.menu;
              if (menuBuilder != null) {
                  menuBuilder.removeMenuPresenter(this.listMenuPresenter);
              }
              this.listMenuPresenter = null;
          }
  
          /* access modifiers changed from: package-private */
          public MenuView getListMenuView(MenuPresenter.Callback cb) {
              if (this.menu == null) {
                  return null;
              }
              if (this.listMenuPresenter == null) {
                  ListMenuPresenter listMenuPresenter2 = new ListMenuPresenter(this.listPresenterContext, R.layout.abc_list_menu_item_layout);
                  this.listMenuPresenter = listMenuPresenter2;
                  listMenuPresenter2.setCallback(cb);
                  this.menu.addMenuPresenter(this.listMenuPresenter);
              }
              return this.listMenuPresenter.getMenuView(this.decorView);
          }
  
          public boolean hasPanelItems() {
              if (this.shownPanelView == null) {
                  return false;
              }
              if (this.createdPanelView != null) {
                  return true;
              }
              return this.listMenuPresenter.getAdapter().getCount() > 0;
          }
  
          /* access modifiers changed from: package-private */
          public void onRestoreInstanceState(Parcelable state) {
              SavedState savedState = (SavedState) state;
              this.featureId = savedState.featureId;
              this.wasLastOpen = savedState.isOpen;
              this.frozenMenuState = savedState.menuState;
              this.shownPanelView = null;
              this.decorView = null;
          }
  
          /* access modifiers changed from: package-private */
          public Parcelable onSaveInstanceState() {
              SavedState savedState = new SavedState();
              savedState.featureId = this.featureId;
              savedState.isOpen = this.isOpen;
              if (this.menu != null) {
                  savedState.menuState = new Bundle();
                  this.menu.savePresenterStates(savedState.menuState);
              }
              return savedState;
          }
  
          /* access modifiers changed from: package-private */
          public void setMenu(MenuBuilder menu2) {
              ListMenuPresenter listMenuPresenter2;
              MenuBuilder menuBuilder = this.menu;
              if (menu2 != menuBuilder) {
                  if (menuBuilder != null) {
                      menuBuilder.removeMenuPresenter(this.listMenuPresenter);
                  }
                  this.menu = menu2;
                  if (menu2 != null && (listMenuPresenter2 = this.listMenuPresenter) != null) {
                      menu2.addMenuPresenter(listMenuPresenter2);
                  }
              }
          }
  
          /* access modifiers changed from: package-private */
          public void setStyle(Context context) {
              TypedValue typedValue = new TypedValue();
              Resources.Theme newTheme = context.getResources().newTheme();
              newTheme.setTo(context.getTheme());
              newTheme.resolveAttribute(R.attr.actionBarPopupTheme, typedValue, true);
              if (typedValue.resourceId != 0) {
                  newTheme.applyStyle(typedValue.resourceId, true);
              }
              newTheme.resolveAttribute(R.attr.panelMenuListTheme, typedValue, true);
              if (typedValue.resourceId != 0) {
                  newTheme.applyStyle(typedValue.resourceId, true);
              } else {
                  newTheme.applyStyle(R.style.Theme_AppCompat_CompactMenu, true);
              }
              Context context2 = new androidx.appcompat.view.ContextThemeWrapper(context, 0);
              context2.getTheme().setTo(newTheme);
              this.listPresenterContext = context2;
              TypedArray obtainStyledAttributes = context2.obtainStyledAttributes(R.styleable.AppCompatTheme);
              this.background = obtainStyledAttributes.getResourceId(R.styleable.AppCompatTheme_panelBackground, 0);
              this.windowAnimations = obtainStyledAttributes.getResourceId(R.styleable.AppCompatTheme_android_windowAnimationStyle, 0);
              obtainStyledAttributes.recycle();
          }
      }
  
      private final class PanelMenuPresenterCallback implements MenuPresenter.Callback {
          PanelMenuPresenterCallback() {
          }
  
          public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing) {
              MenuBuilder rootMenu = menu.getRootMenu();
              boolean z = rootMenu != menu;
              PanelFeatureState findMenuPanel = AppCompatDelegateImpl.this.findMenuPanel(z ? rootMenu : menu);
              if (findMenuPanel == null) {
                  return;
              }
              if (z) {
                  AppCompatDelegateImpl.this.callOnPanelClosed(findMenuPanel.featureId, findMenuPanel, rootMenu);
                  AppCompatDelegateImpl.this.closePanel(findMenuPanel, true);
                  return;
              }
              AppCompatDelegateImpl.this.closePanel(findMenuPanel, allMenusAreClosing);
          }
  
          public boolean onOpenSubMenu(MenuBuilder subMenu) {
              Window.Callback windowCallback;
              if (subMenu != subMenu.getRootMenu() || !AppCompatDelegateImpl.this.mHasActionBar || (windowCallback = AppCompatDelegateImpl.this.getWindowCallback()) == null || AppCompatDelegateImpl.this.mDestroyed) {
                  return true;
              }
              windowCallback.onMenuOpened(AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR, subMenu);
              return true;
          }
      }
  
      static {
          boolean z = false;
          boolean z2 = Build.VERSION.SDK_INT < 21;
          IS_PRE_LOLLIPOP = z2;
          if (Build.VERSION.SDK_INT >= 17) {
              z = true;
          }
          sCanApplyOverrideConfiguration = z;
          if (z2 && !sInstalledExceptionHandler) {
              final Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
              Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
                  private boolean shouldWrapException(Throwable throwable) {
                      String message;
                      if (!(throwable instanceof Resources.NotFoundException) || (message = throwable.getMessage()) == null) {
                          return false;
                      }
                      return message.contains("drawable") || message.contains("Drawable");
                  }
  
                  public void uncaughtException(Thread thread, Throwable throwable) {
                      if (shouldWrapException(throwable)) {
                          Resources.NotFoundException notFoundException = new Resources.NotFoundException(throwable.getMessage() + AppCompatDelegateImpl.EXCEPTION_HANDLER_MESSAGE_SUFFIX);
                          notFoundException.initCause(throwable.getCause());
                          notFoundException.setStackTrace(throwable.getStackTrace());
                          defaultUncaughtExceptionHandler.uncaughtException(thread, notFoundException);
                          return;
                      }
                      defaultUncaughtExceptionHandler.uncaughtException(thread, throwable);
                  }
              });
          }
      }
  
      AppCompatDelegateImpl(Activity activity, AppCompatCallback callback) {
          this(activity, (Window) null, callback, activity);
      }
  
      AppCompatDelegateImpl(Dialog dialog, AppCompatCallback callback) {
          this(dialog.getContext(), dialog.getWindow(), callback, dialog);
      }
  
      AppCompatDelegateImpl(Context context, Activity activity, AppCompatCallback callback) {
          this(context, (Window) null, callback, activity);
      }
  
      AppCompatDelegateImpl(Context context, Window window, AppCompatCallback callback) {
          this(context, window, callback, context);
      }
  
      /* JADX WARNING: Code restructure failed: missing block: B:9:0x0036, code lost:
          r0 = sLocalNightModes;
       */
      /* Code decompiled incorrectly, please refer to instructions dump. */
      private AppCompatDelegateImpl(android.content.Context r4, android.view.Window r5, androidx.appcompat.app.AppCompatCallback r6, java.lang.Object r7) {
          /*
              r3 = this;
              r3.<init>()
              r0 = 0
              r3.mFadeAnim = r0
              r0 = 1
              r3.mHandleNativeActionModes = r0
              r0 = -100
              r3.mLocalNightMode = r0
              androidx.appcompat.app.AppCompatDelegateImpl$2 r1 = new androidx.appcompat.app.AppCompatDelegateImpl$2
              r1.<init>()
              r3.mInvalidatePanelMenuRunnable = r1
              r3.mContext = r4
              r3.mAppCompatCallback = r6
              r3.mHost = r7
              int r1 = r3.mLocalNightMode
              if (r1 != r0) goto L_0x0032
              boolean r1 = r7 instanceof android.app.Dialog
              if (r1 == 0) goto L_0x0032
              androidx.appcompat.app.AppCompatActivity r1 = r3.tryUnwrapContext()
              if (r1 == 0) goto L_0x0032
              androidx.appcompat.app.AppCompatDelegate r2 = r1.getDelegate()
              int r2 = r2.getLocalNightMode()
              r3.mLocalNightMode = r2
          L_0x0032:
              int r1 = r3.mLocalNightMode
              if (r1 != r0) goto L_0x0059
              androidx.collection.SimpleArrayMap<java.lang.String, java.lang.Integer> r0 = sLocalNightModes
              java.lang.Class r1 = r7.getClass()
              java.lang.String r1 = r1.getName()
              java.lang.Object r1 = r0.get(r1)
              java.lang.Integer r1 = (java.lang.Integer) r1
              if (r1 == 0) goto L_0x0059
              int r2 = r1.intValue()
              r3.mLocalNightMode = r2
              java.lang.Class r2 = r7.getClass()
              java.lang.String r2 = r2.getName()
              r0.remove(r2)
          L_0x0059:
              if (r5 == 0) goto L_0x005e
              r3.attachToWindow(r5)
          L_0x005e:
              androidx.appcompat.widget.AppCompatDrawableManager.preload()
              return
          */
          throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.app.AppCompatDelegateImpl.<init>(android.content.Context, android.view.Window, androidx.appcompat.app.AppCompatCallback, java.lang.Object):void");
      }
  
      private boolean applyDayNight(boolean allowRecreation) {
          if (this.mDestroyed) {
              return false;
          }
          int calculateNightMode = calculateNightMode();
          boolean updateForNightMode = updateForNightMode(mapNightMode(this.mContext, calculateNightMode), allowRecreation);
          if (calculateNightMode == 0) {
              getAutoTimeNightModeManager(this.mContext).setup();
          } else {
              AutoNightModeManager autoNightModeManager = this.mAutoTimeNightModeManager;
              if (autoNightModeManager != null) {
                  autoNightModeManager.cleanup();
              }
          }
          if (calculateNightMode == 3) {
              getAutoBatteryNightModeManager(this.mContext).setup();
          } else {
              AutoNightModeManager autoNightModeManager2 = this.mAutoBatteryNightModeManager;
              if (autoNightModeManager2 != null) {
                  autoNightModeManager2.cleanup();
              }
          }
          return updateForNightMode;
      }
  
      private void applyFixedSizeWindow() {
          ContentFrameLayout contentFrameLayout = (ContentFrameLayout) this.mSubDecor.findViewById(16908290);
          View decorView = this.mWindow.getDecorView();
          contentFrameLayout.setDecorPadding(decorView.getPaddingLeft(), decorView.getPaddingTop(), decorView.getPaddingRight(), decorView.getPaddingBottom());
          TypedArray obtainStyledAttributes = this.mContext.obtainStyledAttributes(R.styleable.AppCompatTheme);
          obtainStyledAttributes.getValue(R.styleable.AppCompatTheme_windowMinWidthMajor, contentFrameLayout.getMinWidthMajor());
          obtainStyledAttributes.getValue(R.styleable.AppCompatTheme_windowMinWidthMinor, contentFrameLayout.getMinWidthMinor());
          if (obtainStyledAttributes.hasValue(R.styleable.AppCompatTheme_windowFixedWidthMajor)) {
              obtainStyledAttributes.getValue(R.styleable.AppCompatTheme_windowFixedWidthMajor, contentFrameLayout.getFixedWidthMajor());
          }
          if (obtainStyledAttributes.hasValue(R.styleable.AppCompatTheme_windowFixedWidthMinor)) {
              obtainStyledAttributes.getValue(R.styleable.AppCompatTheme_windowFixedWidthMinor, contentFrameLayout.getFixedWidthMinor());
          }
          if (obtainStyledAttributes.hasValue(R.styleable.AppCompatTheme_windowFixedHeightMajor)) {
              obtainStyledAttributes.getValue(R.styleable.AppCompatTheme_windowFixedHeightMajor, contentFrameLayout.getFixedHeightMajor());
          }
          if (obtainStyledAttributes.hasValue(R.styleable.AppCompatTheme_windowFixedHeightMinor)) {
              obtainStyledAttributes.getValue(R.styleable.AppCompatTheme_windowFixedHeightMinor, contentFrameLayout.getFixedHeightMinor());
          }
          obtainStyledAttributes.recycle();
          contentFrameLayout.requestLayout();
      }
  
      private void attachToWindow(Window window) {
          if (this.mWindow == null) {
              Window.Callback callback = window.getCallback();
              if (!(callback instanceof AppCompatWindowCallback)) {
                  AppCompatWindowCallback appCompatWindowCallback = new AppCompatWindowCallback(callback);
                  this.mAppCompatWindowCallback = appCompatWindowCallback;
                  window.setCallback(appCompatWindowCallback);
                  TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(this.mContext, (AttributeSet) null, sWindowBackgroundStyleable);
                  Drawable drawableIfKnown = obtainStyledAttributes.getDrawableIfKnown(0);
                  if (drawableIfKnown != null) {
                      window.setBackgroundDrawable(drawableIfKnown);
                  }
                  obtainStyledAttributes.recycle();
                  this.mWindow = window;
                  return;
              }
              throw new IllegalStateException("AppCompat has already installed itself into the Window");
          }
          throw new IllegalStateException("AppCompat has already installed itself into the Window");
      }
  
      private int calculateNightMode() {
          int i = this.mLocalNightMode;
          return i != -100 ? i : getDefaultNightMode();
      }
  
      private void cleanupAutoManagers() {
          AutoNightModeManager autoNightModeManager = this.mAutoTimeNightModeManager;
          if (autoNightModeManager != null) {
              autoNightModeManager.cleanup();
          }
          AutoNightModeManager autoNightModeManager2 = this.mAutoBatteryNightModeManager;
          if (autoNightModeManager2 != null) {
              autoNightModeManager2.cleanup();
          }
      }
  
      private Configuration createOverrideConfigurationForDayNight(Context context, int mode, Configuration configOverlay, boolean ignoreFollowSystem) {
          int i;
          switch (mode) {
              case 1:
                  i = 16;
                  break;
              case 2:
                  i = 32;
                  break;
              default:
                  if (!ignoreFollowSystem) {
                      i = context.getApplicationContext().getResources().getConfiguration().uiMode & 48;
                      break;
                  } else {
                      i = 0;
                      break;
                  }
          }
          Configuration configuration = new Configuration();
          configuration.fontScale = 0.0f;
          if (configOverlay != null) {
              configuration.setTo(configOverlay);
          }
          configuration.uiMode = (configuration.uiMode & -49) | i;
          return configuration;
      }
  
      /* JADX WARNING: type inference failed for: r3v28, types: [android.view.View] */
      /* JADX WARNING: type inference failed for: r3v30, types: [android.view.View] */
      /* JADX WARNING: type inference failed for: r8v5, types: [android.view.View] */
      /* JADX WARNING: type inference failed for: r3v36, types: [android.view.View] */
      /* JADX WARNING: Multi-variable type inference failed */
      /* Code decompiled incorrectly, please refer to instructions dump. */
      private android.view.ViewGroup createSubDecor() {
          /*
              r10 = this;
              android.content.Context r0 = r10.mContext
              int[] r1 = androidx.appcompat.R.styleable.AppCompatTheme
              android.content.res.TypedArray r0 = r0.obtainStyledAttributes(r1)
              int r1 = androidx.appcompat.R.styleable.AppCompatTheme_windowActionBar
              boolean r1 = r0.hasValue(r1)
              if (r1 == 0) goto L_0x01b5
              int r1 = androidx.appcompat.R.styleable.AppCompatTheme_windowNoTitle
              r2 = 0
              boolean r1 = r0.getBoolean(r1, r2)
              r3 = 1
              if (r1 == 0) goto L_0x001e
              r10.requestWindowFeature(r3)
              goto L_0x002b
          L_0x001e:
              int r1 = androidx.appcompat.R.styleable.AppCompatTheme_windowActionBar
              boolean r1 = r0.getBoolean(r1, r2)
              if (r1 == 0) goto L_0x002b
              r1 = 108(0x6c, float:1.51E-43)
              r10.requestWindowFeature(r1)
          L_0x002b:
              int r1 = androidx.appcompat.R.styleable.AppCompatTheme_windowActionBarOverlay
              boolean r1 = r0.getBoolean(r1, r2)
              r4 = 109(0x6d, float:1.53E-43)
              if (r1 == 0) goto L_0x0038
              r10.requestWindowFeature(r4)
          L_0x0038:
              int r1 = androidx.appcompat.R.styleable.AppCompatTheme_windowActionModeOverlay
              boolean r1 = r0.getBoolean(r1, r2)
              if (r1 == 0) goto L_0x0045
              r1 = 10
              r10.requestWindowFeature(r1)
          L_0x0045:
              int r1 = androidx.appcompat.R.styleable.AppCompatTheme_android_windowIsFloating
              boolean r1 = r0.getBoolean(r1, r2)
              r10.mIsFloating = r1
              r0.recycle()
              r10.ensureWindow()
              android.view.Window r1 = r10.mWindow
              r1.getDecorView()
              android.content.Context r1 = r10.mContext
              android.view.LayoutInflater r1 = android.view.LayoutInflater.from(r1)
              r5 = 0
              boolean r6 = r10.mWindowNoTitle
              r7 = 0
              if (r6 != 0) goto L_0x00d7
              boolean r6 = r10.mIsFloating
              if (r6 == 0) goto L_0x0077
              int r3 = androidx.appcompat.R.layout.abc_dialog_title_material
              android.view.View r3 = r1.inflate(r3, r7)
              r5 = r3
              android.view.ViewGroup r5 = (android.view.ViewGroup) r5
              r10.mOverlayActionBar = r2
              r10.mHasActionBar = r2
              goto L_0x00ee
          L_0x0077:
              boolean r6 = r10.mHasActionBar
              if (r6 == 0) goto L_0x00ee
              android.util.TypedValue r6 = new android.util.TypedValue
              r6.<init>()
              android.content.Context r8 = r10.mContext
              android.content.res.Resources$Theme r8 = r8.getTheme()
              int r9 = androidx.appcompat.R.attr.actionBarTheme
              r8.resolveAttribute(r9, r6, r3)
              int r3 = r6.resourceId
              if (r3 == 0) goto L_0x0099
              androidx.appcompat.view.ContextThemeWrapper r3 = new androidx.appcompat.view.ContextThemeWrapper
              android.content.Context r8 = r10.mContext
              int r9 = r6.resourceId
              r3.<init>((android.content.Context) r8, (int) r9)
              goto L_0x009b
          L_0x0099:
              android.content.Context r3 = r10.mContext
          L_0x009b:
              android.view.LayoutInflater r8 = android.view.LayoutInflater.from(r3)
              int r9 = androidx.appcompat.R.layout.abc_screen_toolbar
              android.view.View r8 = r8.inflate(r9, r7)
              r5 = r8
              android.view.ViewGroup r5 = (android.view.ViewGroup) r5
              int r8 = androidx.appcompat.R.id.decor_content_parent
              android.view.View r8 = r5.findViewById(r8)
              androidx.appcompat.widget.DecorContentParent r8 = (androidx.appcompat.widget.DecorContentParent) r8
              r10.mDecorContentParent = r8
              android.view.Window$Callback r9 = r10.getWindowCallback()
              r8.setWindowCallback(r9)
              boolean r8 = r10.mOverlayActionBar
              if (r8 == 0) goto L_0x00c2
              androidx.appcompat.widget.DecorContentParent r8 = r10.mDecorContentParent
              r8.initFeature(r4)
          L_0x00c2:
              boolean r4 = r10.mFeatureProgress
              if (r4 == 0) goto L_0x00cc
              androidx.appcompat.widget.DecorContentParent r4 = r10.mDecorContentParent
              r8 = 2
              r4.initFeature(r8)
          L_0x00cc:
              boolean r4 = r10.mFeatureIndeterminateProgress
              if (r4 == 0) goto L_0x00d6
              androidx.appcompat.widget.DecorContentParent r4 = r10.mDecorContentParent
              r8 = 5
              r4.initFeature(r8)
          L_0x00d6:
              goto L_0x00ee
          L_0x00d7:
              boolean r3 = r10.mOverlayActionMode
              if (r3 == 0) goto L_0x00e5
              int r3 = androidx.appcompat.R.layout.abc_screen_simple_overlay_action_mode
              android.view.View r3 = r1.inflate(r3, r7)
              r5 = r3
              android.view.ViewGroup r5 = (android.view.ViewGroup) r5
              goto L_0x00ee
          L_0x00e5:
              int r3 = androidx.appcompat.R.layout.abc_screen_simple
              android.view.View r3 = r1.inflate(r3, r7)
              r5 = r3
              android.view.ViewGroup r5 = (android.view.ViewGroup) r5
          L_0x00ee:
              if (r5 == 0) goto L_0x0164
              int r3 = android.os.Build.VERSION.SDK_INT
              r4 = 21
              if (r3 < r4) goto L_0x00ff
              androidx.appcompat.app.AppCompatDelegateImpl$3 r3 = new androidx.appcompat.app.AppCompatDelegateImpl$3
              r3.<init>()
              androidx.core.view.ViewCompat.setOnApplyWindowInsetsListener(r5, r3)
              goto L_0x010e
          L_0x00ff:
              boolean r3 = r5 instanceof androidx.appcompat.widget.FitWindowsViewGroup
              if (r3 == 0) goto L_0x010e
              r3 = r5
              androidx.appcompat.widget.FitWindowsViewGroup r3 = (androidx.appcompat.widget.FitWindowsViewGroup) r3
              androidx.appcompat.app.AppCompatDelegateImpl$4 r4 = new androidx.appcompat.app.AppCompatDelegateImpl$4
              r4.<init>()
              r3.setOnFitSystemWindowsListener(r4)
          L_0x010e:
              androidx.appcompat.widget.DecorContentParent r3 = r10.mDecorContentParent
              if (r3 != 0) goto L_0x011c
              int r3 = androidx.appcompat.R.id.title
              android.view.View r3 = r5.findViewById(r3)
              android.widget.TextView r3 = (android.widget.TextView) r3
              r10.mTitleView = r3
          L_0x011c:
              androidx.appcompat.widget.ViewUtils.makeOptionalFitsSystemWindows(r5)
              int r3 = androidx.appcompat.R.id.action_bar_activity_content
              android.view.View r3 = r5.findViewById(r3)
              androidx.appcompat.widget.ContentFrameLayout r3 = (androidx.appcompat.widget.ContentFrameLayout) r3
              android.view.Window r4 = r10.mWindow
              r6 = 16908290(0x1020002, float:2.3877235E-38)
              android.view.View r4 = r4.findViewById(r6)
              android.view.ViewGroup r4 = (android.view.ViewGroup) r4
              if (r4 == 0) goto L_0x0156
          L_0x0134:
              int r8 = r4.getChildCount()
              if (r8 <= 0) goto L_0x0145
              android.view.View r8 = r4.getChildAt(r2)
              r4.removeViewAt(r2)
              r3.addView(r8)
              goto L_0x0134
          L_0x0145:
              r2 = -1
              r4.setId(r2)
              r3.setId(r6)
              boolean r2 = r4 instanceof android.widget.FrameLayout
              if (r2 == 0) goto L_0x0156
              r2 = r4
              android.widget.FrameLayout r2 = (android.widget.FrameLayout) r2
              r2.setForeground(r7)
          L_0x0156:
              android.view.Window r2 = r10.mWindow
              r2.setContentView(r5)
              androidx.appcompat.app.AppCompatDelegateImpl$5 r2 = new androidx.appcompat.app.AppCompatDelegateImpl$5
              r2.<init>()
              r3.setAttachListener(r2)
              return r5
          L_0x0164:
              java.lang.IllegalArgumentException r2 = new java.lang.IllegalArgumentException
              java.lang.StringBuilder r3 = new java.lang.StringBuilder
              r3.<init>()
              java.lang.String r4 = "AppCompat does not support the current theme features: { windowActionBar: "
              java.lang.StringBuilder r3 = r3.append(r4)
              boolean r4 = r10.mHasActionBar
              java.lang.StringBuilder r3 = r3.append(r4)
              java.lang.String r4 = ", windowActionBarOverlay: "
              java.lang.StringBuilder r3 = r3.append(r4)
              boolean r4 = r10.mOverlayActionBar
              java.lang.StringBuilder r3 = r3.append(r4)
              java.lang.String r4 = ", android:windowIsFloating: "
              java.lang.StringBuilder r3 = r3.append(r4)
              boolean r4 = r10.mIsFloating
              java.lang.StringBuilder r3 = r3.append(r4)
              java.lang.String r4 = ", windowActionModeOverlay: "
              java.lang.StringBuilder r3 = r3.append(r4)
              boolean r4 = r10.mOverlayActionMode
              java.lang.StringBuilder r3 = r3.append(r4)
              java.lang.String r4 = ", windowNoTitle: "
              java.lang.StringBuilder r3 = r3.append(r4)
              boolean r4 = r10.mWindowNoTitle
              java.lang.StringBuilder r3 = r3.append(r4)
              java.lang.String r4 = " }"
              java.lang.StringBuilder r3 = r3.append(r4)
              java.lang.String r3 = r3.toString()
              r2.<init>(r3)
              throw r2
          L_0x01b5:
              r0.recycle()
              java.lang.IllegalStateException r1 = new java.lang.IllegalStateException
              java.lang.String r2 = "You need to use a Theme.AppCompat theme (or descendant) with this activity."
              r1.<init>(r2)
              throw r1
          */
          throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor():android.view.ViewGroup");
      }
  
      private void ensureSubDecor() {
          if (!this.mSubDecorInstalled) {
              this.mSubDecor = createSubDecor();
              CharSequence title = getTitle();
              if (!TextUtils.isEmpty(title)) {
                  DecorContentParent decorContentParent = this.mDecorContentParent;
                  if (decorContentParent != null) {
                      decorContentParent.setWindowTitle(title);
                  } else if (peekSupportActionBar() != null) {
                      peekSupportActionBar().setWindowTitle(title);
                  } else {
                      TextView textView = this.mTitleView;
                      if (textView != null) {
                          textView.setText(title);
                      }
                  }
              }
              applyFixedSizeWindow();
              onSubDecorInstalled(this.mSubDecor);
              this.mSubDecorInstalled = true;
              PanelFeatureState panelState = getPanelState(0, false);
              if (this.mDestroyed) {
                  return;
              }
              if (panelState == null || panelState.menu == null) {
                  invalidatePanelMenu(AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR);
              }
          }
      }
  
      private void ensureWindow() {
          if (this.mWindow == null) {
              Object obj = this.mHost;
              if (obj instanceof Activity) {
                  attachToWindow(((Activity) obj).getWindow());
              }
          }
          if (this.mWindow == null) {
              throw new IllegalStateException("We have not been given a Window");
          }
      }
  
      private static Configuration generateConfigDelta(Configuration base, Configuration change) {
          Configuration configuration = new Configuration();
          configuration.fontScale = 0.0f;
          if (change == null || base.diff(change) == 0) {
              return configuration;
          }
          if (base.fontScale != change.fontScale) {
              configuration.fontScale = change.fontScale;
          }
          if (base.mcc != change.mcc) {
              configuration.mcc = change.mcc;
          }
          if (base.mnc != change.mnc) {
              configuration.mnc = change.mnc;
          }
          if (Build.VERSION.SDK_INT >= 24) {
              Api24Impl.generateConfigDelta_locale(base, change, configuration);
          } else if (!ObjectsCompat.equals(base.locale, change.locale)) {
              configuration.locale = change.locale;
          }
          if (base.touchscreen != change.touchscreen) {
              configuration.touchscreen = change.touchscreen;
          }
          if (base.keyboard != change.keyboard) {
              configuration.keyboard = change.keyboard;
          }
          if (base.keyboardHidden != change.keyboardHidden) {
              configuration.keyboardHidden = change.keyboardHidden;
          }
          if (base.navigation != change.navigation) {
              configuration.navigation = change.navigation;
          }
          if (base.navigationHidden != change.navigationHidden) {
              configuration.navigationHidden = change.navigationHidden;
          }
          if (base.orientation != change.orientation) {
              configuration.orientation = change.orientation;
          }
          if ((base.screenLayout & 15) != (change.screenLayout & 15)) {
              configuration.screenLayout |= change.screenLayout & 15;
          }
          if ((base.screenLayout & 192) != (change.screenLayout & 192)) {
              configuration.screenLayout |= change.screenLayout & 192;
          }
          if ((base.screenLayout & 48) != (change.screenLayout & 48)) {
              configuration.screenLayout |= change.screenLayout & 48;
          }
          if ((base.screenLayout & 768) != (change.screenLayout & 768)) {
              configuration.screenLayout |= change.screenLayout & 768;
          }
          if (Build.VERSION.SDK_INT >= 26) {
              Api26Impl.generateConfigDelta_colorMode(base, change, configuration);
          }
          if ((base.uiMode & 15) != (change.uiMode & 15)) {
              configuration.uiMode |= change.uiMode & 15;
          }
          if ((base.uiMode & 48) != (change.uiMode & 48)) {
              configuration.uiMode |= change.uiMode & 48;
          }
          if (base.screenWidthDp != change.screenWidthDp) {
              configuration.screenWidthDp = change.screenWidthDp;
          }
          if (base.screenHeightDp != change.screenHeightDp) {
              configuration.screenHeightDp = change.screenHeightDp;
          }
          if (base.smallestScreenWidthDp != change.smallestScreenWidthDp) {
              configuration.smallestScreenWidthDp = change.smallestScreenWidthDp;
          }
          if (Build.VERSION.SDK_INT >= 17) {
              Api17Impl.generateConfigDelta_densityDpi(base, change, configuration);
          }
          return configuration;
      }
  
      private AutoNightModeManager getAutoBatteryNightModeManager(Context context) {
          if (this.mAutoBatteryNightModeManager == null) {
              this.mAutoBatteryNightModeManager = new AutoBatteryNightModeManager(context);
          }
          return this.mAutoBatteryNightModeManager;
      }
  
      private AutoNightModeManager getAutoTimeNightModeManager(Context context) {
          if (this.mAutoTimeNightModeManager == null) {
              this.mAutoTimeNightModeManager = new AutoTimeNightModeManager(TwilightManager.getInstance(context));
          }
          return this.mAutoTimeNightModeManager;
      }
  
      private void initWindowDecorActionBar() {
          ensureSubDecor();
          if (this.mHasActionBar && this.mActionBar == null) {
              Object obj = this.mHost;
              if (obj instanceof Activity) {
                  this.mActionBar = new WindowDecorActionBar((Activity) this.mHost, this.mOverlayActionBar);
              } else if (obj instanceof Dialog) {
                  this.mActionBar = new WindowDecorActionBar((Dialog) this.mHost);
              }
              ActionBar actionBar = this.mActionBar;
              if (actionBar != null) {
                  actionBar.setDefaultDisplayHomeAsUpEnabled(this.mEnableDefaultActionBarUp);
              }
          }
      }
  
      private boolean initializePanelContent(PanelFeatureState st) {
          if (st.createdPanelView != null) {
              st.shownPanelView = st.createdPanelView;
              return true;
          } else if (st.menu == null) {
              return false;
          } else {
              if (this.mPanelMenuPresenterCallback == null) {
                  this.mPanelMenuPresenterCallback = new PanelMenuPresenterCallback();
              }
              st.shownPanelView = (View) st.getListMenuView(this.mPanelMenuPresenterCallback);
              return st.shownPanelView != null;
          }
      }
  
      private boolean initializePanelDecor(PanelFeatureState st) {
          st.setStyle(getActionBarThemedContext());
          st.decorView = new ListMenuDecorView(st.listPresenterContext);
          st.gravity = 81;
          return true;
      }
  
      private boolean initializePanelMenu(PanelFeatureState st) {
          Context context = this.mContext;
          if ((st.featureId == 0 || st.featureId == 108) && this.mDecorContentParent != null) {
              TypedValue typedValue = new TypedValue();
              Resources.Theme theme = context.getTheme();
              theme.resolveAttribute(R.attr.actionBarTheme, typedValue, true);
              Resources.Theme theme2 = null;
              if (typedValue.resourceId != 0) {
                  theme2 = context.getResources().newTheme();
                  theme2.setTo(theme);
                  theme2.applyStyle(typedValue.resourceId, true);
                  theme2.resolveAttribute(R.attr.actionBarWidgetTheme, typedValue, true);
              } else {
                  theme.resolveAttribute(R.attr.actionBarWidgetTheme, typedValue, true);
              }
              if (typedValue.resourceId != 0) {
                  if (theme2 == null) {
                      theme2 = context.getResources().newTheme();
                      theme2.setTo(theme);
                  }
                  theme2.applyStyle(typedValue.resourceId, true);
              }
              if (theme2 != null) {
                  context = new androidx.appcompat.view.ContextThemeWrapper(context, 0);
                  context.getTheme().setTo(theme2);
              }
          }
          MenuBuilder menuBuilder = new MenuBuilder(context);
          menuBuilder.setCallback(this);
          st.setMenu(menuBuilder);
          return true;
      }
  
      private void invalidatePanelMenu(int featureId) {
          this.mInvalidatePanelMenuFeatures |= 1 << featureId;
          if (!this.mInvalidatePanelMenuPosted) {
              ViewCompat.postOnAnimation(this.mWindow.getDecorView(), this.mInvalidatePanelMenuRunnable);
              this.mInvalidatePanelMenuPosted = true;
          }
      }
  
      private boolean isActivityManifestHandlingUiMode(Context baseContext) {
          if (!this.mActivityHandlesUiModeChecked && (this.mHost instanceof Activity)) {
              PackageManager packageManager = baseContext.getPackageManager();
              if (packageManager == null) {
                  return false;
              }
              int i = 0;
              try {
                  if (Build.VERSION.SDK_INT >= 29) {
                      i = 269221888;
                  } else if (Build.VERSION.SDK_INT >= 24) {
                      i = 786432;
                  }
                  ActivityInfo activityInfo = packageManager.getActivityInfo(new ComponentName(baseContext, this.mHost.getClass()), i);
                  this.mActivityHandlesUiMode = (activityInfo == null || (activityInfo.configChanges & 512) == 0) ? false : true;
              } catch (PackageManager.NameNotFoundException e) {
                  Log.d("AppCompatDelegate", "Exception while getting ActivityInfo", e);
                  this.mActivityHandlesUiMode = false;
              }
          }
          this.mActivityHandlesUiModeChecked = true;
          return this.mActivityHandlesUiMode;
      }
  
      private boolean onKeyDownPanel(int featureId, KeyEvent event) {
          if (event.getRepeatCount() != 0) {
              return false;
          }
          PanelFeatureState panelState = getPanelState(featureId, true);
          if (!panelState.isOpen) {
              return preparePanel(panelState, event);
          }
          return false;
      }
  
      private boolean onKeyUpPanel(int featureId, KeyEvent event) {
          DecorContentParent decorContentParent;
          if (this.mActionMode != null) {
              return false;
          }
          boolean z = false;
          PanelFeatureState panelState = getPanelState(featureId, true);
          if (featureId != 0 || (decorContentParent = this.mDecorContentParent) == null || !decorContentParent.canShowOverflowMenu() || ViewConfiguration.get(this.mContext).hasPermanentMenuKey()) {
              if (panelState.isOpen || panelState.isHandled) {
                  z = panelState.isOpen;
                  closePanel(panelState, true);
              } else if (panelState.isPrepared) {
                  boolean z2 = true;
                  if (panelState.refreshMenuContent) {
                      panelState.isPrepared = false;
                      z2 = preparePanel(panelState, event);
                  }
                  if (z2) {
                      openPanel(panelState, event);
                      z = true;
                  }
              }
          } else if (this.mDecorContentParent.isOverflowMenuShowing()) {
              z = this.mDecorContentParent.hideOverflowMenu();
          } else if (!this.mDestroyed && preparePanel(panelState, event)) {
              z = this.mDecorContentParent.showOverflowMenu();
          }
          if (z) {
              AudioManager audioManager = (AudioManager) this.mContext.getApplicationContext().getSystemService("audio");
              if (audioManager != null) {
                  audioManager.playSoundEffect(0);
              } else {
                  Log.w("AppCompatDelegate", "Couldn't get audio manager");
              }
          }
          return z;
      }
  
      private void openPanel(PanelFeatureState st, KeyEvent event) {
          ViewGroup.LayoutParams layoutParams;
          PanelFeatureState panelFeatureState = st;
          if (!panelFeatureState.isOpen && !this.mDestroyed) {
              if (panelFeatureState.featureId == 0) {
                  if ((this.mContext.getResources().getConfiguration().screenLayout & 15) == 4) {
                      return;
                  }
              }
              Window.Callback windowCallback = getWindowCallback();
              if (windowCallback == null || windowCallback.onMenuOpened(panelFeatureState.featureId, panelFeatureState.menu)) {
                  WindowManager windowManager = (WindowManager) this.mContext.getSystemService("window");
                  if (windowManager != null && preparePanel(st, event)) {
                      int i = -2;
                      if (panelFeatureState.decorView == null || panelFeatureState.refreshDecorView) {
                          if (panelFeatureState.decorView == null) {
                              if (!initializePanelDecor(st) || panelFeatureState.decorView == null) {
                                  return;
                              }
                          } else if (panelFeatureState.refreshDecorView && panelFeatureState.decorView.getChildCount() > 0) {
                              panelFeatureState.decorView.removeAllViews();
                          }
                          if (!initializePanelContent(st) || !st.hasPanelItems()) {
                              panelFeatureState.refreshDecorView = true;
                              return;
                          }
                          ViewGroup.LayoutParams layoutParams2 = panelFeatureState.shownPanelView.getLayoutParams();
                          if (layoutParams2 == null) {
                              layoutParams2 = new ViewGroup.LayoutParams(-2, -2);
                          }
                          panelFeatureState.decorView.setBackgroundResource(panelFeatureState.background);
                          ViewParent parent = panelFeatureState.shownPanelView.getParent();
                          if (parent instanceof ViewGroup) {
                              ((ViewGroup) parent).removeView(panelFeatureState.shownPanelView);
                          }
                          panelFeatureState.decorView.addView(panelFeatureState.shownPanelView, layoutParams2);
                          if (!panelFeatureState.shownPanelView.hasFocus()) {
                              panelFeatureState.shownPanelView.requestFocus();
                          }
                      } else if (!(panelFeatureState.createdPanelView == null || (layoutParams = panelFeatureState.createdPanelView.getLayoutParams()) == null || layoutParams.width != -1)) {
                          i = -1;
                      }
                      panelFeatureState.isHandled = false;
                      WindowManager.LayoutParams layoutParams3 = new WindowManager.LayoutParams(i, -2, panelFeatureState.x, panelFeatureState.y, PointerIconCompat.TYPE_HAND, 8519680, -3);
                      layoutParams3.gravity = panelFeatureState.gravity;
                      layoutParams3.windowAnimations = panelFeatureState.windowAnimations;
                      windowManager.addView(panelFeatureState.decorView, layoutParams3);
                      panelFeatureState.isOpen = true;
                      return;
                  }
                  return;
              }
              closePanel(panelFeatureState, true);
          }
      }
  
      private boolean performPanelShortcut(PanelFeatureState st, int keyCode, KeyEvent event, int flags) {
          if (event.isSystem()) {
              return false;
          }
          boolean z = false;
          if ((st.isPrepared || preparePanel(st, event)) && st.menu != null) {
              z = st.menu.performShortcut(keyCode, event, flags);
          }
          if (z && (flags & 1) == 0 && this.mDecorContentParent == null) {
              closePanel(st, true);
          }
          return z;
      }
  
      private boolean preparePanel(PanelFeatureState st, KeyEvent event) {
          DecorContentParent decorContentParent;
          DecorContentParent decorContentParent2;
          DecorContentParent decorContentParent3;
          if (this.mDestroyed) {
              return false;
          }
          if (st.isPrepared) {
              return true;
          }
          PanelFeatureState panelFeatureState = this.mPreparedPanel;
          if (!(panelFeatureState == null || panelFeatureState == st)) {
              closePanel(panelFeatureState, false);
          }
          Window.Callback windowCallback = getWindowCallback();
          if (windowCallback != null) {
              st.createdPanelView = windowCallback.onCreatePanelView(st.featureId);
          }
          boolean z = st.featureId == 0 || st.featureId == 108;
          if (z && (decorContentParent3 = this.mDecorContentParent) != null) {
              decorContentParent3.setMenuPrepared();
          }
          if (st.createdPanelView == null && (!z || !(peekSupportActionBar() instanceof ToolbarActionBar))) {
              if (st.menu == null || st.refreshMenuContent) {
                  if (st.menu == null && (!initializePanelMenu(st) || st.menu == null)) {
                      return false;
                  }
                  if (z && this.mDecorContentParent != null) {
                      if (this.mActionMenuPresenterCallback == null) {
                          this.mActionMenuPresenterCallback = new ActionMenuPresenterCallback();
                      }
                      this.mDecorContentParent.setMenu(st.menu, this.mActionMenuPresenterCallback);
                  }
                  st.menu.stopDispatchingItemsChanged();
                  if (!windowCallback.onCreatePanelMenu(st.featureId, st.menu)) {
                      st.setMenu((MenuBuilder) null);
                      if (z && (decorContentParent2 = this.mDecorContentParent) != null) {
                          decorContentParent2.setMenu((Menu) null, this.mActionMenuPresenterCallback);
                      }
                      return false;
                  }
                  st.refreshMenuContent = false;
              }
              st.menu.stopDispatchingItemsChanged();
              if (st.frozenActionViewState != null) {
                  st.menu.restoreActionViewStates(st.frozenActionViewState);
                  st.frozenActionViewState = null;
              }
              if (!windowCallback.onPreparePanel(0, st.createdPanelView, st.menu)) {
                  if (z && (decorContentParent = this.mDecorContentParent) != null) {
                      decorContentParent.setMenu((Menu) null, this.mActionMenuPresenterCallback);
                  }
                  st.menu.startDispatchingItemsChanged();
                  return false;
              }
              st.qwertyMode = KeyCharacterMap.load(event != null ? event.getDeviceId() : -1).getKeyboardType() != 1;
              st.menu.setQwertyMode(st.qwertyMode);
              st.menu.startDispatchingItemsChanged();
          }
          st.isPrepared = true;
          st.isHandled = false;
          this.mPreparedPanel = st;
          return true;
      }
  
      private void reopenMenu(boolean toggleMenuMode) {
          DecorContentParent decorContentParent = this.mDecorContentParent;
          if (decorContentParent == null || !decorContentParent.canShowOverflowMenu() || (ViewConfiguration.get(this.mContext).hasPermanentMenuKey() && !this.mDecorContentParent.isOverflowMenuShowPending())) {
              PanelFeatureState panelState = getPanelState(0, true);
              panelState.refreshDecorView = true;
              closePanel(panelState, false);
              openPanel(panelState, (KeyEvent) null);
              return;
          }
          Window.Callback windowCallback = getWindowCallback();
          if (this.mDecorContentParent.isOverflowMenuShowing() && toggleMenuMode) {
              this.mDecorContentParent.hideOverflowMenu();
              if (!this.mDestroyed) {
                  windowCallback.onPanelClosed(AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR, getPanelState(0, true).menu);
              }
          } else if (windowCallback != null && !this.mDestroyed) {
              if (this.mInvalidatePanelMenuPosted && (this.mInvalidatePanelMenuFeatures & 1) != 0) {
                  this.mWindow.getDecorView().removeCallbacks(this.mInvalidatePanelMenuRunnable);
                  this.mInvalidatePanelMenuRunnable.run();
              }
              PanelFeatureState panelState2 = getPanelState(0, true);
              if (panelState2.menu != null && !panelState2.refreshMenuContent && windowCallback.onPreparePanel(0, panelState2.createdPanelView, panelState2.menu)) {
                  windowCallback.onMenuOpened(AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR, panelState2.menu);
                  this.mDecorContentParent.showOverflowMenu();
              }
          }
      }
  
      private int sanitizeWindowFeatureId(int featureId) {
          if (featureId == 8) {
              Log.i("AppCompatDelegate", "You should now use the AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR id when requesting this feature.");
              return AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR;
          } else if (featureId != 9) {
              return featureId;
          } else {
              Log.i("AppCompatDelegate", "You should now use the AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR_OVERLAY id when requesting this feature.");
              return AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR_OVERLAY;
          }
      }
  
      private boolean shouldInheritContext(ViewParent parent) {
          if (parent == null) {
              return false;
          }
          View decorView = this.mWindow.getDecorView();
          while (parent != null) {
              if (parent == decorView || !(parent instanceof View) || ViewCompat.isAttachedToWindow((View) parent)) {
                  return false;
              }
              parent = parent.getParent();
          }
          return true;
      }
  
      private void throwFeatureRequestIfSubDecorInstalled() {
          if (this.mSubDecorInstalled) {
              throw new AndroidRuntimeException("Window feature must be requested before adding content");
          }
      }
  
      private AppCompatActivity tryUnwrapContext() {
          for (Context context = this.mContext; context != null; context = ((ContextWrapper) context).getBaseContext()) {
              if (context instanceof AppCompatActivity) {
                  return (AppCompatActivity) context;
              }
              if (!(context instanceof ContextWrapper)) {
                  return null;
              }
          }
          return null;
      }
  
      private boolean updateForNightMode(int mode, boolean allowRecreation) {
          boolean z = false;
          Configuration createOverrideConfigurationForDayNight = createOverrideConfigurationForDayNight(this.mContext, mode, (Configuration) null, false);
          boolean isActivityManifestHandlingUiMode = isActivityManifestHandlingUiMode(this.mContext);
          Configuration configuration = this.mEffectiveConfiguration;
          if (configuration == null) {
              configuration = this.mContext.getResources().getConfiguration();
          }
          int i = configuration.uiMode & 48;
          int i2 = createOverrideConfigurationForDayNight.uiMode & 48;
          if (i != i2 && allowRecreation && !isActivityManifestHandlingUiMode && this.mBaseContextAttached && (sCanReturnDifferentContext || this.mCreated)) {
              Object obj = this.mHost;
              if ((obj instanceof Activity) && !((Activity) obj).isChild()) {
                  ActivityCompat.recreate((Activity) this.mHost);
                  z = true;
              }
          }
          if (!z && i != i2) {
              updateResourcesConfigurationForNightMode(i2, isActivityManifestHandlingUiMode, (Configuration) null);
              z = true;
          }
          if (z) {
              Object obj2 = this.mHost;
              if (obj2 instanceof AppCompatActivity) {
                  ((AppCompatActivity) obj2).onNightModeChanged(mode);
              }
          }
          return z;
      }
  
      private void updateResourcesConfigurationForNightMode(int uiModeNightModeValue, boolean callOnConfigChange, Configuration configOverlay) {
          Resources resources = this.mContext.getResources();
          Configuration configuration = new Configuration(resources.getConfiguration());
          if (configOverlay != null) {
              configuration.updateFrom(configOverlay);
          }
          configuration.uiMode = (resources.getConfiguration().uiMode & -49) | uiModeNightModeValue;
          resources.updateConfiguration(configuration, (DisplayMetrics) null);
          if (Build.VERSION.SDK_INT < 26) {
              ResourcesFlusher.flush(resources);
          }
          int i = this.mThemeResId;
          if (i != 0) {
              this.mContext.setTheme(i);
              if (Build.VERSION.SDK_INT >= 23) {
                  this.mContext.getTheme().applyStyle(this.mThemeResId, true);
              }
          }
          if (callOnConfigChange) {
              Object obj = this.mHost;
              if (obj instanceof Activity) {
                  Activity activity = (Activity) obj;
                  if (activity instanceof LifecycleOwner) {
                      if (((LifecycleOwner) activity).getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.CREATED)) {
                          activity.onConfigurationChanged(configuration);
                      }
                  } else if (this.mCreated && !this.mDestroyed) {
                      activity.onConfigurationChanged(configuration);
                  }
              }
          }
      }
  
      private void updateStatusGuardColor(View v) {
          v.setBackgroundColor((ViewCompat.getWindowSystemUiVisibility(v) & 8192) != 0 ? ContextCompat.getColor(this.mContext, R.color.abc_decor_view_status_guard_light) : ContextCompat.getColor(this.mContext, R.color.abc_decor_view_status_guard));
      }
  
      public void addContentView(View v, ViewGroup.LayoutParams lp) {
          ensureSubDecor();
          ((ViewGroup) this.mSubDecor.findViewById(16908290)).addView(v, lp);
          this.mAppCompatWindowCallback.bypassOnContentChanged(this.mWindow.getCallback());
      }
  
      public boolean applyDayNight() {
          return applyDayNight(true);
      }
  
      public Context attachBaseContext2(Context baseContext) {
          boolean z = true;
          this.mBaseContextAttached = true;
          int mapNightMode = mapNightMode(baseContext, calculateNightMode());
          if (sCanApplyOverrideConfiguration && (baseContext instanceof ContextThemeWrapper)) {
              try {
                  ContextThemeWrapperCompatApi17Impl.applyOverrideConfiguration((ContextThemeWrapper) baseContext, createOverrideConfigurationForDayNight(baseContext, mapNightMode, (Configuration) null, false));
                  return baseContext;
              } catch (IllegalStateException e) {
              }
          }
          if (baseContext instanceof androidx.appcompat.view.ContextThemeWrapper) {
              try {
                  ((androidx.appcompat.view.ContextThemeWrapper) baseContext).applyOverrideConfiguration(createOverrideConfigurationForDayNight(baseContext, mapNightMode, (Configuration) null, false));
                  return baseContext;
              } catch (IllegalStateException e2) {
              }
          }
          if (!sCanReturnDifferentContext) {
              return super.attachBaseContext2(baseContext);
          }
          Configuration configuration = null;
          if (Build.VERSION.SDK_INT >= 17) {
              Configuration configuration2 = new Configuration();
              configuration2.uiMode = -1;
              configuration2.fontScale = 0.0f;
              Configuration configuration3 = Api17Impl.createConfigurationContext(baseContext, configuration2).getResources().getConfiguration();
              Configuration configuration4 = baseContext.getResources().getConfiguration();
              configuration3.uiMode = configuration4.uiMode;
              if (!configuration3.equals(configuration4)) {
                  configuration = generateConfigDelta(configuration3, configuration4);
              }
          }
          Configuration createOverrideConfigurationForDayNight = createOverrideConfigurationForDayNight(baseContext, mapNightMode, configuration, true);
          androidx.appcompat.view.ContextThemeWrapper contextThemeWrapper = new androidx.appcompat.view.ContextThemeWrapper(baseContext, R.style.Theme_AppCompat_Empty);
          contextThemeWrapper.applyOverrideConfiguration(createOverrideConfigurationForDayNight);
          try {
              if (baseContext.getTheme() == null) {
                  z = false;
              }
          } catch (NullPointerException e3) {
              z = false;
          }
          if (z) {
              ResourcesCompat.ThemeCompat.rebase(contextThemeWrapper.getTheme());
          }
          return super.attachBaseContext2(contextThemeWrapper);
      }
  
      /* access modifiers changed from: package-private */
      public void callOnPanelClosed(int featureId, PanelFeatureState panel, Menu menu) {
          if (menu == null) {
              if (panel == null && featureId >= 0) {
                  PanelFeatureState[] panelFeatureStateArr = this.mPanels;
                  if (featureId < panelFeatureStateArr.length) {
                      panel = panelFeatureStateArr[featureId];
                  }
              }
              if (panel != null) {
                  menu = panel.menu;
              }
          }
          if ((panel == null || panel.isOpen) && !this.mDestroyed) {
              this.mAppCompatWindowCallback.bypassOnPanelClosed(this.mWindow.getCallback(), featureId, menu);
          }
      }
  
      /* access modifiers changed from: package-private */
      public void checkCloseActionMenu(MenuBuilder menu) {
          if (!this.mClosingActionMenu) {
              this.mClosingActionMenu = true;
              this.mDecorContentParent.dismissPopups();
              Window.Callback windowCallback = getWindowCallback();
              if (windowCallback != null && !this.mDestroyed) {
                  windowCallback.onPanelClosed(AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR, menu);
              }
              this.mClosingActionMenu = false;
          }
      }
  
      /* access modifiers changed from: package-private */
      public void closePanel(int featureId) {
          closePanel(getPanelState(featureId, true), true);
      }
  
      /* access modifiers changed from: package-private */
      public void closePanel(PanelFeatureState st, boolean doCallback) {
          DecorContentParent decorContentParent;
          if (!doCallback || st.featureId != 0 || (decorContentParent = this.mDecorContentParent) == null || !decorContentParent.isOverflowMenuShowing()) {
              WindowManager windowManager = (WindowManager) this.mContext.getSystemService("window");
              if (!(windowManager == null || !st.isOpen || st.decorView == null)) {
                  windowManager.removeView(st.decorView);
                  if (doCallback) {
                      callOnPanelClosed(st.featureId, st, (Menu) null);
                  }
              }
              st.isPrepared = false;
              st.isHandled = false;
              st.isOpen = false;
              st.shownPanelView = null;
              st.refreshDecorView = true;
              if (this.mPreparedPanel == st) {
                  this.mPreparedPanel = null;
                  return;
              }
              return;
          }
          checkCloseActionMenu(st.menu);
      }
  
      public View createView(View parent, String name, Context context, AttributeSet attrs) {
          boolean z = false;
          if (this.mAppCompatViewInflater == null) {
              String string = this.mContext.obtainStyledAttributes(R.styleable.AppCompatTheme).getString(R.styleable.AppCompatTheme_viewInflaterClass);
              if (string == null) {
                  this.mAppCompatViewInflater = new AppCompatViewInflater();
              } else {
                  try {
                      this.mAppCompatViewInflater = (AppCompatViewInflater) this.mContext.getClassLoader().loadClass(string).getDeclaredConstructor(new Class[0]).newInstance(new Object[0]);
                  } catch (Throwable th) {
                      Log.i("AppCompatDelegate", "Failed to instantiate custom view inflater " + string + ". Falling back to default.", th);
                      this.mAppCompatViewInflater = new AppCompatViewInflater();
                  }
              }
          }
          boolean z2 = false;
          boolean z3 = IS_PRE_LOLLIPOP;
          if (z3) {
              if (this.mLayoutIncludeDetector == null) {
                  this.mLayoutIncludeDetector = new LayoutIncludeDetector();
              }
              if (this.mLayoutIncludeDetector.detect(attrs)) {
                  z2 = true;
              } else {
                  if (!(attrs instanceof XmlPullParser)) {
                      z = shouldInheritContext((ViewParent) parent);
                  } else if (((XmlPullParser) attrs).getDepth() > 1) {
                      z = true;
                  }
                  z2 = z;
              }
          }
          return this.mAppCompatViewInflater.createView(parent, name, context, attrs, z2, z3, true, VectorEnabledTintResources.shouldBeUsed());
      }
  
      /* access modifiers changed from: package-private */
      public void dismissPopups() {
          DecorContentParent decorContentParent = this.mDecorContentParent;
          if (decorContentParent != null) {
              decorContentParent.dismissPopups();
          }
          if (this.mActionModePopup != null) {
              this.mWindow.getDecorView().removeCallbacks(this.mShowActionModePopup);
              if (this.mActionModePopup.isShowing()) {
                  try {
                      this.mActionModePopup.dismiss();
                  } catch (IllegalArgumentException e) {
                  }
              }
              this.mActionModePopup = null;
          }
          endOnGoingFadeAnimation();
          PanelFeatureState panelState = getPanelState(0, false);
          if (panelState != null && panelState.menu != null) {
              panelState.menu.close();
          }
      }
  
      /* access modifiers changed from: package-private */
      public boolean dispatchKeyEvent(KeyEvent event) {
          View decorView;
          Object obj = this.mHost;
          boolean z = true;
          if (((obj instanceof KeyEventDispatcher.Component) || (obj instanceof AppCompatDialog)) && (decorView = this.mWindow.getDecorView()) != null && KeyEventDispatcher.dispatchBeforeHierarchy(decorView, event)) {
              return true;
          }
          if (event.getKeyCode() == 82 && this.mAppCompatWindowCallback.bypassDispatchKeyEvent(this.mWindow.getCallback(), event)) {
              return true;
          }
          int keyCode = event.getKeyCode();
          if (event.getAction() != 0) {
              z = false;
          }
          return z ? onKeyDown(keyCode, event) : onKeyUp(keyCode, event);
      }
  
      /* access modifiers changed from: package-private */
      public void doInvalidatePanelMenu(int featureId) {
          PanelFeatureState panelState;
          PanelFeatureState panelState2 = getPanelState(featureId, true);
          if (panelState2.menu != null) {
              Bundle bundle = new Bundle();
              panelState2.menu.saveActionViewStates(bundle);
              if (bundle.size() > 0) {
                  panelState2.frozenActionViewState = bundle;
              }
              panelState2.menu.stopDispatchingItemsChanged();
              panelState2.menu.clear();
          }
          panelState2.refreshMenuContent = true;
          panelState2.refreshDecorView = true;
          if ((featureId == 108 || featureId == 0) && this.mDecorContentParent != null && (panelState = getPanelState(0, false)) != null) {
              panelState.isPrepared = false;
              preparePanel(panelState, (KeyEvent) null);
          }
      }
  
      /* access modifiers changed from: package-private */
      public void endOnGoingFadeAnimation() {
          ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = this.mFadeAnim;
          if (viewPropertyAnimatorCompat != null) {
              viewPropertyAnimatorCompat.cancel();
          }
      }
  
      /* access modifiers changed from: package-private */
      public PanelFeatureState findMenuPanel(Menu menu) {
          PanelFeatureState[] panelFeatureStateArr = this.mPanels;
          int length = panelFeatureStateArr != null ? panelFeatureStateArr.length : 0;
          for (int i = 0; i < length; i++) {
              PanelFeatureState panelFeatureState = panelFeatureStateArr[i];
              if (panelFeatureState != null && panelFeatureState.menu == menu) {
                  return panelFeatureState;
              }
          }
          return null;
      }
  
      public <T extends View> T findViewById(int id) {
          ensureSubDecor();
          return this.mWindow.findViewById(id);
      }
  
      /* access modifiers changed from: package-private */
      public final Context getActionBarThemedContext() {
          Context context = null;
          ActionBar supportActionBar = getSupportActionBar();
          if (supportActionBar != null) {
              context = supportActionBar.getThemedContext();
          }
          return context == null ? this.mContext : context;
      }
  
      /* access modifiers changed from: package-private */
      public final AutoNightModeManager getAutoTimeNightModeManager() {
          return getAutoTimeNightModeManager(this.mContext);
      }
  
      public final ActionBarDrawerToggle.Delegate getDrawerToggleDelegate() {
          return new ActionBarDrawableToggleImpl();
      }
  
      public int getLocalNightMode() {
          return this.mLocalNightMode;
      }
  
      public MenuInflater getMenuInflater() {
          if (this.mMenuInflater == null) {
              initWindowDecorActionBar();
              ActionBar actionBar = this.mActionBar;
              this.mMenuInflater = new SupportMenuInflater(actionBar != null ? actionBar.getThemedContext() : this.mContext);
          }
          return this.mMenuInflater;
      }
  
      /* access modifiers changed from: protected */
      public PanelFeatureState getPanelState(int featureId, boolean required) {
          PanelFeatureState[] panelFeatureStateArr = this.mPanels;
          PanelFeatureState[] panelFeatureStateArr2 = panelFeatureStateArr;
          if (panelFeatureStateArr == null || panelFeatureStateArr2.length <= featureId) {
              PanelFeatureState[] panelFeatureStateArr3 = new PanelFeatureState[(featureId + 1)];
              if (panelFeatureStateArr2 != null) {
                  System.arraycopy(panelFeatureStateArr2, 0, panelFeatureStateArr3, 0, panelFeatureStateArr2.length);
              }
              panelFeatureStateArr2 = panelFeatureStateArr3;
              this.mPanels = panelFeatureStateArr3;
          }
          PanelFeatureState panelFeatureState = panelFeatureStateArr2[featureId];
          if (panelFeatureState != null) {
              return panelFeatureState;
          }
          PanelFeatureState panelFeatureState2 = new PanelFeatureState(featureId);
          PanelFeatureState panelFeatureState3 = panelFeatureState2;
          panelFeatureStateArr2[featureId] = panelFeatureState2;
          return panelFeatureState3;
      }
  
      /* access modifiers changed from: package-private */
      public ViewGroup getSubDecor() {
          return this.mSubDecor;
      }
  
      public ActionBar getSupportActionBar() {
          initWindowDecorActionBar();
          return this.mActionBar;
      }
  
      /* access modifiers changed from: package-private */
      public final CharSequence getTitle() {
          Object obj = this.mHost;
          return obj instanceof Activity ? ((Activity) obj).getTitle() : this.mTitle;
      }
  
      /* access modifiers changed from: package-private */
      public final Window.Callback getWindowCallback() {
          return this.mWindow.getCallback();
      }
  
      public boolean hasWindowFeature(int featureId) {
          boolean z = false;
          switch (sanitizeWindowFeatureId(featureId)) {
              case 1:
                  z = this.mWindowNoTitle;
                  break;
              case 2:
                  z = this.mFeatureProgress;
                  break;
              case 5:
                  z = this.mFeatureIndeterminateProgress;
                  break;
              case 10:
                  z = this.mOverlayActionMode;
                  break;
              case AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR:
                  z = this.mHasActionBar;
                  break;
              case AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR_OVERLAY:
                  z = this.mOverlayActionBar;
                  break;
          }
          return z || this.mWindow.hasFeature(featureId);
      }
  
      public void installViewFactory() {
          LayoutInflater from = LayoutInflater.from(this.mContext);
          if (from.getFactory() == null) {
              LayoutInflaterCompat.setFactory2(from, this);
          } else if (!(from.getFactory2() instanceof AppCompatDelegateImpl)) {
              Log.i("AppCompatDelegate", "The Activity's LayoutInflater already has a Factory installed so we can not install AppCompat's");
          }
      }
  
      public void invalidateOptionsMenu() {
          if (peekSupportActionBar() != null && !getSupportActionBar().invalidateOptionsMenu()) {
              invalidatePanelMenu(0);
          }
      }
  
      public boolean isHandleNativeActionModesEnabled() {
          return this.mHandleNativeActionModes;
      }
  
      /* access modifiers changed from: package-private */
      public int mapNightMode(Context context, int mode) {
          switch (mode) {
              case AppCompatDelegate.MODE_NIGHT_UNSPECIFIED:
                  return -1;
              case -1:
              case 1:
              case 2:
                  return mode;
              case 0:
                  if (Build.VERSION.SDK_INT < 23 || ((UiModeManager) context.getApplicationContext().getSystemService("uimode")).getNightMode() != 0) {
                      return getAutoTimeNightModeManager(context).getApplyableNightMode();
                  }
                  return -1;
              case 3:
                  return getAutoBatteryNightModeManager(context).getApplyableNightMode();
              default:
                  throw new IllegalStateException("Unknown value set for night mode. Please use one of the MODE_NIGHT values from AppCompatDelegate.");
          }
      }
  
      /* access modifiers changed from: package-private */
      public boolean onBackPressed() {
          androidx.appcompat.view.ActionMode actionMode = this.mActionMode;
          if (actionMode != null) {
              actionMode.finish();
              return true;
          }
          ActionBar supportActionBar = getSupportActionBar();
          return supportActionBar != null && supportActionBar.collapseActionView();
      }
  
      public void onConfigurationChanged(Configuration newConfig) {
          ActionBar supportActionBar;
          if (this.mHasActionBar && this.mSubDecorInstalled && (supportActionBar = getSupportActionBar()) != null) {
              supportActionBar.onConfigurationChanged(newConfig);
          }
          AppCompatDrawableManager.get().onConfigurationChanged(this.mContext);
          this.mEffectiveConfiguration = new Configuration(this.mContext.getResources().getConfiguration());
          applyDayNight(false);
          newConfig.updateFrom(this.mContext.getResources().getConfiguration());
      }
  
      public void onCreate(Bundle savedInstanceState) {
          this.mBaseContextAttached = true;
          applyDayNight(false);
          ensureWindow();
          Object obj = this.mHost;
          if (obj instanceof Activity) {
              String str = null;
              try {
                  String parentActivityName = NavUtils.getParentActivityName((Activity) obj);
                  Log1F380D.a((Object) parentActivityName);
                  str = parentActivityName;
              } catch (IllegalArgumentException e) {
              }
              if (str != null) {
                  ActionBar peekSupportActionBar = peekSupportActionBar();
                  if (peekSupportActionBar == null) {
                      this.mEnableDefaultActionBarUp = true;
                  } else {
                      peekSupportActionBar.setDefaultDisplayHomeAsUpEnabled(true);
                  }
              }
              addActiveDelegate(this);
          }
          this.mEffectiveConfiguration = new Configuration(this.mContext.getResources().getConfiguration());
          this.mCreated = true;
      }
  
      public final View onCreateView(View parent, String name, Context context, AttributeSet attrs) {
          return createView(parent, name, context, attrs);
      }
  
      public View onCreateView(String name, Context context, AttributeSet attrs) {
          return onCreateView((View) null, name, context, attrs);
      }
  
      /* JADX WARNING: Removed duplicated region for block: B:16:0x0058  */
      /* Code decompiled incorrectly, please refer to instructions dump. */
      public void onDestroy() {
          /*
              r3 = this;
              java.lang.Object r0 = r3.mHost
              boolean r0 = r0 instanceof android.app.Activity
              if (r0 == 0) goto L_0x0009
              removeActivityDelegate(r3)
          L_0x0009:
              boolean r0 = r3.mInvalidatePanelMenuPosted
              if (r0 == 0) goto L_0x0018
              android.view.Window r0 = r3.mWindow
              android.view.View r0 = r0.getDecorView()
              java.lang.Runnable r1 = r3.mInvalidatePanelMenuRunnable
              r0.removeCallbacks(r1)
          L_0x0018:
              r0 = 1
              r3.mDestroyed = r0
              int r0 = r3.mLocalNightMode
              r1 = -100
              if (r0 == r1) goto L_0x0045
              java.lang.Object r0 = r3.mHost
              boolean r1 = r0 instanceof android.app.Activity
              if (r1 == 0) goto L_0x0045
              android.app.Activity r0 = (android.app.Activity) r0
              boolean r0 = r0.isChangingConfigurations()
              if (r0 == 0) goto L_0x0045
              androidx.collection.SimpleArrayMap<java.lang.String, java.lang.Integer> r0 = sLocalNightModes
              java.lang.Object r1 = r3.mHost
              java.lang.Class r1 = r1.getClass()
              java.lang.String r1 = r1.getName()
              int r2 = r3.mLocalNightMode
              java.lang.Integer r2 = java.lang.Integer.valueOf(r2)
              r0.put(r1, r2)
              goto L_0x0054
          L_0x0045:
              androidx.collection.SimpleArrayMap<java.lang.String, java.lang.Integer> r0 = sLocalNightModes
              java.lang.Object r1 = r3.mHost
              java.lang.Class r1 = r1.getClass()
              java.lang.String r1 = r1.getName()
              r0.remove(r1)
          L_0x0054:
              androidx.appcompat.app.ActionBar r0 = r3.mActionBar
              if (r0 == 0) goto L_0x005b
              r0.onDestroy()
          L_0x005b:
              r3.cleanupAutoManagers()
              return
          */
          throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.app.AppCompatDelegateImpl.onDestroy():void");
      }
  
      /* access modifiers changed from: package-private */
      public boolean onKeyDown(int keyCode, KeyEvent event) {
          boolean z = true;
          switch (keyCode) {
              case 4:
                  if ((event.getFlags() & 128) == 0) {
                      z = false;
                  }
                  this.mLongPressBackDown = z;
                  break;
              case 82:
                  onKeyDownPanel(0, event);
                  return true;
          }
          return false;
      }
  
      /* access modifiers changed from: package-private */
      public boolean onKeyShortcut(int keyCode, KeyEvent ev) {
          ActionBar supportActionBar = getSupportActionBar();
          if (supportActionBar != null && supportActionBar.onKeyShortcut(keyCode, ev)) {
              return true;
          }
          PanelFeatureState panelFeatureState = this.mPreparedPanel;
          if (panelFeatureState == null || !performPanelShortcut(panelFeatureState, ev.getKeyCode(), ev, 1)) {
              if (this.mPreparedPanel == null) {
                  PanelFeatureState panelState = getPanelState(0, true);
                  preparePanel(panelState, ev);
                  boolean performPanelShortcut = performPanelShortcut(panelState, ev.getKeyCode(), ev, 1);
                  panelState.isPrepared = false;
                  if (performPanelShortcut) {
                      return true;
                  }
              }
              return false;
          }
          PanelFeatureState panelFeatureState2 = this.mPreparedPanel;
          if (panelFeatureState2 != null) {
              panelFeatureState2.isHandled = true;
          }
          return true;
      }
  
      /* access modifiers changed from: package-private */
      public boolean onKeyUp(int keyCode, KeyEvent event) {
          switch (keyCode) {
              case 4:
                  boolean z = this.mLongPressBackDown;
                  this.mLongPressBackDown = false;
                  PanelFeatureState panelState = getPanelState(0, false);
                  if (panelState != null && panelState.isOpen) {
                      if (!z) {
                          closePanel(panelState, true);
                      }
                      return true;
                  } else if (onBackPressed()) {
                      return true;
                  }
                  break;
              case 82:
                  onKeyUpPanel(0, event);
                  return true;
          }
          return false;
      }
  
      public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item) {
          PanelFeatureState findMenuPanel;
          Window.Callback windowCallback = getWindowCallback();
          if (windowCallback == null || this.mDestroyed || (findMenuPanel = findMenuPanel(menu.getRootMenu())) == null) {
              return false;
          }
          return windowCallback.onMenuItemSelected(findMenuPanel.featureId, item);
      }
  
      public void onMenuModeChange(MenuBuilder menu) {
          reopenMenu(true);
      }
  
      /* access modifiers changed from: package-private */
      public void onMenuOpened(int featureId) {
          ActionBar supportActionBar;
          if (featureId == 108 && (supportActionBar = getSupportActionBar()) != null) {
              supportActionBar.dispatchMenuVisibilityChanged(true);
          }
      }
  
      /* access modifiers changed from: package-private */
      public void onPanelClosed(int featureId) {
          if (featureId == 108) {
              ActionBar supportActionBar = getSupportActionBar();
              if (supportActionBar != null) {
                  supportActionBar.dispatchMenuVisibilityChanged(false);
              }
          } else if (featureId == 0) {
              PanelFeatureState panelState = getPanelState(featureId, true);
              if (panelState.isOpen) {
                  closePanel(panelState, false);
              }
          }
      }
  
      public void onPostCreate(Bundle savedInstanceState) {
          ensureSubDecor();
      }
  
      public void onPostResume() {
          ActionBar supportActionBar = getSupportActionBar();
          if (supportActionBar != null) {
              supportActionBar.setShowHideAnimationEnabled(true);
          }
      }
  
      public void onSaveInstanceState(Bundle outState) {
      }
  
      public void onStart() {
          applyDayNight();
      }
  
      public void onStop() {
          ActionBar supportActionBar = getSupportActionBar();
          if (supportActionBar != null) {
              supportActionBar.setShowHideAnimationEnabled(false);
          }
      }
  
      /* access modifiers changed from: package-private */
      public void onSubDecorInstalled(ViewGroup subDecor) {
      }
  
      /* access modifiers changed from: package-private */
      public final ActionBar peekSupportActionBar() {
          return this.mActionBar;
      }
  
      public boolean requestWindowFeature(int featureId) {
          int featureId2 = sanitizeWindowFeatureId(featureId);
          if (this.mWindowNoTitle && featureId2 == 108) {
              return false;
          }
          if (this.mHasActionBar && featureId2 == 1) {
              this.mHasActionBar = false;
          }
          switch (featureId2) {
              case 1:
                  throwFeatureRequestIfSubDecorInstalled();
                  this.mWindowNoTitle = true;
                  return true;
              case 2:
                  throwFeatureRequestIfSubDecorInstalled();
                  this.mFeatureProgress = true;
                  return true;
              case 5:
                  throwFeatureRequestIfSubDecorInstalled();
                  this.mFeatureIndeterminateProgress = true;
                  return true;
              case 10:
                  throwFeatureRequestIfSubDecorInstalled();
                  this.mOverlayActionMode = true;
                  return true;
              case AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR:
                  throwFeatureRequestIfSubDecorInstalled();
                  this.mHasActionBar = true;
                  return true;
              case AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR_OVERLAY:
                  throwFeatureRequestIfSubDecorInstalled();
                  this.mOverlayActionBar = true;
                  return true;
              default:
                  return this.mWindow.requestFeature(featureId2);
          }
      }
  
      public void setContentView(int resId) {
          ensureSubDecor();
          ViewGroup viewGroup = (ViewGroup) this.mSubDecor.findViewById(16908290);
          viewGroup.removeAllViews();
          LayoutInflater.from(this.mContext).inflate(resId, viewGroup);
          this.mAppCompatWindowCallback.bypassOnContentChanged(this.mWindow.getCallback());
      }
  
      public void setContentView(View v) {
          ensureSubDecor();
          ViewGroup viewGroup = (ViewGroup) this.mSubDecor.findViewById(16908290);
          viewGroup.removeAllViews();
          viewGroup.addView(v);
          this.mAppCompatWindowCallback.bypassOnContentChanged(this.mWindow.getCallback());
      }
  
      public void setContentView(View v, ViewGroup.LayoutParams lp) {
          ensureSubDecor();
          ViewGroup viewGroup = (ViewGroup) this.mSubDecor.findViewById(16908290);
          viewGroup.removeAllViews();
          viewGroup.addView(v, lp);
          this.mAppCompatWindowCallback.bypassOnContentChanged(this.mWindow.getCallback());
      }
  
      public void setHandleNativeActionModesEnabled(boolean enabled) {
          this.mHandleNativeActionModes = enabled;
      }
  
      public void setLocalNightMode(int mode) {
          if (this.mLocalNightMode != mode) {
              this.mLocalNightMode = mode;
              if (this.mBaseContextAttached) {
                  applyDayNight();
              }
          }
      }
  
      public void setSupportActionBar(Toolbar toolbar) {
          if (this.mHost instanceof Activity) {
              ActionBar supportActionBar = getSupportActionBar();
              if (!(supportActionBar instanceof WindowDecorActionBar)) {
                  this.mMenuInflater = null;
                  if (supportActionBar != null) {
                      supportActionBar.onDestroy();
                  }
                  this.mActionBar = null;
                  if (toolbar != null) {
                      ToolbarActionBar toolbarActionBar = new ToolbarActionBar(toolbar, getTitle(), this.mAppCompatWindowCallback);
                      this.mActionBar = toolbarActionBar;
                      this.mAppCompatWindowCallback.setActionBarCallback(toolbarActionBar.mMenuCallback);
                  } else {
                      this.mAppCompatWindowCallback.setActionBarCallback((ActionBarMenuCallback) null);
                  }
                  invalidateOptionsMenu();
                  return;
              }
              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.");
          }
      }
  
      public void setTheme(int themeResId) {
          this.mThemeResId = themeResId;
      }
  
      public final void setTitle(CharSequence title) {
          this.mTitle = title;
          DecorContentParent decorContentParent = this.mDecorContentParent;
          if (decorContentParent != null) {
              decorContentParent.setWindowTitle(title);
          } else if (peekSupportActionBar() != null) {
              peekSupportActionBar().setWindowTitle(title);
          } else {
              TextView textView = this.mTitleView;
              if (textView != null) {
                  textView.setText(title);
              }
          }
      }
  
      /* access modifiers changed from: package-private */
      /* JADX WARNING: Code restructure failed: missing block: B:2:0x0004, code lost:
          r0 = r1.mSubDecor;
       */
      /* Code decompiled incorrectly, please refer to instructions dump. */
      public final boolean shouldAnimateActionModeView() {
          /*
              r1 = this;
              boolean r0 = r1.mSubDecorInstalled
              if (r0 == 0) goto L_0x0010
              android.view.ViewGroup r0 = r1.mSubDecor
              if (r0 == 0) goto L_0x0010
              boolean r0 = androidx.core.view.ViewCompat.isLaidOut(r0)
              if (r0 == 0) goto L_0x0010
              r0 = 1
              goto L_0x0011
          L_0x0010:
              r0 = 0
          L_0x0011:
              return r0
          */
          throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.app.AppCompatDelegateImpl.shouldAnimateActionModeView():boolean");
      }
  
      public androidx.appcompat.view.ActionMode startSupportActionMode(ActionMode.Callback callback) {
          AppCompatCallback appCompatCallback;
          if (callback != null) {
              androidx.appcompat.view.ActionMode actionMode = this.mActionMode;
              if (actionMode != null) {
                  actionMode.finish();
              }
              ActionModeCallbackWrapperV9 actionModeCallbackWrapperV9 = new ActionModeCallbackWrapperV9(callback);
              ActionBar supportActionBar = getSupportActionBar();
              if (supportActionBar != null) {
                  androidx.appcompat.view.ActionMode startActionMode = supportActionBar.startActionMode(actionModeCallbackWrapperV9);
                  this.mActionMode = startActionMode;
                  if (!(startActionMode == null || (appCompatCallback = this.mAppCompatCallback) == null)) {
                      appCompatCallback.onSupportActionModeStarted(startActionMode);
                  }
              }
              if (this.mActionMode == null) {
                  this.mActionMode = startSupportActionModeFromWindow(actionModeCallbackWrapperV9);
              }
              return this.mActionMode;
          }
          throw new IllegalArgumentException("ActionMode callback can not be null.");
      }
  
      /* access modifiers changed from: package-private */
      public androidx.appcompat.view.ActionMode startSupportActionModeFromWindow(ActionMode.Callback callback) {
          AppCompatCallback appCompatCallback;
          Context context;
          endOnGoingFadeAnimation();
          androidx.appcompat.view.ActionMode actionMode = this.mActionMode;
          if (actionMode != null) {
              actionMode.finish();
          }
          if (!(callback instanceof ActionModeCallbackWrapperV9)) {
              callback = new ActionModeCallbackWrapperV9(callback);
          }
          androidx.appcompat.view.ActionMode actionMode2 = null;
          AppCompatCallback appCompatCallback2 = this.mAppCompatCallback;
          if (appCompatCallback2 != null && !this.mDestroyed) {
              try {
                  actionMode2 = appCompatCallback2.onWindowStartingSupportActionMode(callback);
              } catch (AbstractMethodError e) {
              }
          }
          if (actionMode2 != null) {
              this.mActionMode = actionMode2;
          } else {
              boolean z = true;
              if (this.mActionModeView == null) {
                  if (this.mIsFloating) {
                      TypedValue typedValue = new TypedValue();
                      Resources.Theme theme = this.mContext.getTheme();
                      theme.resolveAttribute(R.attr.actionBarTheme, typedValue, true);
                      if (typedValue.resourceId != 0) {
                          Resources.Theme newTheme = this.mContext.getResources().newTheme();
                          newTheme.setTo(theme);
                          newTheme.applyStyle(typedValue.resourceId, true);
                          context = new androidx.appcompat.view.ContextThemeWrapper(this.mContext, 0);
                          context.getTheme().setTo(newTheme);
                      } else {
                          context = this.mContext;
                      }
                      this.mActionModeView = new ActionBarContextView(context);
                      PopupWindow popupWindow = new PopupWindow(context, (AttributeSet) null, R.attr.actionModePopupWindowStyle);
                      this.mActionModePopup = popupWindow;
                      PopupWindowCompat.setWindowLayoutType(popupWindow, 2);
                      this.mActionModePopup.setContentView(this.mActionModeView);
                      this.mActionModePopup.setWidth(-1);
                      context.getTheme().resolveAttribute(R.attr.actionBarSize, typedValue, true);
                      this.mActionModeView.setContentHeight(TypedValue.complexToDimensionPixelSize(typedValue.data, context.getResources().getDisplayMetrics()));
                      this.mActionModePopup.setHeight(-2);
                      this.mShowActionModePopup = new Runnable() {
                          public void run() {
                              AppCompatDelegateImpl.this.mActionModePopup.showAtLocation(AppCompatDelegateImpl.this.mActionModeView, 55, 0, 0);
                              AppCompatDelegateImpl.this.endOnGoingFadeAnimation();
                              if (AppCompatDelegateImpl.this.shouldAnimateActionModeView()) {
                                  AppCompatDelegateImpl.this.mActionModeView.setAlpha(0.0f);
                                  AppCompatDelegateImpl appCompatDelegateImpl = AppCompatDelegateImpl.this;
                                  appCompatDelegateImpl.mFadeAnim = ViewCompat.animate(appCompatDelegateImpl.mActionModeView).alpha(1.0f);
                                  AppCompatDelegateImpl.this.mFadeAnim.setListener(new ViewPropertyAnimatorListenerAdapter() {
                                      public void onAnimationEnd(View view) {
                                          AppCompatDelegateImpl.this.mActionModeView.setAlpha(1.0f);
                                          AppCompatDelegateImpl.this.mFadeAnim.setListener((ViewPropertyAnimatorListener) null);
                                          AppCompatDelegateImpl.this.mFadeAnim = null;
                                      }
  
                                      public void onAnimationStart(View view) {
                                          AppCompatDelegateImpl.this.mActionModeView.setVisibility(0);
                                      }
                                  });
                                  return;
                              }
                              AppCompatDelegateImpl.this.mActionModeView.setAlpha(1.0f);
                              AppCompatDelegateImpl.this.mActionModeView.setVisibility(0);
                          }
                      };
                  } else {
                      ViewStubCompat viewStubCompat = (ViewStubCompat) this.mSubDecor.findViewById(R.id.action_mode_bar_stub);
                      if (viewStubCompat != null) {
                          viewStubCompat.setLayoutInflater(LayoutInflater.from(getActionBarThemedContext()));
                          this.mActionModeView = (ActionBarContextView) viewStubCompat.inflate();
                      }
                  }
              }
              if (this.mActionModeView != null) {
                  endOnGoingFadeAnimation();
                  this.mActionModeView.killMode();
                  Context context2 = this.mActionModeView.getContext();
                  ActionBarContextView actionBarContextView = this.mActionModeView;
                  if (this.mActionModePopup != null) {
                      z = false;
                  }
                  StandaloneActionMode standaloneActionMode = new StandaloneActionMode(context2, actionBarContextView, callback, z);
                  if (callback.onCreateActionMode(standaloneActionMode, standaloneActionMode.getMenu())) {
                      standaloneActionMode.invalidate();
                      this.mActionModeView.initForMode(standaloneActionMode);
                      this.mActionMode = standaloneActionMode;
                      if (shouldAnimateActionModeView()) {
                          this.mActionModeView.setAlpha(0.0f);
                          ViewPropertyAnimatorCompat alpha = ViewCompat.animate(this.mActionModeView).alpha(1.0f);
                          this.mFadeAnim = alpha;
                          alpha.setListener(new ViewPropertyAnimatorListenerAdapter() {
                              public void onAnimationEnd(View view) {
                                  AppCompatDelegateImpl.this.mActionModeView.setAlpha(1.0f);
                                  AppCompatDelegateImpl.this.mFadeAnim.setListener((ViewPropertyAnimatorListener) null);
                                  AppCompatDelegateImpl.this.mFadeAnim = null;
                              }
  
                              public void onAnimationStart(View view) {
                                  AppCompatDelegateImpl.this.mActionModeView.setVisibility(0);
                                  if (AppCompatDelegateImpl.this.mActionModeView.getParent() instanceof View) {
                                      ViewCompat.requestApplyInsets((View) AppCompatDelegateImpl.this.mActionModeView.getParent());
                                  }
                              }
                          });
                      } else {
                          this.mActionModeView.setAlpha(1.0f);
                          this.mActionModeView.setVisibility(0);
                          if (this.mActionModeView.getParent() instanceof View) {
                              ViewCompat.requestApplyInsets((View) this.mActionModeView.getParent());
                          }
                      }
                      if (this.mActionModePopup != null) {
                          this.mWindow.getDecorView().post(this.mShowActionModePopup);
                      }
                  } else {
                      this.mActionMode = null;
                  }
              }
          }
          androidx.appcompat.view.ActionMode actionMode3 = this.mActionMode;
          if (!(actionMode3 == null || (appCompatCallback = this.mAppCompatCallback) == null)) {
              appCompatCallback.onSupportActionModeStarted(actionMode3);
          }
          return this.mActionMode;
      }
  
      /* access modifiers changed from: package-private */
      /* JADX WARNING: Removed duplicated region for block: B:70:0x0131  */
      /* Code decompiled incorrectly, please refer to instructions dump. */
      public final int updateStatusGuard(androidx.core.view.WindowInsetsCompat r18, android.graphics.Rect r19) {
          /*
              r17 = this;
              r0 = r17
              r1 = r19
              r2 = 0
              if (r18 == 0) goto L_0x000c
              int r2 = r18.getSystemWindowInsetTop()
              goto L_0x0010
          L_0x000c:
              if (r1 == 0) goto L_0x0010
              int r2 = r1.top
          L_0x0010:
              r3 = 0
              androidx.appcompat.widget.ActionBarContextView r4 = r0.mActionModeView
              if (r4 == 0) goto L_0x0128
              android.view.ViewGroup$LayoutParams r4 = r4.getLayoutParams()
              boolean r4 = r4 instanceof android.view.ViewGroup.MarginLayoutParams
              if (r4 == 0) goto L_0x0124
              androidx.appcompat.widget.ActionBarContextView r4 = r0.mActionModeView
              android.view.ViewGroup$LayoutParams r4 = r4.getLayoutParams()
              android.view.ViewGroup$MarginLayoutParams r4 = (android.view.ViewGroup.MarginLayoutParams) r4
              r7 = 0
              androidx.appcompat.widget.ActionBarContextView r8 = r0.mActionModeView
              boolean r8 = r8.isShown()
              if (r8 == 0) goto L_0x010c
              android.graphics.Rect r8 = r0.mTempRect1
              if (r8 != 0) goto L_0x0040
              android.graphics.Rect r8 = new android.graphics.Rect
              r8.<init>()
              r0.mTempRect1 = r8
              android.graphics.Rect r8 = new android.graphics.Rect
              r8.<init>()
              r0.mTempRect2 = r8
          L_0x0040:
              android.graphics.Rect r8 = r0.mTempRect1
              android.graphics.Rect r9 = r0.mTempRect2
              if (r18 != 0) goto L_0x004a
              r8.set(r1)
              goto L_0x005e
          L_0x004a:
              int r10 = r18.getSystemWindowInsetLeft()
              int r11 = r18.getSystemWindowInsetTop()
              int r12 = r18.getSystemWindowInsetRight()
              int r13 = r18.getSystemWindowInsetBottom()
              r8.set(r10, r11, r12, r13)
          L_0x005e:
              android.view.ViewGroup r10 = r0.mSubDecor
              androidx.appcompat.widget.ViewUtils.computeFitSystemWindows(r10, r8, r9)
              int r10 = r8.top
              int r11 = r8.left
              int r12 = r8.right
              android.view.ViewGroup r13 = r0.mSubDecor
              androidx.core.view.WindowInsetsCompat r13 = androidx.core.view.ViewCompat.getRootWindowInsets(r13)
              if (r13 != 0) goto L_0x0073
              r14 = 0
              goto L_0x0077
          L_0x0073:
              int r14 = r13.getSystemWindowInsetLeft()
          L_0x0077:
              if (r13 != 0) goto L_0x007b
              r15 = 0
              goto L_0x007f
          L_0x007b:
              int r15 = r13.getSystemWindowInsetRight()
          L_0x007f:
              int r6 = r4.topMargin
              if (r6 != r10) goto L_0x008b
              int r6 = r4.leftMargin
              if (r6 != r11) goto L_0x008b
              int r6 = r4.rightMargin
              if (r6 == r12) goto L_0x0093
          L_0x008b:
              r6 = 1
              r4.topMargin = r10
              r4.leftMargin = r11
              r4.rightMargin = r12
              r7 = r6
          L_0x0093:
              if (r10 <= 0) goto L_0x00c0
              android.view.View r6 = r0.mStatusGuard
              if (r6 != 0) goto L_0x00c0
              android.view.View r6 = new android.view.View
              android.content.Context r5 = r0.mContext
              r6.<init>(r5)
              r0.mStatusGuard = r6
              r5 = 8
              r6.setVisibility(r5)
              android.widget.FrameLayout$LayoutParams r6 = new android.widget.FrameLayout$LayoutParams
              int r5 = r4.topMargin
              r1 = 51
              r16 = r2
              r2 = -1
              r6.<init>(r2, r5, r1)
              r1 = r6
              r1.leftMargin = r14
              r1.rightMargin = r15
              android.view.ViewGroup r5 = r0.mSubDecor
              android.view.View r6 = r0.mStatusGuard
              r5.addView(r6, r2, r1)
              goto L_0x00e9
          L_0x00c0:
              r16 = r2
              android.view.View r1 = r0.mStatusGuard
              if (r1 == 0) goto L_0x00e9
              android.view.ViewGroup$LayoutParams r1 = r1.getLayoutParams()
              android.view.ViewGroup$MarginLayoutParams r1 = (android.view.ViewGroup.MarginLayoutParams) r1
              int r2 = r1.height
              int r5 = r4.topMargin
              if (r2 != r5) goto L_0x00db
              int r2 = r1.leftMargin
              if (r2 != r14) goto L_0x00db
              int r2 = r1.rightMargin
              if (r2 == r15) goto L_0x00ea
          L_0x00db:
              int r2 = r4.topMargin
              r1.height = r2
              r1.leftMargin = r14
              r1.rightMargin = r15
              android.view.View r2 = r0.mStatusGuard
              r2.setLayoutParams(r1)
              goto L_0x00ea
          L_0x00e9:
          L_0x00ea:
              android.view.View r1 = r0.mStatusGuard
              if (r1 == 0) goto L_0x00f0
              r2 = 1
              goto L_0x00f1
          L_0x00f0:
              r2 = 0
          L_0x00f1:
              if (r2 == 0) goto L_0x00fe
              int r1 = r1.getVisibility()
              if (r1 == 0) goto L_0x00fe
              android.view.View r1 = r0.mStatusGuard
              r0.updateStatusGuardColor(r1)
          L_0x00fe:
              boolean r1 = r0.mOverlayActionMode
              if (r1 != 0) goto L_0x0106
              if (r2 == 0) goto L_0x0106
              r1 = 0
              goto L_0x0108
          L_0x0106:
              r1 = r16
          L_0x0108:
              r3 = r2
              r2 = r1
              r1 = 0
              goto L_0x011c
          L_0x010c:
              r16 = r2
              int r1 = r4.topMargin
              if (r1 == 0) goto L_0x0119
              r7 = 1
              r1 = 0
              r4.topMargin = r1
              r2 = r16
              goto L_0x011c
          L_0x0119:
              r1 = 0
              r2 = r16
          L_0x011c:
              if (r7 == 0) goto L_0x012d
              androidx.appcompat.widget.ActionBarContextView r5 = r0.mActionModeView
              r5.setLayoutParams(r4)
              goto L_0x012d
          L_0x0124:
              r16 = r2
              r1 = 0
              goto L_0x012b
          L_0x0128:
              r16 = r2
              r1 = 0
          L_0x012b:
              r2 = r16
          L_0x012d:
              android.view.View r4 = r0.mStatusGuard
              if (r4 == 0) goto L_0x013a
              if (r3 == 0) goto L_0x0135
              r5 = r1
              goto L_0x0137
          L_0x0135:
              r5 = 8
          L_0x0137:
              r4.setVisibility(r5)
          L_0x013a:
              return r2
          */
          throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.app.AppCompatDelegateImpl.updateStatusGuard(androidx.core.view.WindowInsetsCompat, android.graphics.Rect):int");
      }
  }
  