package p067w; import android.app.Activity; 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.Build; import android.os.Bundle; import android.util.Log; /* renamed from: w.l */ /* loaded from: classes.dex */ public final class C1782l { /* renamed from: w.l$a */ /* loaded from: classes.dex */ public static class C1783a { /* renamed from: a */ public static Intent m413a(Activity activity) { return activity.getParentActivityIntent(); } /* renamed from: b */ public static boolean m412b(Activity activity, Intent intent) { return activity.navigateUpTo(intent); } /* renamed from: c */ public static boolean m411c(Activity activity, Intent intent) { return activity.shouldUpRecreateTask(intent); } } /* renamed from: a */ public static Intent m419a(Activity activity) { Intent m413a = C1783a.m413a(activity); if (m413a != null) { return m413a; } String m417c = m417c(activity); if (m417c == null) { return null; } ComponentName componentName = new ComponentName(activity, m417c); try { return m416d(activity, componentName) == null ? Intent.makeMainActivity(componentName) : new Intent().setComponent(componentName); } catch (PackageManager.NameNotFoundException unused) { Log.e("NavUtils", "getParentActivityIntent: bad parentActivityName '" + m417c + "' in manifest"); return null; } } /* renamed from: b */ public static Intent m418b(Context context, ComponentName componentName) { String m416d = m416d(context, componentName); if (m416d == null) { return null; } ComponentName componentName2 = new ComponentName(componentName.getPackageName(), m416d); return m416d(context, componentName2) == null ? Intent.makeMainActivity(componentName2) : new Intent().setComponent(componentName2); } /* renamed from: c */ public static String m417c(Activity activity) { try { return m416d(activity, activity.getComponentName()); } catch (PackageManager.NameNotFoundException e) { throw new IllegalArgumentException(e); } } /* renamed from: d */ public static String m416d(Context context, ComponentName componentName) { String string; PackageManager packageManager = context.getPackageManager(); int i = Build.VERSION.SDK_INT; ActivityInfo activityInfo = packageManager.getActivityInfo(componentName, i >= 29 ? 269222528 : i >= 24 ? 787072 : 640); 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 context.getPackageName() + string; } return string; } /* renamed from: e */ public static void m415e(Activity activity, Intent intent) { C1783a.m412b(activity, intent); } /* renamed from: f */ public static boolean m414f(Activity activity, Intent intent) { return C1783a.m411c(activity, intent); } }