package androidx.appcompat.app; import android.annotation.SuppressLint; 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.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.FrameLayout; import android.widget.PopupWindow; import android.widget.TextView; import androidx.annotation.CallSuper; import androidx.annotation.IdRes; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.RequiresApi; import androidx.annotation.RestrictTo; import androidx.annotation.StyleRes; import androidx.annotation.VisibleForTesting; 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.FitWindowsViewGroup; import androidx.appcompat.widget.TintTypedArray; import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.VectorEnabledTintResources; import androidx.appcompat.widget.ViewStubCompat; import androidx.appcompat.widget.ViewUtils; 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.OnApplyWindowInsetsListener; import androidx.core.view.PointerIconCompat; import androidx.core.view.ViewCompat; import androidx.core.view.ViewPropertyAnimatorCompat; import androidx.core.view.ViewPropertyAnimatorListenerAdapter; import androidx.core.view.WindowInsetsCompat; import androidx.core.widget.PopupWindowCompat; import androidx.lifecycle.Lifecycle; import androidx.lifecycle.LifecycleOwner; import c.d.b.a.a; import java.lang.Thread; import java.util.List; import org.webrtc.MediaStreamTrack; import org.xmlpull.v1.XmlPullParser; @RestrictTo({RestrictTo.Scope.LIBRARY}) public class AppCompatDelegateImpl extends AppCompatDelegate implements MenuBuilder.Callback, LayoutInflater.Factory2 { public 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 = false; private static final boolean sCanApplyOverrideConfiguration = true; private static final boolean sCanReturnDifferentContext = (!"robolectric".equals(Build.FINGERPRINT)); private static boolean sInstalledExceptionHandler; private static final SimpleArrayMap sLocalNightModes = new SimpleArrayMap<>(); private static final int[] sWindowBackgroundStyleable = {16842836}; public ActionBar mActionBar; private ActionMenuPresenterCallback mActionMenuPresenterCallback; public ActionMode mActionMode; public PopupWindow mActionModePopup; public ActionBarContextView mActionModeView; private boolean mActivityHandlesUiMode; private boolean mActivityHandlesUiModeChecked; public final AppCompatCallback mAppCompatCallback; private AppCompatViewInflater mAppCompatViewInflater; private AppCompatWindowCallback mAppCompatWindowCallback; private AutoNightModeManager mAutoBatteryNightModeManager; private AutoNightModeManager mAutoTimeNightModeManager; private boolean mBaseContextAttached; private boolean mClosingActionMenu; public final Context mContext; private boolean mCreated; private DecorContentParent mDecorContentParent; private boolean mEnableDefaultActionBarUp; public ViewPropertyAnimatorCompat mFadeAnim; private boolean mFeatureIndeterminateProgress; private boolean mFeatureProgress; private boolean mHandleNativeActionModes; public boolean mHasActionBar; public final Object mHost; public int mInvalidatePanelMenuFeatures; public boolean mInvalidatePanelMenuPosted; private final Runnable mInvalidatePanelMenuRunnable; public boolean mIsDestroyed; public boolean mIsFloating; private int mLocalNightMode; private boolean mLongPressBackDown; public MenuInflater mMenuInflater; public boolean mOverlayActionBar; public boolean mOverlayActionMode; private PanelMenuPresenterCallback mPanelMenuPresenterCallback; private PanelFeatureState[] mPanels; private PanelFeatureState mPreparedPanel; public Runnable mShowActionModePopup; private boolean mStarted; private View mStatusGuard; public ViewGroup mSubDecor; private boolean mSubDecorInstalled; private Rect mTempRect1; private Rect mTempRect2; private int mThemeResId; private CharSequence mTitle; private TextView mTitleView; public Window mWindow; public boolean mWindowNoTitle; /* renamed from: androidx.appcompat.app.AppCompatDelegateImpl$1 reason: invalid class name */ public class AnonymousClass1 implements Thread.UncaughtExceptionHandler { public final /* synthetic */ Thread.UncaughtExceptionHandler val$defHandler; public AnonymousClass1(Thread.UncaughtExceptionHandler uncaughtExceptionHandler) { this.val$defHandler = uncaughtExceptionHandler; } private boolean shouldWrapException(Throwable th) { String message; if (!(th instanceof Resources.NotFoundException) || (message = th.getMessage()) == null) { return false; } return message.contains("drawable") || message.contains("Drawable"); } @Override // java.lang.Thread.UncaughtExceptionHandler public void uncaughtException(@NonNull Thread thread, @NonNull Throwable th) { if (shouldWrapException(th)) { Resources.NotFoundException notFoundException = new Resources.NotFoundException(th.getMessage() + AppCompatDelegateImpl.EXCEPTION_HANDLER_MESSAGE_SUFFIX); notFoundException.initCause(th.getCause()); notFoundException.setStackTrace(th.getStackTrace()); this.val$defHandler.uncaughtException(thread, notFoundException); return; } this.val$defHandler.uncaughtException(thread, th); } } /* renamed from: androidx.appcompat.app.AppCompatDelegateImpl$2 reason: invalid class name */ public class AnonymousClass2 implements Runnable { public AnonymousClass2() { } @Override // java.lang.Runnable public void run() { AppCompatDelegateImpl appCompatDelegateImpl = AppCompatDelegateImpl.this; if ((appCompatDelegateImpl.mInvalidatePanelMenuFeatures & 1) != 0) { appCompatDelegateImpl.doInvalidatePanelMenu(0); } AppCompatDelegateImpl appCompatDelegateImpl2 = AppCompatDelegateImpl.this; if ((appCompatDelegateImpl2.mInvalidatePanelMenuFeatures & 4096) != 0) { appCompatDelegateImpl2.doInvalidatePanelMenu(108); } AppCompatDelegateImpl appCompatDelegateImpl3 = AppCompatDelegateImpl.this; appCompatDelegateImpl3.mInvalidatePanelMenuPosted = false; appCompatDelegateImpl3.mInvalidatePanelMenuFeatures = 0; } } /* renamed from: androidx.appcompat.app.AppCompatDelegateImpl$3 reason: invalid class name */ public class AnonymousClass3 implements OnApplyWindowInsetsListener { public AnonymousClass3() { } @Override // androidx.core.view.OnApplyWindowInsetsListener public WindowInsetsCompat onApplyWindowInsets(View view, WindowInsetsCompat windowInsetsCompat) { int systemWindowInsetTop = windowInsetsCompat.getSystemWindowInsetTop(); int updateStatusGuard = AppCompatDelegateImpl.this.updateStatusGuard(windowInsetsCompat, null); if (systemWindowInsetTop != updateStatusGuard) { windowInsetsCompat = windowInsetsCompat.replaceSystemWindowInsets(windowInsetsCompat.getSystemWindowInsetLeft(), updateStatusGuard, windowInsetsCompat.getSystemWindowInsetRight(), windowInsetsCompat.getSystemWindowInsetBottom()); } return ViewCompat.onApplyWindowInsets(view, windowInsetsCompat); } } /* renamed from: androidx.appcompat.app.AppCompatDelegateImpl$4 reason: invalid class name */ public class AnonymousClass4 implements FitWindowsViewGroup.OnFitSystemWindowsListener { public AnonymousClass4() { } @Override // androidx.appcompat.widget.FitWindowsViewGroup.OnFitSystemWindowsListener public void onFitSystemWindows(Rect rect) { rect.top = AppCompatDelegateImpl.this.updateStatusGuard(null, rect); } } /* renamed from: androidx.appcompat.app.AppCompatDelegateImpl$5 reason: invalid class name */ public class AnonymousClass5 implements ContentFrameLayout.OnAttachListener { public AnonymousClass5() { } @Override // androidx.appcompat.widget.ContentFrameLayout.OnAttachListener public void onAttachedFromWindow() { } @Override // androidx.appcompat.widget.ContentFrameLayout.OnAttachListener public void onDetachedFromWindow() { AppCompatDelegateImpl.this.dismissPopups(); } } /* renamed from: androidx.appcompat.app.AppCompatDelegateImpl$6 reason: invalid class name */ public class AnonymousClass6 implements Runnable { /* renamed from: androidx.appcompat.app.AppCompatDelegateImpl$6$1 reason: invalid class name */ public class AnonymousClass1 extends ViewPropertyAnimatorListenerAdapter { public AnonymousClass1() { } @Override // androidx.core.view.ViewPropertyAnimatorListenerAdapter, androidx.core.view.ViewPropertyAnimatorListener public void onAnimationEnd(View view) { AppCompatDelegateImpl.this.mActionModeView.setAlpha(1.0f); AppCompatDelegateImpl.this.mFadeAnim.setListener(null); AppCompatDelegateImpl.this.mFadeAnim = null; } @Override // androidx.core.view.ViewPropertyAnimatorListenerAdapter, androidx.core.view.ViewPropertyAnimatorListener public void onAnimationStart(View view) { AppCompatDelegateImpl.this.mActionModeView.setVisibility(0); } } public AnonymousClass6() { } @Override // java.lang.Runnable public void run() { AppCompatDelegateImpl appCompatDelegateImpl = AppCompatDelegateImpl.this; appCompatDelegateImpl.mActionModePopup.showAtLocation(appCompatDelegateImpl.mActionModeView, 55, 0, 0); AppCompatDelegateImpl.this.endOnGoingFadeAnimation(); if (AppCompatDelegateImpl.this.shouldAnimateActionModeView()) { AppCompatDelegateImpl.this.mActionModeView.setAlpha(0.0f); AppCompatDelegateImpl appCompatDelegateImpl2 = AppCompatDelegateImpl.this; appCompatDelegateImpl2.mFadeAnim = ViewCompat.animate(appCompatDelegateImpl2.mActionModeView).alpha(1.0f); AppCompatDelegateImpl.this.mFadeAnim.setListener(new AnonymousClass1()); return; } AppCompatDelegateImpl.this.mActionModeView.setAlpha(1.0f); AppCompatDelegateImpl.this.mActionModeView.setVisibility(0); } } /* renamed from: androidx.appcompat.app.AppCompatDelegateImpl$7 reason: invalid class name */ public class AnonymousClass7 extends ViewPropertyAnimatorListenerAdapter { public AnonymousClass7() { } @Override // androidx.core.view.ViewPropertyAnimatorListenerAdapter, androidx.core.view.ViewPropertyAnimatorListener public void onAnimationEnd(View view) { AppCompatDelegateImpl.this.mActionModeView.setAlpha(1.0f); AppCompatDelegateImpl.this.mFadeAnim.setListener(null); AppCompatDelegateImpl.this.mFadeAnim = null; } @Override // androidx.core.view.ViewPropertyAnimatorListenerAdapter, androidx.core.view.ViewPropertyAnimatorListener public void onAnimationStart(View view) { AppCompatDelegateImpl.this.mActionModeView.setVisibility(0); AppCompatDelegateImpl.this.mActionModeView.sendAccessibilityEvent(32); if (AppCompatDelegateImpl.this.mActionModeView.getParent() instanceof View) { ViewCompat.requestApplyInsets((View) AppCompatDelegateImpl.this.mActionModeView.getParent()); } } } public class ActionBarDrawableToggleImpl implements ActionBarDrawerToggle.Delegate { public ActionBarDrawableToggleImpl() { } @Override // androidx.appcompat.app.ActionBarDrawerToggle.Delegate public Context getActionBarThemedContext() { return AppCompatDelegateImpl.this.getActionBarThemedContext(); } @Override // androidx.appcompat.app.ActionBarDrawerToggle.Delegate public Drawable getThemeUpIndicator() { TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(getActionBarThemedContext(), (AttributeSet) null, new int[]{R.attr.homeAsUpIndicator}); Drawable drawable = obtainStyledAttributes.getDrawable(0); obtainStyledAttributes.recycle(); return drawable; } @Override // androidx.appcompat.app.ActionBarDrawerToggle.Delegate public boolean isNavigationVisible() { ActionBar supportActionBar = AppCompatDelegateImpl.this.getSupportActionBar(); return (supportActionBar == null || (supportActionBar.getDisplayOptions() & 4) == 0) ? false : true; } @Override // androidx.appcompat.app.ActionBarDrawerToggle.Delegate public void setActionBarDescription(int i) { ActionBar supportActionBar = AppCompatDelegateImpl.this.getSupportActionBar(); if (supportActionBar != null) { supportActionBar.setHomeActionContentDescription(i); } } @Override // androidx.appcompat.app.ActionBarDrawerToggle.Delegate public void setActionBarUpIndicator(Drawable drawable, int i) { ActionBar supportActionBar = AppCompatDelegateImpl.this.getSupportActionBar(); if (supportActionBar != null) { supportActionBar.setHomeAsUpIndicator(drawable); supportActionBar.setHomeActionContentDescription(i); } } } public final class ActionMenuPresenterCallback implements MenuPresenter.Callback { public ActionMenuPresenterCallback() { } @Override // androidx.appcompat.view.menu.MenuPresenter.Callback public void onCloseMenu(@NonNull MenuBuilder menuBuilder, boolean z2) { AppCompatDelegateImpl.this.checkCloseActionMenu(menuBuilder); } @Override // androidx.appcompat.view.menu.MenuPresenter.Callback public boolean onOpenSubMenu(@NonNull MenuBuilder menuBuilder) { Window.Callback windowCallback = AppCompatDelegateImpl.this.getWindowCallback(); if (windowCallback == null) { return true; } windowCallback.onMenuOpened(108, menuBuilder); return true; } } public class ActionModeCallbackWrapperV9 implements ActionMode.Callback { private ActionMode.Callback mWrapped; /* renamed from: androidx.appcompat.app.AppCompatDelegateImpl$ActionModeCallbackWrapperV9$1 reason: invalid class name */ public class AnonymousClass1 extends ViewPropertyAnimatorListenerAdapter { public AnonymousClass1() { } @Override // androidx.core.view.ViewPropertyAnimatorListenerAdapter, androidx.core.view.ViewPropertyAnimatorListener public void onAnimationEnd(View view) { AppCompatDelegateImpl.this.mActionModeView.setVisibility(8); AppCompatDelegateImpl appCompatDelegateImpl = AppCompatDelegateImpl.this; PopupWindow popupWindow = appCompatDelegateImpl.mActionModePopup; if (popupWindow != null) { popupWindow.dismiss(); } else if (appCompatDelegateImpl.mActionModeView.getParent() instanceof View) { ViewCompat.requestApplyInsets((View) AppCompatDelegateImpl.this.mActionModeView.getParent()); } AppCompatDelegateImpl.this.mActionModeView.removeAllViews(); AppCompatDelegateImpl.this.mFadeAnim.setListener(null); AppCompatDelegateImpl appCompatDelegateImpl2 = AppCompatDelegateImpl.this; appCompatDelegateImpl2.mFadeAnim = null; ViewCompat.requestApplyInsets(appCompatDelegateImpl2.mSubDecor); } } public ActionModeCallbackWrapperV9(ActionMode.Callback callback) { this.mWrapped = callback; } @Override // androidx.appcompat.view.ActionMode.Callback public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) { return this.mWrapped.onActionItemClicked(actionMode, menuItem); } @Override // androidx.appcompat.view.ActionMode.Callback public boolean onCreateActionMode(ActionMode actionMode, Menu menu) { return this.mWrapped.onCreateActionMode(actionMode, menu); } @Override // androidx.appcompat.view.ActionMode.Callback public void onDestroyActionMode(ActionMode actionMode) { this.mWrapped.onDestroyActionMode(actionMode); AppCompatDelegateImpl appCompatDelegateImpl = AppCompatDelegateImpl.this; if (appCompatDelegateImpl.mActionModePopup != null) { appCompatDelegateImpl.mWindow.getDecorView().removeCallbacks(AppCompatDelegateImpl.this.mShowActionModePopup); } AppCompatDelegateImpl appCompatDelegateImpl2 = AppCompatDelegateImpl.this; if (appCompatDelegateImpl2.mActionModeView != null) { appCompatDelegateImpl2.endOnGoingFadeAnimation(); AppCompatDelegateImpl appCompatDelegateImpl3 = AppCompatDelegateImpl.this; appCompatDelegateImpl3.mFadeAnim = ViewCompat.animate(appCompatDelegateImpl3.mActionModeView).alpha(0.0f); AppCompatDelegateImpl.this.mFadeAnim.setListener(new AnonymousClass1()); } AppCompatDelegateImpl appCompatDelegateImpl4 = AppCompatDelegateImpl.this; AppCompatCallback appCompatCallback = appCompatDelegateImpl4.mAppCompatCallback; if (appCompatCallback != null) { appCompatCallback.onSupportActionModeFinished(appCompatDelegateImpl4.mActionMode); } AppCompatDelegateImpl appCompatDelegateImpl5 = AppCompatDelegateImpl.this; appCompatDelegateImpl5.mActionMode = null; ViewCompat.requestApplyInsets(appCompatDelegateImpl5.mSubDecor); } @Override // androidx.appcompat.view.ActionMode.Callback public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) { ViewCompat.requestApplyInsets(AppCompatDelegateImpl.this.mSubDecor); return this.mWrapped.onPrepareActionMode(actionMode, menu); } } public class AppCompatWindowCallback extends WindowCallbackWrapper { public AppCompatWindowCallback(Window.Callback callback) { super(callback); } @Override // androidx.appcompat.view.WindowCallbackWrapper, android.view.Window.Callback public boolean dispatchKeyEvent(KeyEvent keyEvent) { return AppCompatDelegateImpl.this.dispatchKeyEvent(keyEvent) || super.dispatchKeyEvent(keyEvent); } @Override // androidx.appcompat.view.WindowCallbackWrapper, android.view.Window.Callback public boolean dispatchKeyShortcutEvent(KeyEvent keyEvent) { return super.dispatchKeyShortcutEvent(keyEvent) || AppCompatDelegateImpl.this.onKeyShortcut(keyEvent.getKeyCode(), keyEvent); } @Override // androidx.appcompat.view.WindowCallbackWrapper, android.view.Window.Callback public void onContentChanged() { } @Override // androidx.appcompat.view.WindowCallbackWrapper, android.view.Window.Callback public boolean onCreatePanelMenu(int i, Menu menu) { if (i != 0 || (menu instanceof MenuBuilder)) { return super.onCreatePanelMenu(i, menu); } return false; } @Override // androidx.appcompat.view.WindowCallbackWrapper, android.view.Window.Callback public boolean onMenuOpened(int i, Menu menu) { super.onMenuOpened(i, menu); AppCompatDelegateImpl.this.onMenuOpened(i); return true; } @Override // androidx.appcompat.view.WindowCallbackWrapper, android.view.Window.Callback public void onPanelClosed(int i, Menu menu) { super.onPanelClosed(i, menu); AppCompatDelegateImpl.this.onPanelClosed(i); } @Override // androidx.appcompat.view.WindowCallbackWrapper, android.view.Window.Callback public boolean onPreparePanel(int i, View view, Menu menu) { MenuBuilder menuBuilder = menu instanceof MenuBuilder ? (MenuBuilder) menu : null; if (i == 0 && menuBuilder == null) { return false; } if (menuBuilder != null) { menuBuilder.setOverrideVisibleItems(true); } boolean onPreparePanel = super.onPreparePanel(i, view, menu); if (menuBuilder != null) { menuBuilder.setOverrideVisibleItems(false); } return onPreparePanel; } @Override // androidx.appcompat.view.WindowCallbackWrapper, android.view.Window.Callback @RequiresApi(24) public void onProvideKeyboardShortcuts(List list, Menu menu, int i) { MenuBuilder menuBuilder; PanelFeatureState panelState = AppCompatDelegateImpl.this.getPanelState(0, true); if (panelState == null || (menuBuilder = panelState.menu) == null) { super.onProvideKeyboardShortcuts(list, menu, i); } else { super.onProvideKeyboardShortcuts(list, menuBuilder, i); } } @Override // androidx.appcompat.view.WindowCallbackWrapper, android.view.Window.Callback 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); } @Override // androidx.appcompat.view.WindowCallbackWrapper, android.view.Window.Callback @RequiresApi(23) public android.view.ActionMode onWindowStartingActionMode(ActionMode.Callback callback, int i) { return (!AppCompatDelegateImpl.this.isHandleNativeActionModesEnabled() || i != 0) ? super.onWindowStartingActionMode(callback, i) : startAsSupportActionMode(callback); } 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; } } public class AutoBatteryNightModeManager extends AutoNightModeManager { private final PowerManager mPowerManager; public AutoBatteryNightModeManager(@NonNull Context context) { super(); this.mPowerManager = (PowerManager) context.getApplicationContext().getSystemService("power"); } @Override // androidx.appcompat.app.AppCompatDelegateImpl.AutoNightModeManager public IntentFilter createIntentFilterForBroadcastReceiver() { IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction("android.os.action.POWER_SAVE_MODE_CHANGED"); return intentFilter; } @Override // androidx.appcompat.app.AppCompatDelegateImpl.AutoNightModeManager public int getApplyableNightMode() { return this.mPowerManager.isPowerSaveMode() ? 2 : 1; } @Override // androidx.appcompat.app.AppCompatDelegateImpl.AutoNightModeManager public void onChange() { AppCompatDelegateImpl.this.applyDayNight(); } } @VisibleForTesting @RestrictTo({RestrictTo.Scope.LIBRARY}) public abstract class AutoNightModeManager { private BroadcastReceiver mReceiver; /* renamed from: androidx.appcompat.app.AppCompatDelegateImpl$AutoNightModeManager$1 reason: invalid class name */ public class AnonymousClass1 extends BroadcastReceiver { public AnonymousClass1() { } @Override // android.content.BroadcastReceiver public void onReceive(Context context, Intent intent) { AutoNightModeManager.this.onChange(); } } public AutoNightModeManager() { } public void cleanup() { BroadcastReceiver broadcastReceiver = this.mReceiver; if (broadcastReceiver != null) { try { AppCompatDelegateImpl.this.mContext.unregisterReceiver(broadcastReceiver); } catch (IllegalArgumentException unused) { } this.mReceiver = null; } } @Nullable public abstract IntentFilter createIntentFilterForBroadcastReceiver(); public abstract int getApplyableNightMode(); public boolean isListening() { return this.mReceiver != null; } public abstract void onChange(); public void setup() { cleanup(); IntentFilter createIntentFilterForBroadcastReceiver = createIntentFilterForBroadcastReceiver(); if (createIntentFilterForBroadcastReceiver != null && createIntentFilterForBroadcastReceiver.countActions() != 0) { if (this.mReceiver == null) { this.mReceiver = new AnonymousClass1(); } AppCompatDelegateImpl.this.mContext.registerReceiver(this.mReceiver, createIntentFilterForBroadcastReceiver); } } } public class AutoTimeNightModeManager extends AutoNightModeManager { private final TwilightManager mTwilightManager; public AutoTimeNightModeManager(@NonNull TwilightManager twilightManager) { super(); this.mTwilightManager = twilightManager; } @Override // androidx.appcompat.app.AppCompatDelegateImpl.AutoNightModeManager 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; } @Override // androidx.appcompat.app.AppCompatDelegateImpl.AutoNightModeManager public int getApplyableNightMode() { return this.mTwilightManager.isNight() ? 2 : 1; } @Override // androidx.appcompat.app.AppCompatDelegateImpl.AutoNightModeManager public void onChange() { AppCompatDelegateImpl.this.applyDayNight(); } } @RequiresApi(17) public static class ConfigurationImplApi17 { private ConfigurationImplApi17() { } public static void generateConfigDelta_densityDpi(@NonNull Configuration configuration, @NonNull Configuration configuration2, @NonNull Configuration configuration3) { int i = configuration.densityDpi; int i2 = configuration2.densityDpi; if (i != i2) { configuration3.densityDpi = i2; } } } @RequiresApi(24) public static class ConfigurationImplApi24 { private ConfigurationImplApi24() { } public static void generateConfigDelta_locale(@NonNull Configuration configuration, @NonNull Configuration configuration2, @NonNull Configuration configuration3) { LocaleList locales = configuration.getLocales(); LocaleList locales2 = configuration2.getLocales(); if (!locales.equals(locales2)) { configuration3.setLocales(locales2); configuration3.locale = configuration2.locale; } } } @RequiresApi(26) public static class ConfigurationImplApi26 { private ConfigurationImplApi26() { } public static void generateConfigDelta_colorMode(@NonNull Configuration configuration, @NonNull Configuration configuration2, @NonNull Configuration configuration3) { int i = configuration.colorMode & 3; int i2 = configuration2.colorMode; if (i != (i2 & 3)) { configuration3.colorMode |= i2 & 3; } int i3 = configuration.colorMode & 12; int i4 = configuration2.colorMode; if (i3 != (i4 & 12)) { configuration3.colorMode |= i4 & 12; } } } @RequiresApi(17) public static class ContextThemeWrapperCompatApi17Impl { private ContextThemeWrapperCompatApi17Impl() { } public static void applyOverrideConfiguration(ContextThemeWrapper contextThemeWrapper, Configuration configuration) { contextThemeWrapper.applyOverrideConfiguration(configuration); } } public class ListMenuDecorView extends ContentFrameLayout { public ListMenuDecorView(Context context) { super(context); } private boolean isOutOfBounds(int i, int i2) { return i < -5 || i2 < -5 || i > getWidth() + 5 || i2 > getHeight() + 5; } @Override // android.view.View, android.view.ViewGroup public boolean dispatchKeyEvent(KeyEvent keyEvent) { return AppCompatDelegateImpl.this.dispatchKeyEvent(keyEvent) || super.dispatchKeyEvent(keyEvent); } @Override // android.view.ViewGroup public boolean onInterceptTouchEvent(MotionEvent motionEvent) { if (motionEvent.getAction() != 0 || !isOutOfBounds((int) motionEvent.getX(), (int) motionEvent.getY())) { return super.onInterceptTouchEvent(motionEvent); } AppCompatDelegateImpl.this.closePanel(0); return true; } @Override // android.view.View public void setBackgroundResource(int i) { setBackgroundDrawable(AppCompatResources.getDrawable(getContext(), i)); } } public static final class PanelFeatureState { public int background; public View createdPanelView; public ViewGroup decorView; public int featureId; public Bundle frozenActionViewState; public Bundle frozenMenuState; public int gravity; public boolean isHandled; public boolean isOpen; public boolean isPrepared; public ListMenuPresenter listMenuPresenter; public Context listPresenterContext; public MenuBuilder menu; public boolean qwertyMode; public boolean refreshDecorView = false; public boolean refreshMenuContent; public View shownPanelView; public boolean wasLastOpen; public int windowAnimations; /* renamed from: x reason: collision with root package name */ public int f14x; /* renamed from: y reason: collision with root package name */ public int f15y; @SuppressLint({"BanParcelableUsage"}) public static class SavedState implements Parcelable { public static final Parcelable.Creator CREATOR = new AnonymousClass1(); public int featureId; public boolean isOpen; public Bundle menuState; /* renamed from: androidx.appcompat.app.AppCompatDelegateImpl$PanelFeatureState$SavedState$1 reason: invalid class name */ public class AnonymousClass1 implements Parcelable.ClassLoaderCreator { @Override // android.os.Parcelable.Creator public SavedState createFromParcel(Parcel parcel) { return SavedState.readFromParcel(parcel, null); } @Override // android.os.Parcelable.ClassLoaderCreator public SavedState createFromParcel(Parcel parcel, ClassLoader classLoader) { return SavedState.readFromParcel(parcel, classLoader); } @Override // android.os.Parcelable.Creator public SavedState[] newArray(int i) { return new SavedState[i]; } } public static SavedState readFromParcel(Parcel parcel, ClassLoader classLoader) { SavedState savedState = new SavedState(); savedState.featureId = parcel.readInt(); boolean z2 = true; if (parcel.readInt() != 1) { z2 = false; } savedState.isOpen = z2; if (z2) { savedState.menuState = parcel.readBundle(classLoader); } return savedState; } @Override // android.os.Parcelable public int describeContents() { return 0; } @Override // android.os.Parcelable public void writeToParcel(Parcel parcel, int i) { parcel.writeInt(this.featureId); parcel.writeInt(this.isOpen ? 1 : 0); if (this.isOpen) { parcel.writeBundle(this.menuState); } } } public PanelFeatureState(int i) { this.featureId = i; } 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; } public MenuView getListMenuView(MenuPresenter.Callback callback) { if (this.menu == null) { return null; } if (this.listMenuPresenter == null) { ListMenuPresenter listMenuPresenter = new ListMenuPresenter(this.listPresenterContext, R.layout.abc_list_menu_item_layout); this.listMenuPresenter = listMenuPresenter; listMenuPresenter.setCallback(callback); this.menu.addMenuPresenter(this.listMenuPresenter); } return this.listMenuPresenter.getMenuView(this.decorView); } public boolean hasPanelItems() { if (this.shownPanelView == null) { return false; } return this.createdPanelView != null || this.listMenuPresenter.getAdapter().getCount() > 0; } public void onRestoreInstanceState(Parcelable parcelable) { SavedState savedState = (SavedState) parcelable; this.featureId = savedState.featureId; this.wasLastOpen = savedState.isOpen; this.frozenMenuState = savedState.menuState; this.shownPanelView = null; this.decorView = null; } public Parcelable onSaveInstanceState() { SavedState savedState = new SavedState(); savedState.featureId = this.featureId; savedState.isOpen = this.isOpen; if (this.menu != null) { Bundle bundle = new Bundle(); savedState.menuState = bundle; this.menu.savePresenterStates(bundle); } return savedState; } public void setMenu(MenuBuilder menuBuilder) { ListMenuPresenter listMenuPresenter; MenuBuilder menuBuilder2 = this.menu; if (menuBuilder != menuBuilder2) { if (menuBuilder2 != null) { menuBuilder2.removeMenuPresenter(this.listMenuPresenter); } this.menu = menuBuilder; if (menuBuilder != null && (listMenuPresenter = this.listMenuPresenter) != null) { menuBuilder.addMenuPresenter(listMenuPresenter); } } } 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); int i = typedValue.resourceId; if (i != 0) { newTheme.applyStyle(i, true); } newTheme.resolveAttribute(R.attr.panelMenuListTheme, typedValue, true); int i2 = typedValue.resourceId; if (i2 != 0) { newTheme.applyStyle(i2, true); } else { newTheme.applyStyle(R.style.Theme_AppCompat_CompactMenu, true); } androidx.appcompat.view.ContextThemeWrapper contextThemeWrapper = new androidx.appcompat.view.ContextThemeWrapper(context, 0); contextThemeWrapper.getTheme().setTo(newTheme); this.listPresenterContext = contextThemeWrapper; TypedArray obtainStyledAttributes = contextThemeWrapper.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(); } } public final class PanelMenuPresenterCallback implements MenuPresenter.Callback { public PanelMenuPresenterCallback() { } @Override // androidx.appcompat.view.menu.MenuPresenter.Callback public void onCloseMenu(@NonNull MenuBuilder menuBuilder, boolean z2) { MenuBuilder rootMenu = menuBuilder.getRootMenu(); boolean z3 = rootMenu != menuBuilder; AppCompatDelegateImpl appCompatDelegateImpl = AppCompatDelegateImpl.this; if (z3) { menuBuilder = rootMenu; } PanelFeatureState findMenuPanel = appCompatDelegateImpl.findMenuPanel(menuBuilder); if (findMenuPanel == null) { return; } if (z3) { AppCompatDelegateImpl.this.callOnPanelClosed(findMenuPanel.featureId, findMenuPanel, rootMenu); AppCompatDelegateImpl.this.closePanel(findMenuPanel, true); return; } AppCompatDelegateImpl.this.closePanel(findMenuPanel, z2); } @Override // androidx.appcompat.view.menu.MenuPresenter.Callback public boolean onOpenSubMenu(@NonNull MenuBuilder menuBuilder) { Window.Callback windowCallback; if (menuBuilder != menuBuilder.getRootMenu()) { return true; } AppCompatDelegateImpl appCompatDelegateImpl = AppCompatDelegateImpl.this; if (!appCompatDelegateImpl.mHasActionBar || (windowCallback = appCompatDelegateImpl.getWindowCallback()) == null || AppCompatDelegateImpl.this.mIsDestroyed) { return true; } windowCallback.onMenuOpened(108, menuBuilder); return true; } } public AppCompatDelegateImpl(Activity activity, AppCompatCallback appCompatCallback) { this(activity, null, appCompatCallback, activity); } public AppCompatDelegateImpl(Dialog dialog, AppCompatCallback appCompatCallback) { this(dialog.getContext(), dialog.getWindow(), appCompatCallback, dialog); } public AppCompatDelegateImpl(Context context, Activity activity, AppCompatCallback appCompatCallback) { this(context, null, appCompatCallback, activity); } public AppCompatDelegateImpl(Context context, Window window, AppCompatCallback appCompatCallback) { this(context, window, appCompatCallback, context); } private AppCompatDelegateImpl(Context context, Window window, AppCompatCallback appCompatCallback, Object obj) { SimpleArrayMap simpleArrayMap; Integer num; AppCompatActivity tryUnwrapContext; this.mFadeAnim = null; this.mHandleNativeActionModes = true; this.mLocalNightMode = -100; this.mInvalidatePanelMenuRunnable = new AnonymousClass2(); this.mContext = context; this.mAppCompatCallback = appCompatCallback; this.mHost = obj; if (this.mLocalNightMode == -100 && (obj instanceof Dialog) && (tryUnwrapContext = tryUnwrapContext()) != null) { this.mLocalNightMode = tryUnwrapContext.getDelegate().getLocalNightMode(); } if (this.mLocalNightMode == -100 && (num = (simpleArrayMap = sLocalNightModes).get(obj.getClass().getName())) != null) { this.mLocalNightMode = num.intValue(); simpleArrayMap.remove(obj.getClass().getName()); } if (window != null) { attachToWindow(window); } AppCompatDrawableManager.preload(); } private boolean applyDayNight(boolean z2) { if (this.mIsDestroyed) { return false; } int calculateNightMode = calculateNightMode(); boolean updateForNightMode = updateForNightMode(mapNightMode(this.mContext, calculateNightMode), z2); 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()); int i = R.styleable.AppCompatTheme_windowFixedWidthMajor; if (obtainStyledAttributes.hasValue(i)) { obtainStyledAttributes.getValue(i, contentFrameLayout.getFixedWidthMajor()); } int i2 = R.styleable.AppCompatTheme_windowFixedWidthMinor; if (obtainStyledAttributes.hasValue(i2)) { obtainStyledAttributes.getValue(i2, contentFrameLayout.getFixedWidthMinor()); } int i3 = R.styleable.AppCompatTheme_windowFixedHeightMajor; if (obtainStyledAttributes.hasValue(i3)) { obtainStyledAttributes.getValue(i3, contentFrameLayout.getFixedHeightMajor()); } int i4 = R.styleable.AppCompatTheme_windowFixedHeightMinor; if (obtainStyledAttributes.hasValue(i4)) { obtainStyledAttributes.getValue(i4, contentFrameLayout.getFixedHeightMinor()); } obtainStyledAttributes.recycle(); contentFrameLayout.requestLayout(); } private void attachToWindow(@NonNull 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 : AppCompatDelegate.getDefaultNightMode(); } private void cleanupAutoManagers() { AutoNightModeManager autoNightModeManager = this.mAutoTimeNightModeManager; if (autoNightModeManager != null) { autoNightModeManager.cleanup(); } AutoNightModeManager autoNightModeManager2 = this.mAutoBatteryNightModeManager; if (autoNightModeManager2 != null) { autoNightModeManager2.cleanup(); } } @NonNull private Configuration createOverrideConfigurationForDayNight(@NonNull Context context, int i, @Nullable Configuration configuration) { int i2 = i != 1 ? i != 2 ? context.getApplicationContext().getResources().getConfiguration().uiMode & 48 : 32 : 16; Configuration configuration2 = new Configuration(); configuration2.fontScale = 0.0f; if (configuration != null) { configuration2.setTo(configuration); } configuration2.uiMode = i2 | (configuration2.uiMode & -49); return configuration2; } private ViewGroup createSubDecor() { ViewGroup viewGroup; TypedArray obtainStyledAttributes = this.mContext.obtainStyledAttributes(R.styleable.AppCompatTheme); int i = R.styleable.AppCompatTheme_windowActionBar; if (obtainStyledAttributes.hasValue(i)) { if (obtainStyledAttributes.getBoolean(R.styleable.AppCompatTheme_windowNoTitle, false)) { requestWindowFeature(1); } else if (obtainStyledAttributes.getBoolean(i, false)) { requestWindowFeature(108); } if (obtainStyledAttributes.getBoolean(R.styleable.AppCompatTheme_windowActionBarOverlay, false)) { requestWindowFeature(109); } if (obtainStyledAttributes.getBoolean(R.styleable.AppCompatTheme_windowActionModeOverlay, false)) { requestWindowFeature(10); } this.mIsFloating = obtainStyledAttributes.getBoolean(R.styleable.AppCompatTheme_android_windowIsFloating, false); obtainStyledAttributes.recycle(); ensureWindow(); this.mWindow.getDecorView(); LayoutInflater from = LayoutInflater.from(this.mContext); if (this.mWindowNoTitle) { viewGroup = this.mOverlayActionMode ? (ViewGroup) from.inflate(R.layout.abc_screen_simple_overlay_action_mode, (ViewGroup) null) : (ViewGroup) from.inflate(R.layout.abc_screen_simple, (ViewGroup) null); } else if (this.mIsFloating) { viewGroup = (ViewGroup) from.inflate(R.layout.abc_dialog_title_material, (ViewGroup) null); this.mOverlayActionBar = false; this.mHasActionBar = false; } else if (this.mHasActionBar) { TypedValue typedValue = new TypedValue(); this.mContext.getTheme().resolveAttribute(R.attr.actionBarTheme, typedValue, true); viewGroup = (ViewGroup) LayoutInflater.from(typedValue.resourceId != 0 ? new androidx.appcompat.view.ContextThemeWrapper(this.mContext, typedValue.resourceId) : this.mContext).inflate(R.layout.abc_screen_toolbar, (ViewGroup) null); DecorContentParent decorContentParent = (DecorContentParent) viewGroup.findViewById(R.id.decor_content_parent); this.mDecorContentParent = decorContentParent; decorContentParent.setWindowCallback(getWindowCallback()); if (this.mOverlayActionBar) { this.mDecorContentParent.initFeature(109); } if (this.mFeatureProgress) { this.mDecorContentParent.initFeature(2); } if (this.mFeatureIndeterminateProgress) { this.mDecorContentParent.initFeature(5); } } else { viewGroup = null; } if (viewGroup != null) { ViewCompat.setOnApplyWindowInsetsListener(viewGroup, new AnonymousClass3()); if (this.mDecorContentParent == null) { this.mTitleView = (TextView) viewGroup.findViewById(R.id.title); } ViewUtils.makeOptionalFitsSystemWindows(viewGroup); ContentFrameLayout contentFrameLayout = (ContentFrameLayout) viewGroup.findViewById(R.id.action_bar_activity_content); ViewGroup viewGroup2 = (ViewGroup) this.mWindow.findViewById(16908290); if (viewGroup2 != null) { while (viewGroup2.getChildCount() > 0) { View childAt = viewGroup2.getChildAt(0); viewGroup2.removeViewAt(0); contentFrameLayout.addView(childAt); } viewGroup2.setId(-1); contentFrameLayout.setId(16908290); if (viewGroup2 instanceof FrameLayout) { ((FrameLayout) viewGroup2).setForeground(null); } } this.mWindow.setContentView(viewGroup); contentFrameLayout.setAttachListener(new AnonymousClass5()); return viewGroup; } StringBuilder L = a.L("AppCompat does not support the current theme features: { windowActionBar: "); L.append(this.mHasActionBar); L.append(", windowActionBarOverlay: "); L.append(this.mOverlayActionBar); L.append(", android:windowIsFloating: "); L.append(this.mIsFloating); L.append(", windowActionModeOverlay: "); L.append(this.mOverlayActionMode); L.append(", windowNoTitle: "); throw new IllegalArgumentException(a.G(L, this.mWindowNoTitle, " }")); } obtainStyledAttributes.recycle(); throw new IllegalStateException("You need to use a Theme.AppCompat theme (or descendant) with this activity."); } 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.mIsDestroyed) { return; } if (panelState == null || panelState.menu == null) { invalidatePanelMenu(108); } } } 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"); } } @NonNull private static Configuration generateConfigDelta(@NonNull Configuration configuration, @Nullable Configuration configuration2) { Configuration configuration3 = new Configuration(); configuration3.fontScale = 0.0f; if (!(configuration2 == null || configuration.diff(configuration2) == 0)) { float f = configuration.fontScale; float f2 = configuration2.fontScale; if (f != f2) { configuration3.fontScale = f2; } int i = configuration.mcc; int i2 = configuration2.mcc; if (i != i2) { configuration3.mcc = i2; } int i3 = configuration.mnc; int i4 = configuration2.mnc; if (i3 != i4) { configuration3.mnc = i4; } int i5 = Build.VERSION.SDK_INT; if (i5 >= 24) { ConfigurationImplApi24.generateConfigDelta_locale(configuration, configuration2, configuration3); } else if (!ObjectsCompat.equals(configuration.locale, configuration2.locale)) { configuration3.locale = configuration2.locale; } int i6 = configuration.touchscreen; int i7 = configuration2.touchscreen; if (i6 != i7) { configuration3.touchscreen = i7; } int i8 = configuration.keyboard; int i9 = configuration2.keyboard; if (i8 != i9) { configuration3.keyboard = i9; } int i10 = configuration.keyboardHidden; int i11 = configuration2.keyboardHidden; if (i10 != i11) { configuration3.keyboardHidden = i11; } int i12 = configuration.navigation; int i13 = configuration2.navigation; if (i12 != i13) { configuration3.navigation = i13; } int i14 = configuration.navigationHidden; int i15 = configuration2.navigationHidden; if (i14 != i15) { configuration3.navigationHidden = i15; } int i16 = configuration.orientation; int i17 = configuration2.orientation; if (i16 != i17) { configuration3.orientation = i17; } int i18 = configuration.screenLayout & 15; int i19 = configuration2.screenLayout; if (i18 != (i19 & 15)) { configuration3.screenLayout |= i19 & 15; } int i20 = configuration.screenLayout & 192; int i21 = configuration2.screenLayout; if (i20 != (i21 & 192)) { configuration3.screenLayout |= i21 & 192; } int i22 = configuration.screenLayout & 48; int i23 = configuration2.screenLayout; if (i22 != (i23 & 48)) { configuration3.screenLayout |= i23 & 48; } int i24 = configuration.screenLayout & 768; int i25 = configuration2.screenLayout; if (i24 != (i25 & 768)) { configuration3.screenLayout |= i25 & 768; } if (i5 >= 26) { ConfigurationImplApi26.generateConfigDelta_colorMode(configuration, configuration2, configuration3); } int i26 = configuration.uiMode & 15; int i27 = configuration2.uiMode; if (i26 != (i27 & 15)) { configuration3.uiMode |= i27 & 15; } int i28 = configuration.uiMode & 48; int i29 = configuration2.uiMode; if (i28 != (i29 & 48)) { configuration3.uiMode |= i29 & 48; } int i30 = configuration.screenWidthDp; int i31 = configuration2.screenWidthDp; if (i30 != i31) { configuration3.screenWidthDp = i31; } int i32 = configuration.screenHeightDp; int i33 = configuration2.screenHeightDp; if (i32 != i33) { configuration3.screenHeightDp = i33; } int i34 = configuration.smallestScreenWidthDp; int i35 = configuration2.smallestScreenWidthDp; if (i34 != i35) { configuration3.smallestScreenWidthDp = i35; } ConfigurationImplApi17.generateConfigDelta_densityDpi(configuration, configuration2, configuration3); } return configuration3; } private AutoNightModeManager getAutoBatteryNightModeManager(@NonNull Context context) { if (this.mAutoBatteryNightModeManager == null) { this.mAutoBatteryNightModeManager = new AutoBatteryNightModeManager(context); } return this.mAutoBatteryNightModeManager; } private AutoNightModeManager getAutoTimeNightModeManager(@NonNull 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 panelFeatureState) { View view = panelFeatureState.createdPanelView; if (view != null) { panelFeatureState.shownPanelView = view; return true; } else if (panelFeatureState.menu == null) { return false; } else { if (this.mPanelMenuPresenterCallback == null) { this.mPanelMenuPresenterCallback = new PanelMenuPresenterCallback(); } View view2 = (View) panelFeatureState.getListMenuView(this.mPanelMenuPresenterCallback); panelFeatureState.shownPanelView = view2; return view2 != null; } } private boolean initializePanelDecor(PanelFeatureState panelFeatureState) { panelFeatureState.setStyle(getActionBarThemedContext()); panelFeatureState.decorView = new ListMenuDecorView(panelFeatureState.listPresenterContext); panelFeatureState.gravity = 81; return true; } private boolean initializePanelMenu(PanelFeatureState panelFeatureState) { Context context = this.mContext; int i = panelFeatureState.featureId; if ((i == 0 || i == 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) { androidx.appcompat.view.ContextThemeWrapper contextThemeWrapper = new androidx.appcompat.view.ContextThemeWrapper(context, 0); contextThemeWrapper.getTheme().setTo(theme2); context = contextThemeWrapper; } } MenuBuilder menuBuilder = new MenuBuilder(context); menuBuilder.setCallback(this); panelFeatureState.setMenu(menuBuilder); return true; } private void invalidatePanelMenu(int i) { this.mInvalidatePanelMenuFeatures = (1 << i) | this.mInvalidatePanelMenuFeatures; if (!this.mInvalidatePanelMenuPosted) { ViewCompat.postOnAnimation(this.mWindow.getDecorView(), this.mInvalidatePanelMenuRunnable); this.mInvalidatePanelMenuPosted = true; } } private boolean isActivityManifestHandlingUiMode() { if (!this.mActivityHandlesUiModeChecked && (this.mHost instanceof Activity)) { PackageManager packageManager = this.mContext.getPackageManager(); if (packageManager == null) { return false; } try { int i = Build.VERSION.SDK_INT; ActivityInfo activityInfo = packageManager.getActivityInfo(new ComponentName(this.mContext, this.mHost.getClass()), i >= 29 ? 269221888 : i >= 24 ? 786432 : 0); this.mActivityHandlesUiMode = (activityInfo == null || (activityInfo.configChanges & 512) == 0) ? false : true; } catch (PackageManager.NameNotFoundException e) { Log.d(AppCompatDelegate.TAG, "Exception while getting ActivityInfo", e); this.mActivityHandlesUiMode = false; } } this.mActivityHandlesUiModeChecked = true; return this.mActivityHandlesUiMode; } private boolean onKeyDownPanel(int i, KeyEvent keyEvent) { if (keyEvent.getRepeatCount() != 0) { return false; } PanelFeatureState panelState = getPanelState(i, true); if (!panelState.isOpen) { return preparePanel(panelState, keyEvent); } return false; } /* JADX WARNING: Removed duplicated region for block: B:34:0x006a */ private boolean onKeyUpPanel(int i, KeyEvent keyEvent) { boolean z2; DecorContentParent decorContentParent; if (this.mActionMode != null) { return false; } boolean z3 = true; PanelFeatureState panelState = getPanelState(i, true); if (i != 0 || (decorContentParent = this.mDecorContentParent) == null || !decorContentParent.canShowOverflowMenu() || ViewConfiguration.get(this.mContext).hasPermanentMenuKey()) { boolean z4 = panelState.isOpen; if (z4 || panelState.isHandled) { closePanel(panelState, true); z3 = z4; if (z3) { AudioManager audioManager = (AudioManager) this.mContext.getApplicationContext().getSystemService(MediaStreamTrack.AUDIO_TRACK_KIND); if (audioManager != null) { audioManager.playSoundEffect(0); } else { Log.w(AppCompatDelegate.TAG, "Couldn't get audio manager"); } } return z3; } else if (panelState.isPrepared) { if (panelState.refreshMenuContent) { panelState.isPrepared = false; z2 = preparePanel(panelState, keyEvent); } else { z2 = true; } if (z2) { openPanel(panelState, keyEvent); if (z3) { } return z3; } } } else { if (this.mDecorContentParent.isOverflowMenuShowing()) { z3 = this.mDecorContentParent.hideOverflowMenu(); } else if (!this.mIsDestroyed && preparePanel(panelState, keyEvent)) { z3 = this.mDecorContentParent.showOverflowMenu(); } if (z3) { } return z3; } z3 = false; if (z3) { } return z3; } private void openPanel(PanelFeatureState panelFeatureState, KeyEvent keyEvent) { int i; ViewGroup.LayoutParams layoutParams; if (!panelFeatureState.isOpen && !this.mIsDestroyed) { 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(panelFeatureState, keyEvent)) { ViewGroup viewGroup = panelFeatureState.decorView; if (viewGroup == null || panelFeatureState.refreshDecorView) { if (viewGroup == null) { if (!initializePanelDecor(panelFeatureState) || panelFeatureState.decorView == null) { return; } } else if (panelFeatureState.refreshDecorView && viewGroup.getChildCount() > 0) { panelFeatureState.decorView.removeAllViews(); } if (!initializePanelContent(panelFeatureState) || !panelFeatureState.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 { View view = panelFeatureState.createdPanelView; if (!(view == null || (layoutParams = view.getLayoutParams()) == null || layoutParams.width != -1)) { i = -1; panelFeatureState.isHandled = false; WindowManager.LayoutParams layoutParams3 = new WindowManager.LayoutParams(i, -2, panelFeatureState.f14x, panelFeatureState.f15y, PointerIconCompat.TYPE_HAND, 8519680, -3); layoutParams3.gravity = panelFeatureState.gravity; layoutParams3.windowAnimations = panelFeatureState.windowAnimations; windowManager.addView(panelFeatureState.decorView, layoutParams3); panelFeatureState.isOpen = true; return; } } i = -2; panelFeatureState.isHandled = false; WindowManager.LayoutParams layoutParams3 = new WindowManager.LayoutParams(i, -2, panelFeatureState.f14x, panelFeatureState.f15y, 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 panelFeatureState, int i, KeyEvent keyEvent, int i2) { MenuBuilder menuBuilder; boolean z2 = false; if (keyEvent.isSystem()) { return false; } if ((panelFeatureState.isPrepared || preparePanel(panelFeatureState, keyEvent)) && (menuBuilder = panelFeatureState.menu) != null) { z2 = menuBuilder.performShortcut(i, keyEvent, i2); } if (z2 && (i2 & 1) == 0 && this.mDecorContentParent == null) { closePanel(panelFeatureState, true); } return z2; } private boolean preparePanel(PanelFeatureState panelFeatureState, KeyEvent keyEvent) { DecorContentParent decorContentParent; DecorContentParent decorContentParent2; DecorContentParent decorContentParent3; if (this.mIsDestroyed) { return false; } if (panelFeatureState.isPrepared) { return true; } PanelFeatureState panelFeatureState2 = this.mPreparedPanel; if (!(panelFeatureState2 == null || panelFeatureState2 == panelFeatureState)) { closePanel(panelFeatureState2, false); } Window.Callback windowCallback = getWindowCallback(); if (windowCallback != null) { panelFeatureState.createdPanelView = windowCallback.onCreatePanelView(panelFeatureState.featureId); } int i = panelFeatureState.featureId; boolean z2 = i == 0 || i == 108; if (z2 && (decorContentParent3 = this.mDecorContentParent) != null) { decorContentParent3.setMenuPrepared(); } if (panelFeatureState.createdPanelView == null && (!z2 || !(peekSupportActionBar() instanceof ToolbarActionBar))) { MenuBuilder menuBuilder = panelFeatureState.menu; if (menuBuilder == null || panelFeatureState.refreshMenuContent) { if (menuBuilder == null && (!initializePanelMenu(panelFeatureState) || panelFeatureState.menu == null)) { return false; } if (z2 && this.mDecorContentParent != null) { if (this.mActionMenuPresenterCallback == null) { this.mActionMenuPresenterCallback = new ActionMenuPresenterCallback(); } this.mDecorContentParent.setMenu(panelFeatureState.menu, this.mActionMenuPresenterCallback); } panelFeatureState.menu.stopDispatchingItemsChanged(); if (!windowCallback.onCreatePanelMenu(panelFeatureState.featureId, panelFeatureState.menu)) { panelFeatureState.setMenu(null); if (z2 && (decorContentParent2 = this.mDecorContentParent) != null) { decorContentParent2.setMenu(null, this.mActionMenuPresenterCallback); } return false; } panelFeatureState.refreshMenuContent = false; } panelFeatureState.menu.stopDispatchingItemsChanged(); Bundle bundle = panelFeatureState.frozenActionViewState; if (bundle != null) { panelFeatureState.menu.restoreActionViewStates(bundle); panelFeatureState.frozenActionViewState = null; } if (!windowCallback.onPreparePanel(0, panelFeatureState.createdPanelView, panelFeatureState.menu)) { if (z2 && (decorContentParent = this.mDecorContentParent) != null) { decorContentParent.setMenu(null, this.mActionMenuPresenterCallback); } panelFeatureState.menu.startDispatchingItemsChanged(); return false; } boolean z3 = KeyCharacterMap.load(keyEvent != null ? keyEvent.getDeviceId() : -1).getKeyboardType() != 1; panelFeatureState.qwertyMode = z3; panelFeatureState.menu.setQwertyMode(z3); panelFeatureState.menu.startDispatchingItemsChanged(); } panelFeatureState.isPrepared = true; panelFeatureState.isHandled = false; this.mPreparedPanel = panelFeatureState; return true; } private void reopenMenu(boolean z2) { 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, null); return; } Window.Callback windowCallback = getWindowCallback(); if (this.mDecorContentParent.isOverflowMenuShowing() && z2) { this.mDecorContentParent.hideOverflowMenu(); if (!this.mIsDestroyed) { windowCallback.onPanelClosed(108, getPanelState(0, true).menu); } } else if (windowCallback != null && !this.mIsDestroyed) { if (this.mInvalidatePanelMenuPosted && (this.mInvalidatePanelMenuFeatures & 1) != 0) { this.mWindow.getDecorView().removeCallbacks(this.mInvalidatePanelMenuRunnable); this.mInvalidatePanelMenuRunnable.run(); } PanelFeatureState panelState2 = getPanelState(0, true); MenuBuilder menuBuilder = panelState2.menu; if (menuBuilder != null && !panelState2.refreshMenuContent && windowCallback.onPreparePanel(0, panelState2.createdPanelView, menuBuilder)) { windowCallback.onMenuOpened(108, panelState2.menu); this.mDecorContentParent.showOverflowMenu(); } } } private int sanitizeWindowFeatureId(int i) { if (i == 8) { Log.i(AppCompatDelegate.TAG, "You should now use the AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR id when requesting this feature."); return 108; } else if (i != 9) { return i; } else { Log.i(AppCompatDelegate.TAG, "You should now use the AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR_OVERLAY id when requesting this feature."); return 109; } } private boolean shouldInheritContext(ViewParent viewParent) { if (viewParent == null) { return false; } View decorView = this.mWindow.getDecorView(); while (viewParent != null) { if (viewParent == decorView || !(viewParent instanceof View) || ViewCompat.isAttachedToWindow((View) viewParent)) { return false; } viewParent = viewParent.getParent(); } return true; } private void throwFeatureRequestIfSubDecorInstalled() { if (this.mSubDecorInstalled) { throw new AndroidRuntimeException("Window feature must be requested before adding content"); } } @Nullable 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)) { break; } } return null; } /* JADX WARNING: Removed duplicated region for block: B:21:0x0053 */ private boolean updateForNightMode(int i, boolean z2) { boolean z3; Configuration createOverrideConfigurationForDayNight = createOverrideConfigurationForDayNight(this.mContext, i, null); boolean isActivityManifestHandlingUiMode = isActivityManifestHandlingUiMode(); int i2 = this.mContext.getResources().getConfiguration().uiMode & 48; int i3 = createOverrideConfigurationForDayNight.uiMode & 48; boolean z4 = true; if (i2 != i3 && z2 && !isActivityManifestHandlingUiMode && this.mBaseContextAttached && (sCanReturnDifferentContext || this.mCreated)) { Object obj = this.mHost; if ((obj instanceof Activity) && !((Activity) obj).isChild()) { ActivityCompat.recreate((Activity) this.mHost); z3 = true; if (!z3 || i2 == i3) { z4 = z3; } else { updateResourcesConfigurationForNightMode(i3, isActivityManifestHandlingUiMode, null); } if (z4) { Object obj2 = this.mHost; if (obj2 instanceof AppCompatActivity) { ((AppCompatActivity) obj2).onNightModeChanged(i); } } return z4; } } z3 = false; if (!z3) { } z4 = z3; if (z4) { } return z4; } private void updateResourcesConfigurationForNightMode(int i, boolean z2, @Nullable Configuration configuration) { Resources resources = this.mContext.getResources(); Configuration configuration2 = new Configuration(resources.getConfiguration()); if (configuration != null) { configuration2.updateFrom(configuration); } configuration2.uiMode = i | (resources.getConfiguration().uiMode & -49); resources.updateConfiguration(configuration2, null); int i2 = Build.VERSION.SDK_INT; if (i2 < 26) { ResourcesFlusher.flush(resources); } int i3 = this.mThemeResId; if (i3 != 0) { this.mContext.setTheme(i3); if (i2 >= 23) { this.mContext.getTheme().applyStyle(this.mThemeResId, true); } } if (z2) { Object obj = this.mHost; if (obj instanceof Activity) { Activity activity = (Activity) obj; if (activity instanceof LifecycleOwner) { if (((LifecycleOwner) activity).getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED)) { activity.onConfigurationChanged(configuration2); } } else if (this.mStarted) { activity.onConfigurationChanged(configuration2); } } } } private void updateStatusGuardColor(View view) { view.setBackgroundColor((ViewCompat.getWindowSystemUiVisibility(view) & 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)); } @Override // androidx.appcompat.app.AppCompatDelegate public void addContentView(View view, ViewGroup.LayoutParams layoutParams) { ensureSubDecor(); ((ViewGroup) this.mSubDecor.findViewById(16908290)).addView(view, layoutParams); this.mAppCompatWindowCallback.getWrapped().onContentChanged(); } @Override // androidx.appcompat.app.AppCompatDelegate public boolean applyDayNight() { return applyDayNight(true); } @Override // androidx.appcompat.app.AppCompatDelegate @NonNull @CallSuper public Context attachBaseContext2(@NonNull Context context) { boolean z2 = true; this.mBaseContextAttached = true; int mapNightMode = mapNightMode(context, calculateNightMode()); Configuration configuration = null; if (sCanApplyOverrideConfiguration && (context instanceof ContextThemeWrapper)) { try { ContextThemeWrapperCompatApi17Impl.applyOverrideConfiguration((ContextThemeWrapper) context, createOverrideConfigurationForDayNight(context, mapNightMode, null)); return context; } catch (IllegalStateException unused) { } } if (context instanceof androidx.appcompat.view.ContextThemeWrapper) { try { ((androidx.appcompat.view.ContextThemeWrapper) context).applyOverrideConfiguration(createOverrideConfigurationForDayNight(context, mapNightMode, null)); return context; } catch (IllegalStateException unused2) { } } if (!sCanReturnDifferentContext) { return super.attachBaseContext2(context); } try { Configuration configuration2 = context.getPackageManager().getResourcesForApplication(context.getApplicationInfo()).getConfiguration(); Configuration configuration3 = context.getResources().getConfiguration(); if (!configuration2.equals(configuration3)) { configuration = generateConfigDelta(configuration2, configuration3); } Configuration createOverrideConfigurationForDayNight = createOverrideConfigurationForDayNight(context, mapNightMode, configuration); androidx.appcompat.view.ContextThemeWrapper contextThemeWrapper = new androidx.appcompat.view.ContextThemeWrapper(context, R.style.Theme_AppCompat_Empty); contextThemeWrapper.applyOverrideConfiguration(createOverrideConfigurationForDayNight); boolean z3 = false; try { if (context.getTheme() == null) { z2 = false; } z3 = z2; } catch (NullPointerException unused3) { } if (z3) { ResourcesCompat.ThemeCompat.rebase(contextThemeWrapper.getTheme()); } return super.attachBaseContext2(contextThemeWrapper); } catch (PackageManager.NameNotFoundException e) { throw new RuntimeException("Application failed to obtain resources from itself", e); } } public void callOnPanelClosed(int i, PanelFeatureState panelFeatureState, Menu menu) { if (menu == null) { if (panelFeatureState == null && i >= 0) { PanelFeatureState[] panelFeatureStateArr = this.mPanels; if (i < panelFeatureStateArr.length) { panelFeatureState = panelFeatureStateArr[i]; } } if (panelFeatureState != null) { menu = panelFeatureState.menu; } } if ((panelFeatureState == null || panelFeatureState.isOpen) && !this.mIsDestroyed) { this.mAppCompatWindowCallback.getWrapped().onPanelClosed(i, menu); } } public void checkCloseActionMenu(@NonNull MenuBuilder menuBuilder) { if (!this.mClosingActionMenu) { this.mClosingActionMenu = true; this.mDecorContentParent.dismissPopups(); Window.Callback windowCallback = getWindowCallback(); if (windowCallback != null && !this.mIsDestroyed) { windowCallback.onPanelClosed(108, menuBuilder); } this.mClosingActionMenu = false; } } public void closePanel(int i) { closePanel(getPanelState(i, true), true); } public void closePanel(PanelFeatureState panelFeatureState, boolean z2) { ViewGroup viewGroup; DecorContentParent decorContentParent; if (!z2 || panelFeatureState.featureId != 0 || (decorContentParent = this.mDecorContentParent) == null || !decorContentParent.isOverflowMenuShowing()) { WindowManager windowManager = (WindowManager) this.mContext.getSystemService("window"); if (!(windowManager == null || !panelFeatureState.isOpen || (viewGroup = panelFeatureState.decorView) == null)) { windowManager.removeView(viewGroup); if (z2) { callOnPanelClosed(panelFeatureState.featureId, panelFeatureState, null); } } panelFeatureState.isPrepared = false; panelFeatureState.isHandled = false; panelFeatureState.isOpen = false; panelFeatureState.shownPanelView = null; panelFeatureState.refreshDecorView = true; if (this.mPreparedPanel == panelFeatureState) { this.mPreparedPanel = null; return; } return; } checkCloseActionMenu(panelFeatureState.menu); } @Override // androidx.appcompat.app.AppCompatDelegate public View createView(View view, String str, @NonNull Context context, @NonNull AttributeSet attributeSet) { boolean z2; boolean z3 = 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) Class.forName(string).getDeclaredConstructor(new Class[0]).newInstance(new Object[0]); } catch (Throwable th) { Log.i(AppCompatDelegate.TAG, "Failed to instantiate custom view inflater " + string + ". Falling back to default.", th); this.mAppCompatViewInflater = new AppCompatViewInflater(); } } } boolean z4 = IS_PRE_LOLLIPOP; if (z4) { if (!(attributeSet instanceof XmlPullParser)) { z3 = shouldInheritContext((ViewParent) view); } else if (((XmlPullParser) attributeSet).getDepth() > 1) { z3 = true; } z2 = z3; } else { z2 = false; } return this.mAppCompatViewInflater.createView(view, str, context, attributeSet, z2, z4, true, VectorEnabledTintResources.shouldBeUsed()); } public void dismissPopups() { MenuBuilder menuBuilder; 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 unused) { } } this.mActionModePopup = null; } endOnGoingFadeAnimation(); PanelFeatureState panelState = getPanelState(0, false); if (panelState != null && (menuBuilder = panelState.menu) != null) { menuBuilder.close(); } } public boolean dispatchKeyEvent(KeyEvent keyEvent) { View decorView; Object obj = this.mHost; boolean z2 = true; if (((obj instanceof KeyEventDispatcher.Component) || (obj instanceof AppCompatDialog)) && (decorView = this.mWindow.getDecorView()) != null && KeyEventDispatcher.dispatchBeforeHierarchy(decorView, keyEvent)) { return true; } if (keyEvent.getKeyCode() == 82 && this.mAppCompatWindowCallback.getWrapped().dispatchKeyEvent(keyEvent)) { return true; } int keyCode = keyEvent.getKeyCode(); if (keyEvent.getAction() != 0) { z2 = false; } return z2 ? onKeyDown(keyCode, keyEvent) : onKeyUp(keyCode, keyEvent); } public void doInvalidatePanelMenu(int i) { PanelFeatureState panelState; PanelFeatureState panelState2 = getPanelState(i, 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 ((i == 108 || i == 0) && this.mDecorContentParent != null && (panelState = getPanelState(0, false)) != null) { panelState.isPrepared = false; preparePanel(panelState, null); } } public void endOnGoingFadeAnimation() { ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = this.mFadeAnim; if (viewPropertyAnimatorCompat != null) { viewPropertyAnimatorCompat.cancel(); } } 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; } @Override // androidx.appcompat.app.AppCompatDelegate @Nullable public T findViewById(@IdRes int i) { ensureSubDecor(); return (T) this.mWindow.findViewById(i); } public final Context getActionBarThemedContext() { ActionBar supportActionBar = getSupportActionBar(); Context themedContext = supportActionBar != null ? supportActionBar.getThemedContext() : null; return themedContext == null ? this.mContext : themedContext; } @NonNull @RestrictTo({RestrictTo.Scope.LIBRARY}) @VisibleForTesting public final AutoNightModeManager getAutoTimeNightModeManager() { return getAutoTimeNightModeManager(this.mContext); } @Override // androidx.appcompat.app.AppCompatDelegate public final ActionBarDrawerToggle.Delegate getDrawerToggleDelegate() { return new ActionBarDrawableToggleImpl(); } @Override // androidx.appcompat.app.AppCompatDelegate public int getLocalNightMode() { return this.mLocalNightMode; } @Override // androidx.appcompat.app.AppCompatDelegate 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; } public PanelFeatureState getPanelState(int i, boolean z2) { PanelFeatureState[] panelFeatureStateArr = this.mPanels; if (panelFeatureStateArr == null || panelFeatureStateArr.length <= i) { PanelFeatureState[] panelFeatureStateArr2 = new PanelFeatureState[(i + 1)]; if (panelFeatureStateArr != null) { System.arraycopy(panelFeatureStateArr, 0, panelFeatureStateArr2, 0, panelFeatureStateArr.length); } this.mPanels = panelFeatureStateArr2; panelFeatureStateArr = panelFeatureStateArr2; } PanelFeatureState panelFeatureState = panelFeatureStateArr[i]; if (panelFeatureState != null) { return panelFeatureState; } PanelFeatureState panelFeatureState2 = new PanelFeatureState(i); panelFeatureStateArr[i] = panelFeatureState2; return panelFeatureState2; } public ViewGroup getSubDecor() { return this.mSubDecor; } @Override // androidx.appcompat.app.AppCompatDelegate public ActionBar getSupportActionBar() { initWindowDecorActionBar(); return this.mActionBar; } public final CharSequence getTitle() { Object obj = this.mHost; return obj instanceof Activity ? ((Activity) obj).getTitle() : this.mTitle; } public final Window.Callback getWindowCallback() { return this.mWindow.getCallback(); } @Override // androidx.appcompat.app.AppCompatDelegate public boolean hasWindowFeature(int i) { int sanitizeWindowFeatureId = sanitizeWindowFeatureId(i); return (sanitizeWindowFeatureId != 1 ? sanitizeWindowFeatureId != 2 ? sanitizeWindowFeatureId != 5 ? sanitizeWindowFeatureId != 10 ? sanitizeWindowFeatureId != 108 ? sanitizeWindowFeatureId != 109 ? false : this.mOverlayActionBar : this.mHasActionBar : this.mOverlayActionMode : this.mFeatureIndeterminateProgress : this.mFeatureProgress : this.mWindowNoTitle) || this.mWindow.hasFeature(i); } @Override // androidx.appcompat.app.AppCompatDelegate 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.TAG, "The Activity's LayoutInflater already has a Factory installed so we can not install AppCompat's"); } } @Override // androidx.appcompat.app.AppCompatDelegate public void invalidateOptionsMenu() { ActionBar supportActionBar = getSupportActionBar(); if (supportActionBar == null || !supportActionBar.invalidateOptionsMenu()) { invalidatePanelMenu(0); } } @Override // androidx.appcompat.app.AppCompatDelegate public boolean isHandleNativeActionModesEnabled() { return this.mHandleNativeActionModes; } public int mapNightMode(@NonNull Context context, int i) { if (i == -100) { return -1; } if (i != -1) { if (i != 0) { if (!(i == 1 || i == 2)) { if (i == 3) { return getAutoBatteryNightModeManager(context).getApplyableNightMode(); } throw new IllegalStateException("Unknown value set for night mode. Please use one of the MODE_NIGHT values from AppCompatDelegate."); } } else if (Build.VERSION.SDK_INT < 23 || ((UiModeManager) context.getApplicationContext().getSystemService(UiModeManager.class)).getNightMode() != 0) { return getAutoTimeNightModeManager(context).getApplyableNightMode(); } else { return -1; } } return i; } 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(); } @Override // androidx.appcompat.app.AppCompatDelegate public void onConfigurationChanged(Configuration configuration) { ActionBar supportActionBar; if (this.mHasActionBar && this.mSubDecorInstalled && (supportActionBar = getSupportActionBar()) != null) { supportActionBar.onConfigurationChanged(configuration); } AppCompatDrawableManager.get().onConfigurationChanged(this.mContext); applyDayNight(false); } @Override // androidx.appcompat.app.AppCompatDelegate public void onCreate(Bundle bundle) { this.mBaseContextAttached = true; applyDayNight(false); ensureWindow(); Object obj = this.mHost; if (obj instanceof Activity) { String str = null; try { str = NavUtils.getParentActivityName((Activity) obj); } catch (IllegalArgumentException unused) { } if (str != null) { ActionBar peekSupportActionBar = peekSupportActionBar(); if (peekSupportActionBar == null) { this.mEnableDefaultActionBarUp = true; } else { peekSupportActionBar.setDefaultDisplayHomeAsUpEnabled(true); } } AppCompatDelegate.addActiveDelegate(this); } this.mCreated = true; } @Override // android.view.LayoutInflater.Factory2 public final View onCreateView(View view, String str, Context context, AttributeSet attributeSet) { return createView(view, str, context, attributeSet); } @Override // android.view.LayoutInflater.Factory public View onCreateView(String str, Context context, AttributeSet attributeSet) { return onCreateView(null, str, context, attributeSet); } /* JADX WARNING: Removed duplicated region for block: B:16:0x005b */ @Override // androidx.appcompat.app.AppCompatDelegate public void onDestroy() { ActionBar actionBar; if (this.mHost instanceof Activity) { AppCompatDelegate.removeActivityDelegate(this); } if (this.mInvalidatePanelMenuPosted) { this.mWindow.getDecorView().removeCallbacks(this.mInvalidatePanelMenuRunnable); } this.mStarted = false; this.mIsDestroyed = true; if (this.mLocalNightMode != -100) { Object obj = this.mHost; if ((obj instanceof Activity) && ((Activity) obj).isChangingConfigurations()) { sLocalNightModes.put(this.mHost.getClass().getName(), Integer.valueOf(this.mLocalNightMode)); actionBar = this.mActionBar; if (actionBar != null) { actionBar.onDestroy(); } cleanupAutoManagers(); } } sLocalNightModes.remove(this.mHost.getClass().getName()); actionBar = this.mActionBar; if (actionBar != null) { } cleanupAutoManagers(); } public boolean onKeyDown(int i, KeyEvent keyEvent) { boolean z2 = true; if (i == 4) { if ((keyEvent.getFlags() & 128) == 0) { z2 = false; } this.mLongPressBackDown = z2; } else if (i == 82) { onKeyDownPanel(0, keyEvent); return true; } return false; } public boolean onKeyShortcut(int i, KeyEvent keyEvent) { ActionBar supportActionBar = getSupportActionBar(); if (supportActionBar != null && supportActionBar.onKeyShortcut(i, keyEvent)) { return true; } PanelFeatureState panelFeatureState = this.mPreparedPanel; if (panelFeatureState == null || !performPanelShortcut(panelFeatureState, keyEvent.getKeyCode(), keyEvent, 1)) { if (this.mPreparedPanel == null) { PanelFeatureState panelState = getPanelState(0, true); preparePanel(panelState, keyEvent); boolean performPanelShortcut = performPanelShortcut(panelState, keyEvent.getKeyCode(), keyEvent, 1); panelState.isPrepared = false; if (performPanelShortcut) { return true; } } return false; } PanelFeatureState panelFeatureState2 = this.mPreparedPanel; if (panelFeatureState2 != null) { panelFeatureState2.isHandled = true; } return true; } public boolean onKeyUp(int i, KeyEvent keyEvent) { if (i == 4) { boolean z2 = this.mLongPressBackDown; this.mLongPressBackDown = false; PanelFeatureState panelState = getPanelState(0, false); if (panelState != null && panelState.isOpen) { if (!z2) { closePanel(panelState, true); } return true; } else if (onBackPressed()) { return true; } } else if (i == 82) { onKeyUpPanel(0, keyEvent); return true; } return false; } @Override // androidx.appcompat.view.menu.MenuBuilder.Callback public boolean onMenuItemSelected(@NonNull MenuBuilder menuBuilder, @NonNull MenuItem menuItem) { PanelFeatureState findMenuPanel; Window.Callback windowCallback = getWindowCallback(); if (windowCallback == null || this.mIsDestroyed || (findMenuPanel = findMenuPanel(menuBuilder.getRootMenu())) == null) { return false; } return windowCallback.onMenuItemSelected(findMenuPanel.featureId, menuItem); } @Override // androidx.appcompat.view.menu.MenuBuilder.Callback public void onMenuModeChange(@NonNull MenuBuilder menuBuilder) { reopenMenu(true); } public void onMenuOpened(int i) { ActionBar supportActionBar; if (i == 108 && (supportActionBar = getSupportActionBar()) != null) { supportActionBar.dispatchMenuVisibilityChanged(true); } } public void onPanelClosed(int i) { if (i == 108) { ActionBar supportActionBar = getSupportActionBar(); if (supportActionBar != null) { supportActionBar.dispatchMenuVisibilityChanged(false); } } else if (i == 0) { PanelFeatureState panelState = getPanelState(i, true); if (panelState.isOpen) { closePanel(panelState, false); } } } @Override // androidx.appcompat.app.AppCompatDelegate public void onPostCreate(Bundle bundle) { ensureSubDecor(); } @Override // androidx.appcompat.app.AppCompatDelegate public void onPostResume() { ActionBar supportActionBar = getSupportActionBar(); if (supportActionBar != null) { supportActionBar.setShowHideAnimationEnabled(true); } } @Override // androidx.appcompat.app.AppCompatDelegate public void onSaveInstanceState(Bundle bundle) { } @Override // androidx.appcompat.app.AppCompatDelegate public void onStart() { this.mStarted = true; applyDayNight(); } @Override // androidx.appcompat.app.AppCompatDelegate public void onStop() { this.mStarted = false; ActionBar supportActionBar = getSupportActionBar(); if (supportActionBar != null) { supportActionBar.setShowHideAnimationEnabled(false); } } public void onSubDecorInstalled(ViewGroup viewGroup) { } public final ActionBar peekSupportActionBar() { return this.mActionBar; } @Override // androidx.appcompat.app.AppCompatDelegate public boolean requestWindowFeature(int i) { int sanitizeWindowFeatureId = sanitizeWindowFeatureId(i); if (this.mWindowNoTitle && sanitizeWindowFeatureId == 108) { return false; } if (this.mHasActionBar && sanitizeWindowFeatureId == 1) { this.mHasActionBar = false; } if (sanitizeWindowFeatureId == 1) { throwFeatureRequestIfSubDecorInstalled(); this.mWindowNoTitle = true; return true; } else if (sanitizeWindowFeatureId == 2) { throwFeatureRequestIfSubDecorInstalled(); this.mFeatureProgress = true; return true; } else if (sanitizeWindowFeatureId == 5) { throwFeatureRequestIfSubDecorInstalled(); this.mFeatureIndeterminateProgress = true; return true; } else if (sanitizeWindowFeatureId == 10) { throwFeatureRequestIfSubDecorInstalled(); this.mOverlayActionMode = true; return true; } else if (sanitizeWindowFeatureId == 108) { throwFeatureRequestIfSubDecorInstalled(); this.mHasActionBar = true; return true; } else if (sanitizeWindowFeatureId != 109) { return this.mWindow.requestFeature(sanitizeWindowFeatureId); } else { throwFeatureRequestIfSubDecorInstalled(); this.mOverlayActionBar = true; return true; } } @Override // androidx.appcompat.app.AppCompatDelegate public void setContentView(int i) { ensureSubDecor(); ViewGroup viewGroup = (ViewGroup) this.mSubDecor.findViewById(16908290); viewGroup.removeAllViews(); LayoutInflater.from(this.mContext).inflate(i, viewGroup); this.mAppCompatWindowCallback.getWrapped().onContentChanged(); } @Override // androidx.appcompat.app.AppCompatDelegate public void setContentView(View view) { ensureSubDecor(); ViewGroup viewGroup = (ViewGroup) this.mSubDecor.findViewById(16908290); viewGroup.removeAllViews(); viewGroup.addView(view); this.mAppCompatWindowCallback.getWrapped().onContentChanged(); } @Override // androidx.appcompat.app.AppCompatDelegate public void setContentView(View view, ViewGroup.LayoutParams layoutParams) { ensureSubDecor(); ViewGroup viewGroup = (ViewGroup) this.mSubDecor.findViewById(16908290); viewGroup.removeAllViews(); viewGroup.addView(view, layoutParams); this.mAppCompatWindowCallback.getWrapped().onContentChanged(); } @Override // androidx.appcompat.app.AppCompatDelegate public void setHandleNativeActionModesEnabled(boolean z2) { this.mHandleNativeActionModes = z2; } @Override // androidx.appcompat.app.AppCompatDelegate @RequiresApi(17) public void setLocalNightMode(int i) { if (this.mLocalNightMode != i) { this.mLocalNightMode = i; if (this.mBaseContextAttached) { applyDayNight(); } } } @Override // androidx.appcompat.app.AppCompatDelegate 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(); } if (toolbar != null) { ToolbarActionBar toolbarActionBar = new ToolbarActionBar(toolbar, getTitle(), this.mAppCompatWindowCallback); this.mActionBar = toolbarActionBar; this.mWindow.setCallback(toolbarActionBar.getWrappedWindowCallback()); } else { this.mActionBar = null; this.mWindow.setCallback(this.mAppCompatWindowCallback); } 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."); } } @Override // androidx.appcompat.app.AppCompatDelegate public void setTheme(@StyleRes int i) { this.mThemeResId = i; } @Override // androidx.appcompat.app.AppCompatDelegate public final void setTitle(CharSequence charSequence) { this.mTitle = charSequence; DecorContentParent decorContentParent = this.mDecorContentParent; if (decorContentParent != null) { decorContentParent.setWindowTitle(charSequence); } else if (peekSupportActionBar() != null) { peekSupportActionBar().setWindowTitle(charSequence); } else { TextView textView = this.mTitleView; if (textView != null) { textView.setText(charSequence); } } } public final boolean shouldAnimateActionModeView() { ViewGroup viewGroup; return this.mSubDecorInstalled && (viewGroup = this.mSubDecor) != null && ViewCompat.isLaidOut(viewGroup); } @Override // androidx.appcompat.app.AppCompatDelegate public androidx.appcompat.view.ActionMode startSupportActionMode(@NonNull 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."); } /* JADX WARNING: Removed duplicated region for block: B:15:0x0025 */ /* JADX WARNING: Removed duplicated region for block: B:16:0x0029 */ public androidx.appcompat.view.ActionMode startSupportActionModeFromWindow(@NonNull ActionMode.Callback callback) { androidx.appcompat.view.ActionMode actionMode; androidx.appcompat.view.ActionMode actionMode2; AppCompatCallback appCompatCallback; androidx.appcompat.view.ContextThemeWrapper contextThemeWrapper; endOnGoingFadeAnimation(); androidx.appcompat.view.ActionMode actionMode3 = this.mActionMode; if (actionMode3 != null) { actionMode3.finish(); } if (!(callback instanceof ActionModeCallbackWrapperV9)) { callback = new ActionModeCallbackWrapperV9(callback); } AppCompatCallback appCompatCallback2 = this.mAppCompatCallback; if (appCompatCallback2 != null && !this.mIsDestroyed) { try { actionMode = appCompatCallback2.onWindowStartingSupportActionMode(callback); } catch (AbstractMethodError unused) { } if (actionMode == null) { this.mActionMode = actionMode; } else { boolean z2 = 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); androidx.appcompat.view.ContextThemeWrapper contextThemeWrapper2 = new androidx.appcompat.view.ContextThemeWrapper(this.mContext, 0); contextThemeWrapper2.getTheme().setTo(newTheme); contextThemeWrapper = contextThemeWrapper2; } else { contextThemeWrapper = this.mContext; } this.mActionModeView = new ActionBarContextView(contextThemeWrapper); PopupWindow popupWindow = new PopupWindow(contextThemeWrapper, (AttributeSet) null, R.attr.actionModePopupWindowStyle); this.mActionModePopup = popupWindow; PopupWindowCompat.setWindowLayoutType(popupWindow, 2); this.mActionModePopup.setContentView(this.mActionModeView); this.mActionModePopup.setWidth(-1); contextThemeWrapper.getTheme().resolveAttribute(R.attr.actionBarSize, typedValue, true); this.mActionModeView.setContentHeight(TypedValue.complexToDimensionPixelSize(typedValue.data, contextThemeWrapper.getResources().getDisplayMetrics())); this.mActionModePopup.setHeight(-2); this.mShowActionModePopup = new AnonymousClass6(); } 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 context = this.mActionModeView.getContext(); ActionBarContextView actionBarContextView = this.mActionModeView; if (this.mActionModePopup != null) { z2 = false; } StandaloneActionMode standaloneActionMode = new StandaloneActionMode(context, actionBarContextView, callback, z2); 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 AnonymousClass7()); } else { this.mActionModeView.setAlpha(1.0f); this.mActionModeView.setVisibility(0); this.mActionModeView.sendAccessibilityEvent(32); 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; } } } actionMode2 = this.mActionMode; if (!(actionMode2 == null || (appCompatCallback = this.mAppCompatCallback) == null)) { appCompatCallback.onSupportActionModeStarted(actionMode2); } return this.mActionMode; } actionMode = null; if (actionMode == null) { } actionMode2 = this.mActionMode; appCompatCallback.onSupportActionModeStarted(actionMode2); return this.mActionMode; } public final int updateStatusGuard(@Nullable WindowInsetsCompat windowInsetsCompat, @Nullable Rect rect) { boolean z2; boolean z3; ViewGroup.MarginLayoutParams marginLayoutParams; int i; int i2 = 0; int systemWindowInsetTop = windowInsetsCompat != null ? windowInsetsCompat.getSystemWindowInsetTop() : rect != null ? rect.top : 0; ActionBarContextView actionBarContextView = this.mActionModeView; if (actionBarContextView == null || !(actionBarContextView.getLayoutParams() instanceof ViewGroup.MarginLayoutParams)) { z2 = false; } else { ViewGroup.MarginLayoutParams marginLayoutParams2 = (ViewGroup.MarginLayoutParams) this.mActionModeView.getLayoutParams(); boolean z4 = true; if (this.mActionModeView.isShown()) { if (this.mTempRect1 == null) { this.mTempRect1 = new Rect(); this.mTempRect2 = new Rect(); } Rect rect2 = this.mTempRect1; Rect rect3 = this.mTempRect2; if (windowInsetsCompat == null) { rect2.set(rect); } else { rect2.set(windowInsetsCompat.getSystemWindowInsetLeft(), windowInsetsCompat.getSystemWindowInsetTop(), windowInsetsCompat.getSystemWindowInsetRight(), windowInsetsCompat.getSystemWindowInsetBottom()); } ViewUtils.computeFitSystemWindows(this.mSubDecor, rect2, rect3); int i3 = rect2.top; int i4 = rect2.left; int i5 = rect2.right; WindowInsetsCompat rootWindowInsets = ViewCompat.getRootWindowInsets(this.mSubDecor); int systemWindowInsetLeft = rootWindowInsets == null ? 0 : rootWindowInsets.getSystemWindowInsetLeft(); int systemWindowInsetRight = rootWindowInsets == null ? 0 : rootWindowInsets.getSystemWindowInsetRight(); if (marginLayoutParams2.topMargin == i3 && marginLayoutParams2.leftMargin == i4 && marginLayoutParams2.rightMargin == i5) { z3 = false; } else { marginLayoutParams2.topMargin = i3; marginLayoutParams2.leftMargin = i4; marginLayoutParams2.rightMargin = i5; z3 = true; } if (i3 <= 0 || this.mStatusGuard != null) { View view = this.mStatusGuard; if (!(view == null || ((marginLayoutParams = (ViewGroup.MarginLayoutParams) view.getLayoutParams()).height == (i = marginLayoutParams2.topMargin) && marginLayoutParams.leftMargin == systemWindowInsetLeft && marginLayoutParams.rightMargin == systemWindowInsetRight))) { marginLayoutParams.height = i; marginLayoutParams.leftMargin = systemWindowInsetLeft; marginLayoutParams.rightMargin = systemWindowInsetRight; this.mStatusGuard.setLayoutParams(marginLayoutParams); } } else { View view2 = new View(this.mContext); this.mStatusGuard = view2; view2.setVisibility(8); FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, marginLayoutParams2.topMargin, 51); layoutParams.leftMargin = systemWindowInsetLeft; layoutParams.rightMargin = systemWindowInsetRight; this.mSubDecor.addView(this.mStatusGuard, -1, layoutParams); } View view3 = this.mStatusGuard; if (view3 == null) { z4 = false; } if (z4 && view3.getVisibility() != 0) { updateStatusGuardColor(this.mStatusGuard); } if (!this.mOverlayActionMode && z4) { systemWindowInsetTop = 0; } z2 = z4; z4 = z3; } else if (marginLayoutParams2.topMargin != 0) { marginLayoutParams2.topMargin = 0; z2 = false; } else { z2 = false; z4 = false; } if (z4) { this.mActionModeView.setLayoutParams(marginLayoutParams2); } } View view4 = this.mStatusGuard; if (view4 != null) { if (!z2) { i2 = 8; } view4.setVisibility(i2); } return systemWindowInsetTop; } }