package C; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.os.Bundle; import android.util.Log; import g.AbstractActivityC0364k; /* renamed from: C.h, reason: case insensitive filesystem */ /* loaded from: classes.dex */ public abstract class AbstractC0044h { /* renamed from: a, reason: collision with root package name */ public static final Object f235a = new Object(); public static Intent a(Context context, ComponentName componentName) { String c4 = c(context, componentName); if (c4 == null) { return null; } ComponentName componentName2 = new ComponentName(componentName.getPackageName(), c4); return c(context, componentName2) == null ? Intent.makeMainActivity(componentName2) : new Intent().setComponent(componentName2); } public static Intent b(AbstractActivityC0364k abstractActivityC0364k) { Intent parentActivityIntent = abstractActivityC0364k.getParentActivityIntent(); if (parentActivityIntent != null) { return parentActivityIntent; } try { String c4 = c(abstractActivityC0364k, abstractActivityC0364k.getComponentName()); if (c4 == null) { return null; } ComponentName componentName = new ComponentName(abstractActivityC0364k, c4); try { return c(abstractActivityC0364k, componentName) == null ? Intent.makeMainActivity(componentName) : new Intent().setComponent(componentName); } catch (PackageManager.NameNotFoundException unused) { Log.e("NavUtils", "getParentActivityIntent: bad parentActivityName '" + c4 + "' in manifest"); return null; } } catch (PackageManager.NameNotFoundException e4) { throw new IllegalArgumentException(e4); } } public static String c(Context context, ComponentName componentName) { String string; ActivityInfo activityInfo = context.getPackageManager().getActivityInfo(componentName, 269222528); String str = activityInfo.parentActivityName; if (str != null) { return str; } Bundle bundle = activityInfo.metaData; if (bundle == null || (string = bundle.getString("android.support.PARENT_ACTIVITY")) == null) { return null; } if (string.charAt(0) != '.') { return string; } return context.getPackageName() + string; } /* JADX WARN: Code restructure failed: missing block: B:16:0x003c, code lost: if (r5 != null) goto L40; */ /* JADX WARN: Code restructure failed: missing block: B:18:?, code lost: return; */ /* JADX WARN: Code restructure failed: missing block: B:20:0x003e, code lost: r5.close(); */ /* JADX WARN: Code restructure failed: missing block: B:33:0x004c, code lost: if (r5 == null) goto L24; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public static void d(android.content.Context r5, java.lang.String r6) { /* java.lang.Object r0 = C.AbstractC0044h.f235a monitor-enter(r0) java.lang.String r1 = "" boolean r1 = r6.equals(r1) // Catch: java.lang.Throwable -> L12 if (r1 == 0) goto L14 java.lang.String r6 = "androidx.appcompat.app.AppCompatDelegate.application_locales_record_file" r5.deleteFile(r6) // Catch: java.lang.Throwable -> L12 monitor-exit(r0) // Catch: java.lang.Throwable -> L12 return L12: r5 = move-exception goto L60 L14: java.lang.String r1 = "androidx.appcompat.app.AppCompatDelegate.application_locales_record_file" r2 = 0 java.io.FileOutputStream r5 = r5.openFileOutput(r1, r2) // Catch: java.lang.Throwable -> L12 java.io.FileNotFoundException -> L57 org.xmlpull.v1.XmlSerializer r1 = android.util.Xml.newSerializer() // Catch: java.lang.Throwable -> L12 r2 = 0 r1.setOutput(r5, r2) // Catch: java.lang.Throwable -> L42 java.lang.Exception -> L44 java.lang.String r3 = "UTF-8" java.lang.Boolean r4 = java.lang.Boolean.TRUE // Catch: java.lang.Throwable -> L42 java.lang.Exception -> L44 r1.startDocument(r3, r4) // Catch: java.lang.Throwable -> L42 java.lang.Exception -> L44 java.lang.String r3 = "locales" r1.startTag(r2, r3) // Catch: java.lang.Throwable -> L42 java.lang.Exception -> L44 java.lang.String r3 = "application_locales" r1.attribute(r2, r3, r6) // Catch: java.lang.Throwable -> L42 java.lang.Exception -> L44 java.lang.String r6 = "locales" r1.endTag(r2, r6) // Catch: java.lang.Throwable -> L42 java.lang.Exception -> L44 r1.endDocument() // Catch: java.lang.Throwable -> L42 java.lang.Exception -> L44 if (r5 == 0) goto L4f L3e: r5.close() // Catch: java.lang.Throwable -> L12 java.io.IOException -> L4f goto L4f L42: r6 = move-exception goto L51 L44: r6 = move-exception java.lang.String r1 = "AppLocalesStorageHelper" java.lang.String r2 = "Storing App Locales : Failed to persist app-locales in storage " android.util.Log.w(r1, r2, r6) // Catch: java.lang.Throwable -> L42 if (r5 == 0) goto L4f goto L3e L4f: monitor-exit(r0) // Catch: java.lang.Throwable -> L12 goto L5f L51: if (r5 == 0) goto L56 r5.close() // Catch: java.lang.Throwable -> L12 java.io.IOException -> L56 L56: throw r6 // Catch: java.lang.Throwable -> L12 L57: java.lang.String r5 = "AppLocalesStorageHelper" java.lang.String r6 = "Storing App Locales : FileNotFoundException: Cannot open file androidx.appcompat.app.AppCompatDelegate.application_locales_record_file for writing " android.util.Log.w(r5, r6) // Catch: java.lang.Throwable -> L12 monitor-exit(r0) // Catch: java.lang.Throwable -> L12 L5f: return L60: monitor-exit(r0) // Catch: java.lang.Throwable -> L12 throw r5 */ throw new UnsupportedOperationException("Method not decompiled: C.AbstractC0044h.d(android.content.Context, java.lang.String):void"); } /* JADX WARN: Code restructure failed: missing block: B:16:0x0044, code lost: if (r2 != null) goto L48; */ /* JADX WARN: Code restructure failed: missing block: B:18:0x005a, code lost: if (r1.isEmpty() == false) goto L33; */ /* JADX WARN: Code restructure failed: missing block: B:23:0x005d, code lost: r8.deleteFile("androidx.appcompat.app.AppCompatDelegate.application_locales_record_file"); */ /* JADX WARN: Code restructure failed: missing block: B:25:0x0046, code lost: r2.close(); */ /* JADX WARN: Code restructure failed: missing block: B:31:0x002e, code lost: if (r5 != 4) goto L57; */ /* JADX WARN: Code restructure failed: missing block: B:34:0x003b, code lost: if (r3.getName().equals("locales") == false) goto L62; */ /* JADX WARN: Code restructure failed: missing block: B:36:0x003d, code lost: r1 = r3.getAttributeValue(null, "application_locales"); */ /* JADX WARN: Code restructure failed: missing block: B:54:0x0053, code lost: if (r2 == null) goto L31; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public static java.lang.String e(android.content.Context r8) { /* java.lang.Object r0 = C.AbstractC0044h.f235a monitor-enter(r0) java.lang.String r1 = "" java.lang.String r2 = "androidx.appcompat.app.AppCompatDelegate.application_locales_record_file" java.io.FileInputStream r2 = r8.openFileInput(r2) // Catch: java.lang.Throwable -> L4a java.io.FileNotFoundException -> L6a org.xmlpull.v1.XmlPullParser r3 = android.util.Xml.newPullParser() // Catch: java.lang.Throwable -> L29 java.lang.Throwable -> L4c java.lang.String r4 = "UTF-8" r3.setInput(r2, r4) // Catch: java.lang.Throwable -> L29 java.lang.Throwable -> L4c int r4 = r3.getDepth() // Catch: java.lang.Throwable -> L29 java.lang.Throwable -> L4c L18: int r5 = r3.next() // Catch: java.lang.Throwable -> L29 java.lang.Throwable -> L4c r6 = 1 if (r5 == r6) goto L44 r6 = 3 if (r5 != r6) goto L2b int r7 = r3.getDepth() // Catch: java.lang.Throwable -> L29 java.lang.Throwable -> L4c if (r7 <= r4) goto L44 goto L2b L29: r8 = move-exception goto L64 L2b: if (r5 == r6) goto L18 r6 = 4 if (r5 != r6) goto L31 goto L18 L31: java.lang.String r5 = r3.getName() // Catch: java.lang.Throwable -> L29 java.lang.Throwable -> L4c java.lang.String r6 = "locales" boolean r5 = r5.equals(r6) // Catch: java.lang.Throwable -> L29 java.lang.Throwable -> L4c if (r5 == 0) goto L18 java.lang.String r4 = "application_locales" r5 = 0 java.lang.String r1 = r3.getAttributeValue(r5, r4) // Catch: java.lang.Throwable -> L29 java.lang.Throwable -> L4c L44: if (r2 == 0) goto L56 L46: r2.close() // Catch: java.lang.Throwable -> L4a java.io.IOException -> L56 goto L56 L4a: r8 = move-exception goto L6c L4c: java.lang.String r3 = "AppLocalesStorageHelper" java.lang.String r4 = "Reading app Locales : Unable to parse through file :androidx.appcompat.app.AppCompatDelegate.application_locales_record_file" android.util.Log.w(r3, r4) // Catch: java.lang.Throwable -> L29 if (r2 == 0) goto L56 goto L46 L56: boolean r2 = r1.isEmpty() // Catch: java.lang.Throwable -> L4a if (r2 != 0) goto L5d goto L62 L5d: java.lang.String r2 = "androidx.appcompat.app.AppCompatDelegate.application_locales_record_file" r8.deleteFile(r2) // Catch: java.lang.Throwable -> L4a L62: monitor-exit(r0) // Catch: java.lang.Throwable -> L4a return r1 L64: if (r2 == 0) goto L69 r2.close() // Catch: java.lang.Throwable -> L4a java.io.IOException -> L69 L69: throw r8 // Catch: java.lang.Throwable -> L4a L6a: monitor-exit(r0) // Catch: java.lang.Throwable -> L4a return r1 L6c: monitor-exit(r0) // Catch: java.lang.Throwable -> L4a throw r8 */ throw new UnsupportedOperationException("Method not decompiled: C.AbstractC0044h.e(android.content.Context):java.lang.String"); } }