package o; import android.app.Activity; import android.app.Dialog; import android.app.LocaleManager; import android.content.ComponentName; import android.content.Context; import android.content.pm.PackageItemInfo; import android.content.pm.PackageManager; import android.content.pm.ServiceInfo; import android.content.res.Configuration; import android.os.Bundle; import android.os.LocaleList; import android.view.MenuInflater; import android.view.View; import android.view.ViewGroup; import android.window.OnBackInvokedDispatcher; import androidx.appcompat.app.AppCompatDelegateImpl; import androidx.appcompat.app.AppLocalesMetadataHolderService; import androidx.appcompat.widget.Toolbar; import java.lang.ref.WeakReference; import java.util.Iterator; import java.util.Objects; import o.AGo; import o.XOs; import o.vsf; /* loaded from: classes.dex */ public abstract class Yju { static AGo.LWm a = new AGo.LWm(new AGo.Sts()); private static int j = -100; private static Plu g = null; /* renamed from: o, reason: collision with root package name */ private static Plu f8468o = null; private static Boolean h = null; private static boolean f = false; private static Object i = null; private static Context e = null; private static final wnv> d = new wnv<>(); private static final Object c = new Object(); private static final Object b = new Object(); public abstract void a(Toolbar toolbar); public abstract boolean a(int i2); public abstract vsf b(vsf.HBt hBt); public void b(int i2) { } public abstract T c(int i2); public abstract void c(CharSequence charSequence); public abstract void cB_(Configuration configuration); public abstract void cC_(Bundle bundle); public abstract void cH_(Bundle bundle); public abstract void cI_(Bundle bundle); public abstract void cL_(View view, ViewGroup.LayoutParams layoutParams); public void cM_(OnBackInvokedDispatcher onBackInvokedDispatcher) { } public abstract void ct_(View view, ViewGroup.LayoutParams layoutParams); public abstract MenuInflater cz_(); public abstract void d(int i2); public abstract void d(View view); public int f() { return -100; } @Deprecated public void f(Context context) { } public Context g() { return null; } protected boolean h() { return false; } public abstract XOs.LWm j(); public abstract void k(); public abstract void l(); public abstract pwE m(); public abstract void n(); public abstract void o(); public abstract void p(); public abstract void t(); public static Yju bU_(Activity activity, qPj qpj) { return new AppCompatDelegateImpl(activity, qpj); } public static Yju bV_(Dialog dialog, qPj qpj) { return new AppCompatDelegateImpl(dialog, qpj); } public Context g(Context context) { f(context); return context; } public static void b(Plu plu) { Objects.requireNonNull(plu); if (C17488xFm.c()) { Object a2 = a(); if (a2 != null) { LWm.cg_(a2, RVV.ce_(plu.c())); return; } return; } if (plu.equals(g)) { return; } synchronized (c) { g = plu; r(); } } public static Plu d() { if (C17488xFm.c()) { Object a2 = a(); if (a2 != null) { return Plu.qv_(LWm.cf_(a2)); } } else { Plu plu = g; if (plu != null) { return plu; } } return Plu.d(); } static Object a() { Context g2; Object obj = i; if (obj != null) { return obj; } if (e == null) { Iterator> it = d.iterator(); while (true) { if (!it.hasNext()) { break; } Yju yju = it.next().get(); if (yju != null && (g2 = yju.g()) != null) { e = g2; break; } } } Context context = e; if (context != null) { i = context.getSystemService("locale"); } return i; } /* JADX INFO: Access modifiers changed from: protected */ public static boolean b(Context context) { if (h == null) { try { ServiceInfo dD_ = AppLocalesMetadataHolderService.dD_(context); if (PackageItemInfo.class.getField("metaData").get(dD_) != null) { h = Boolean.valueOf(((Bundle) PackageItemInfo.class.getField("metaData").get(dD_)).getBoolean("autoStoreLocales")); } } catch (PackageManager.NameNotFoundException unused) { h = Boolean.FALSE; } } return h.booleanValue(); } /* JADX INFO: Access modifiers changed from: protected */ public void h(final Context context) { a.execute(new Runnable(context) { // from class: o.ZKJ public final Context b; @Override // java.lang.Runnable public final void run() { Yju.d(this.b); } { this.b = context; } }); } /* JADX INFO: Access modifiers changed from: protected */ /* JADX WARN: Code restructure failed: missing block: B:38:0x0086, code lost: if (r6 != null) goto L41; */ /* JADX WARN: Code restructure failed: missing block: B:39:0x0093, code lost: r6.close(); */ /* JADX WARN: Code restructure failed: missing block: B:41:0x0090, code lost: if (r6 == null) goto L42; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public static void d(final android.content.Context r6) { /* boolean r0 = b(r6) if (r0 != 0) goto L7 return L7: boolean r0 = o.C17488xFm.c() if (r0 == 0) goto L1c boolean r0 = o.Yju.f if (r0 != 0) goto L97 o.AGo$LWm r0 = o.Yju.a o.Hsz r1 = new o.Hsz r1.(r6) r0.execute(r1) return L1c: java.lang.Object r0 = o.Yju.b monitor-enter(r0) o.Plu r1 = o.Yju.g // Catch: java.lang.Throwable -> L98 if (r1 != 0) goto L40 o.Plu r1 = o.Yju.f8468o // Catch: java.lang.Throwable -> L98 if (r1 != 0) goto L31 java.lang.String r6 = o.AGo.e(r6) // Catch: java.lang.Throwable -> L98 o.Plu r6 = o.Plu.e(r6) // Catch: java.lang.Throwable -> L98 o.Yju.f8468o = r6 // Catch: java.lang.Throwable -> L98 L31: o.Plu r6 = o.Yju.f8468o // Catch: java.lang.Throwable -> L98 boolean r6 = r6.a() // Catch: java.lang.Throwable -> L98 if (r6 == 0) goto L3b monitor-exit(r0) return L3b: o.Plu r6 = o.Yju.f8468o // Catch: java.lang.Throwable -> L98 o.Yju.g = r6 // Catch: java.lang.Throwable -> L98 goto L96 L40: o.Plu r2 = o.Yju.f8468o // Catch: java.lang.Throwable -> L98 boolean r1 = r1.equals(r2) // Catch: java.lang.Throwable -> L98 if (r1 != 0) goto L96 o.Plu r1 = o.Yju.g // Catch: java.lang.Throwable -> L98 o.Yju.f8468o = r1 // Catch: java.lang.Throwable -> L98 java.lang.String r1 = r1.c() // Catch: java.lang.Throwable -> L98 java.lang.String r2 = "" boolean r2 = r1.equals(r2) // Catch: java.lang.Throwable -> L98 if (r2 == 0) goto L5e java.lang.String r1 = "androidx.appcompat.app.AppCompatDelegate.application_locales_record_file" r6.deleteFile(r1) // Catch: java.lang.Throwable -> L98 goto L96 L5e: java.lang.String r2 = "androidx.appcompat.app.AppCompatDelegate.application_locales_record_file" r3 = 0 java.io.FileOutputStream r6 = r6.openFileOutput(r2, r3) // Catch: java.lang.Throwable -> L96 java.lang.Throwable -> L98 org.xmlpull.v1.XmlSerializer r2 = android.util.Xml.newSerializer() // Catch: java.lang.Throwable -> L98 r3 = 0 r2.setOutput(r6, r3) // Catch: java.lang.Throwable -> L89 java.lang.Exception -> L90 java.lang.String r4 = "UTF-8" java.lang.Boolean r5 = java.lang.Boolean.TRUE // Catch: java.lang.Throwable -> L89 java.lang.Exception -> L90 r2.startDocument(r4, r5) // Catch: java.lang.Throwable -> L89 java.lang.Exception -> L90 java.lang.String r4 = "locales" r2.startTag(r3, r4) // Catch: java.lang.Throwable -> L89 java.lang.Exception -> L90 java.lang.String r4 = "application_locales" r2.attribute(r3, r4, r1) // Catch: java.lang.Throwable -> L89 java.lang.Exception -> L90 java.lang.String r1 = "locales" r2.endTag(r3, r1) // Catch: java.lang.Throwable -> L89 java.lang.Exception -> L90 r2.endDocument() // Catch: java.lang.Throwable -> L89 java.lang.Exception -> L90 if (r6 == 0) goto L96 goto L93 L89: r1 = move-exception if (r6 == 0) goto L8f r6.close() // Catch: java.io.IOException -> L8f java.lang.Throwable -> L98 L8f: throw r1 // Catch: java.lang.Throwable -> L98 L90: if (r6 != 0) goto L93 goto L96 L93: r6.close() // Catch: java.lang.Throwable -> L98 L96: monitor-exit(r0) L97: return L98: r6 = move-exception monitor-exit(r0) throw r6 */ throw new UnsupportedOperationException("Method not decompiled: o.Yju.d(android.content.Context):void"); } /* JADX INFO: Access modifiers changed from: protected */ public static void b(Yju yju) { synchronized (c) { c(yju); d.add(new WeakReference<>(yju)); } } /* JADX INFO: Access modifiers changed from: protected */ public static void d(Yju yju) { synchronized (c) { c(yju); } } private static void c(Yju yju) { synchronized (c) { Iterator> it = d.iterator(); while (it.hasNext()) { Yju yju2 = it.next().get(); if (yju2 == yju || yju2 == null) { it.remove(); } } } } private static void r() { Iterator> it = d.iterator(); while (it.hasNext()) { Yju yju = it.next().get(); if (yju != null) { yju.h(); } } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static class RVV { static LocaleList ce_(String str) { return LocaleList.forLanguageTags(str); } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static class LWm { static void cg_(Object obj, LocaleList localeList) { ((LocaleManager) obj).setApplicationLocales(localeList); } static LocaleList cf_(Object obj) { return ((LocaleManager) obj).getApplicationLocales(); } } /* JADX INFO: Access modifiers changed from: package-private */ public static /* synthetic */ void e(Context context) { ComponentName componentName = new ComponentName(context, "androidx.appcompat.app.AppLocalesMetadataHolderService"); if (context.getPackageManager().getComponentEnabledSetting(componentName) != 1) { c(context); if (d().a()) { b(Plu.e(AGo.e(context))); } context.getPackageManager().setComponentEnabledSetting(componentName, 1, 1); } f = true; } static void c(Context context) { e = context; } /* JADX INFO: Access modifiers changed from: protected */ public static Plu e() { return f8468o; } /* JADX INFO: Access modifiers changed from: protected */ public static Plu b() { return g; } public static int c() { return j; } }